Bellman–Ford Algorithm
Definition
Graphene algorithm for calculating shortest paths from a starting node, which can also process negative edge weights and detect reachable negative cycles.
Bellman-Ford initializes distances and improves them repeatedly by relaxing all edges. After at most |V|-1 runs, the shortest paths are determined if no reachable negative cycle exists. An additional run can detect such cycles.
Simply explained
The algorithm checks all connections again and again and improves known paths until no shorter ones should be found.
Why it matters in practice
Basic concept of graph theory. Practically relevant for routing or cost problems with possible negative edge weights.
Example from business
Example scenario: A weighted dependency graph contains positive and negative transition costs; Bellman-Ford determines the shortest paths and detects problematic negative cycles.
Limits and pitfalls
- Equate with Dijkstra; treat negative cycles as valid shortest paths; underestimate run time O(V·E) in large graphs.
Origin & history
Bellman-Ford is one of the classic shortest-way methods. It also takes negative edge weights into account and checks for negative cycles.
Use in mid-sized companies
- Use for special graph problems; with only non-negative weights, more efficient methods such as Dijkstra may be more suitable.
Frequently asked questions
Can there be negative edges?
Yes.
Can there be attainable negative cycles?
Then there is no finite shortest path along these cycles.
Is Bellman-Ford always faster than Dijkstra?
No.
Sources
- Bellman-Ford · NIST Dictionary of Algorithms and Data Structures, Bellman-Ford
Source check: 10/09/2026. Definition and documented classification matched; examples describe possible applications.
Editorially reviewed on: