← Shortest Paths · guided lesson

Shortest Paths

1 / 18 · story

the story

Dijkstra's algorithm

Every tool here exists because something was too slow or broke without it. Here is what.

1956 (idea) · 1959 (paper) · Edsger W. Dijkstra

In 1956 Dijkstra needed a demo for the new ARMAC computer in Amsterdam that non-mathematicians could follow: the shortest route between two Dutch cities, on a reduced map of 64 cities. As he recalled in a 2001 interview, he designed it in about 20 minutes on a café terrace in Amsterdam, resting during a shopping trip with his fiancée — without pencil and paper. He published it three years later, in 1959, as "A note on two problems in connexion with graphs". Heap versions came later (O(E log V) by 1972; Fredman and Tarjan's Fibonacci heap in 1987) — that's what makes it fast on huge sparse graphs.

the problem it solved

The cheapest route from one place to every other place when every link has a non-negative cost — in time only a little more than the size of the map.

why it matters: without it

Routing would fall back to Bellman–Ford's V·E work, or to trying routes one by one — in the worst case a single city-to-city query on a big map could take hours instead of moments.

sources: Dijkstra — A note on two problems in connexion with graphs (Numerische Mathematik, 1959) ↗ · Frana & Misa — An interview with Edsger W. Dijkstra (CACM, 2010; recorded 2001) ↗ · Schrijver — On the history of the shortest path problem (Documenta Mathematica, 2012) ↗ · Fredman & Tarjan — Fibonacci heaps and their uses in improved network optimization algorithms (JACM, 1987) ↗

also in this chapter: Bellman–Ford (edge relaxation in rounds) · Floyd–Warshall (all pairs) · 0-1 BFS (deque instead of heap) · Minimax (bottleneck) paths