Single-source shortest path algorithm that handles negative edge weights.
Step 1 of 15
Initialise. Distance to "A" = 0; all others = ∞.
Pass
Distances from A
Legend
The edge C→B has weight −6, enabling a shorter path to B via C. Dijkstra cannot handle this; Bellman-Ford can.