Below is an adjacency matrix for a weighted, undirected graph.
A B C D E F G H I J
A - - 5 - - - 4 9 3 4
B - - - - - - 5 - - 5
C 5 - - - - - 5 - - 5
D - - - - - - 7 - - -
E - - - - - 2 - - 5 -
F - - 1 - 2 - 1 8 - 5
G 4 5 - 7 - 1 - - - -
H 9 - - - - 8 - - 4 -
I 3 - - - 5 - - 4 - -
J 4 5 - - - 5 - - - -
Question 1: After one pass of Dijkstra’s algorithm starting with node A, give me the order of the nodes on the multimap, as a single string (if there are multiple possible answers, just give me one of them).
[3,I] [4,G] -- The order of G and J may be reversed. [4,J] [5,C] [9,H]Thus, the answer is IGJCHJ or IJGCH.
Question 2: After the second pass of Dijkstra’s algorithm starting with node A, give me the order of the nodes on the multimap, as a single string (if there are multiple possible answers, just give me one of them).
[4,G] -- The order of G and J may be reversed. [4,J] [5,C] [7,H] [8,E]Thus, the answer is CJCHE or JGCHE.