The Only SSSP Algorithm
Understand Ford's generic algorithm for single source shortest path problems. Explore initialization, edge relaxation, and how the algorithm determines shortest paths or detects negative cycles in weighted graphs. This lesson teaches you how to implement and assess the correctness of this foundational algorithm.
We'll cover the following...
Lester Ford algorithm for SSSP
Just like graph traversal and minimum spanning trees, many different SSSP algorithms can be described as special cases of a single generic algorithm, first proposed by Lester Ford in 1956 and independently described by George Dantzig in 1957 and again by George Minty in 1958. Each vertex in the graph stores two values, which (inductively) describe a tentative shortest path from to .
- : This is the length of the tentative shortest path, or ∞ if there is no such path.
- : This is the predecessor of in the tentative shortest path, or if there is no such vertex.
Initialization and predecessors
The predecessor pointers automatically define a tentative shortest path tree rooted at ; these pointers are exactly the same as the parent pointers in our generic graph traversal algorithm. At the beginning of the algorithm, we initialize the distances and predecessors as follows:
Algorithm
...