Dijkstra’s Shortest Path Algorithm in Python

Micah Shute
Cantor’s Paradise
23 min readNov 9, 2019

--

From GPS navigation to network-layer link-state routing, Dijkstra’s Algorithm powers some of the most taken-for-granted modern services. Utilizing some basic data structures, let’s get an understanding of what it does, how it accomplishes its goal, and how to implement it in Python (first naively, and then with good asymptotic runtime!)

What does it do?

--

--

Computer and Software Engineer. Former Nuclear Submarine Officer, USNA ’12.