Bellman-Ford & Negative Edges
Handle negatives and detect cycles.
When Dijkstra Fails
Dijkstra trusts that a popped distance is final, but a negative edge can later make a path cheaper. So it breaks.
Enter Bellman-Ford
Bellman-Ford handles negative edge weights. It is slower than Dijkstra but robust where greedy logic cannot be trusted.
All lessons in this course
- Dijkstra with a Heap
- 0-1 BFS with a Deque
- Bellman-Ford & Negative Edges
- Floyd-Warshall All-Pairs