Bellman–Ford algorithm
The Bellman–Ford algorithm finds shortest paths from one source in a weighted graph, even with negative edge weights, and detects reachable negative-weight cycles.
The Bellman–Ford algorithm finds shortest paths from one source in a weighted graph, even with negative edge weights, and detects reachable negative-weight cycles.