Why it matters
Bellman-Ford handles negative weights unlike Dijkstra. Foundation of distance-vector routing.
Advertisement
The architecture
Relax all edges V-1 times.
V-th pass detects negative cycle.
O(V·E) time.
Advertisement
How it works end to end
V-1 relaxations.
V-th detects negative cycle.
O(V·E) time.