Dijkstra with a Heap
Greedy shortest paths on non-negative edges.
The Shortest-Path Problem
You want the cheapest route from one node to every other node. Dijkstra solves this when every edge weight is zero or positive.
The Greedy Idea
Dijkstra is greedy: it always expands the unvisited node with the smallest known distance, trusting that distance is final.
All lessons in this course
- Dijkstra with a Heap
- 0-1 BFS with a Deque
- Bellman-Ford & Negative Edges
- Floyd-Warshall All-Pairs