Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(a) Run Dijkstra\'s algorithm on this graph to compute the shortest paths betwee

ID: 3824224 • Letter: #

Question

(a)    Run Dijkstra's algorithm on this graph to compute the shortest paths between 0 and every other node. For reference, the algorithm is shown on the next page. Use the adjacency list above for the order of the nodes explored and follow the trace format shown before.

0

1,3,2

1

5,4

2

3

3

2

4

5

5

4,6,7

6

7

Before loop:

distTo[0]=0

nodes-{0,1,2,3,4,5,6,7}

Loop 1:

v=

distTo[ ]=

edgeTo[ ]=

distTo[ ]=

edgeTo[ ]=

distTo[ ]=

edgeTo[ ]=

nodes={                     }

0

1,3,2

1

5,4

2

3

3

2

4

5

5

4,6,7

6

7

3 5 S LJ -5

Explanation / Answer

Path : 0 -> 1
Distance : 2

Path : 0 -> 2
Distance : 1

Path : 0 -> 2, 2 -> 3
Distance : 3

Path : 0 -> 2, 2 -> 3, 3 -> 4
Distance : 5

Path : 0 -> 1, 1 -> 5
Distance : 5

Path : 0 -> 2, 2 -> 3, 3 -> 4, 4 -> 6
Distance : 10

No path found from 0 to 7