🧮Dijkstra's Algorithm
Also known as Dijkstra, Dijkstra Shortest Path, Shortest Path Algorithm
A way to find the shortest route through a graph where each road has a length.
Think of it like
Think of it like a map app. It tries the closest roads first and keeps the best time to each place.
Example
Lucy's delivery app finds the quickest route across 400 streets. Dijkstra's algorithm picks a path of 9 minutes over one of 14.
Why it matters
Route planners, network routers and games all find short paths with it or a close cousin.
Definition
Common mistake
Key takeaways
- 1Shortest by weight. Not by number of steps.
- 2Closest first. A heap picks it fast.
- 3No negative weights. Or it goes wrong.