You are on page 1of 2

Mathematics 4 (MAT4)

Individual assignment 3

Shortest paths by hand

2022
Part A

Table 1. Location matrix Table 2. Connection matrix


x y A B C D
A 703 47 A - 1 1 -
B 925 317 B 1 - 1 1
C 796 770 C 1 1 - 1
D 32 823 D - 1 1 -

a) Merge the location matrix and connection matrix into a connectivity matrix.
You can finish the connectivity matrix below
Table 3 Connectivity matrix

A B C D
A - 349.5 - -
B 349.5
C
D

b) Calculate the shortest path using Dijkstra’s Algorithm.


c) Determine the minimum spanning tree with Prim’s Algorithm.
d) Determine the minimum spanning tree with Kruskal’s Algorithm.
.

Part B
Study the file mystery.py.
Explain the steps in this Python-programme and fill in the missing comments in the
code. (Missing comments are represented with # [?????????????????????])

Deliverables:
Hand in a scanned copy of your answers (pdf) before deadline on Canvas.

You might also like