[Go to graphs]

Shortest path algorithms

Applications

Three flavors: Source-Target, Single Source, All Pairs

Source-Target (s-t)

Problem definition: Given a weighted graph, find the shortest path from $s$ to $t$ (so the cost of path, the sum of edge costs in path, is minimized). If the graph is directed, directions of the edges need to be respected.

Single Source

Problem definition: Given weighted graph and single source s, find distance (and shortest path) from s to every other vertex.
Shortest paths form a tree.

Algorithms for single source shortest path problem: BFS, Dijkstra's, Bellman-Ford

All-Pairs Shortest Path