Please can someone confirm that my description of the application of Dijkstra's algorithm is correct for this graph?
1 3
A -- B -- C
\ /
2 \ / 1
\ /
D
Step Current Node
B C D
1 A 1(A) - 2(A)
2 B 1(A) 4(B) 2(A)
3 D 1(A) 3(D) 2(A)
4 C 1(A) 3(D) 2(A)
Description:
- Tentative distances to
B
andD
determined.C
not yet visible. - Shortest distance from previous step taken. No new information on shortest path to
B
. Tentative distance toC
now known. No new information onD
. - We choose to backtrack to
A
, and then move toD
because the distance toD
(2) is smaller than that toC
(4). We update the tentative distance toC
because viaD
it is shorter than viaB
. - We choose to move to
C
directly fromD
because it is shorter (3) than backtracking and going viaA
(4). Moving toC
gives us no new shorter distances. All nodes visited, so end.