Overview
Bellman-Ford repeatedly relaxes every edge, allowing shortest-path estimates to improve across paths with more edges. A final relaxation pass detects reachable negative cycles.
Finds single-source shortest paths even when edges can have negative weights.
Compact metadata for implementation and discovery.
Bellman-Ford repeatedly relaxes every edge, allowing shortest-path estimates to improve across paths with more edges. A final relaxation pass detects reachable negative cycles.
Quick facts
Runtime and memory behavior at a glance.
Best
O(VE)
Average
O(VE)
Worst
O(VE)
Space
O(V)
dist[v] = min(dist[v], dist[u] + weight(u, v))Repeats edge relaxation enough times to propagate shortest paths through the graph.
Show all edges being relaxed across repeated passes.
Bellman-Ford is slower than Dijkstra on nonnegative graphs, but it handles negative edges and detects reachable negative cycles.
What each reference supports for this entry.
Textbook reference for the algorithmic family and analysis of Bellman-Ford.
Good next jumps from the relationship graph, ranked for useful discovery.
Bellman-Ford supports negative edge weights at higher cost.
Johnson's Algorithm uses Bellman-Ford to compute reweighting potentials.
Johnson's Algorithm uses Bellman-Ford to compute reweighting potentials.