Shortest Path Algorithms
Definitions
Variants Single-source shortest-paths problem: Given a graph, finding a shortest path from a given source vertex to all the vertices in the graph (Our problem) Single-destination shortest-paths problem: If you reverse the directions of all edges, you can solve it as a single-source problem.
Variants
All-pairs shortest-path problems: Find a shortest part from each vertex to each vertex. Although this problem can be solved by running a single-source algorithm once from each vertex, it can usually be solved faster.
Structure of a Shortest Path Subpaths of shortest paths are shortest paths. (WHY?) Negative-weight edges? Cycles? Negative-weight cycles?
Representing Shortest Paths
Initialization
Relaxation
The Bellman-Ford Algorithm The Bellman-Ford Algorithm solves the single- source shortest-path problems in which the edge weights may be negative. It also alerts us if there is a negative-weight cycle that is reachable from the source. If there is no such cycle, the algorithm produces the shortest paths and their weights.
Example and Implementation Issues
Correctness
Computational Complexity
Dijkstra’s Algorithm
Example
Implementation Issues
Approach
Correctness
Proof:
Computational Complexity