YUNOVA · Data Structures & Algorithms · Module 12: Advanced graphs
Bellman-Ford and Floyd-Warshall
Bellman-Ford and Floyd-Warshall
Key points
- Bellman-Ford finds single-source shortest paths and works with negative edges.
- Relaxing all edges V-1 times is enough; any further improvement means a negative cycle.
- Floyd-Warshall finds all-pairs shortest paths in O(V³).