Dijkstra's algorithm solves one-source shortest paths with nonnegative edge weights. This lesson follows the settled labels, then reads the final predecessor tree from the recomputed table.

highlighted = computed this step

Settle labels

Dijkstra starts at A with distance 0 and finishes with every node settled. Motivation: nonnegative weights let the smallest unsettled label become final when it is chosen.

d(A)=0d(A)=0
Dijkstra state123456789Ad=0Bd=1Cd=3Dd=5Ed=8Fd=13

Final distances

The final distances are 0, 1, 3, 5, 8, and 13. Why: each label is the exact length of the best path certified from A on this graph.

dA,dB,dC,dD,dE,dF=0,1,3,5,8,13d_A,d_B,d_C,d_D,d_E,d_F=0,1,3,5,8,13
Dijkstra labelsnodedistpredA0-B1AC3BD5BE8CF13D

Predecessor tree

The shortest-path tree has 5 predecessor edges, and D's predecessor is B. Interpretation: the predecessor pointers reconstruct the certified paths from A, while the labels give their lengths.

predecessor edges=5\text{predecessor edges}=5
Dijkstra labelsnodedistpredA0-B1AC3BD5BE8CF13D

Diagram note

Certificate note: the graph marks node states by role and the table pins the final integer labels. Pixel positions are rounded for layout; every number shown is exact.

Dijkstra labels are exact on this nonnegative graph\text{Dijkstra labels are exact on this nonnegative graph}
Dijkstra labelsnodedistpredA0-B1AC3BD5BE8CF13D