For an all-to-one shortest path problem with root , initialize and all other labels to infinity. Set , keeping the root at zero. Induction identifies the labels with the shortest directed paths using at most directed edges. Without a reachable negative directed cycle, rounds suffice after removing directed cycles from a shortest walk. In-place or queue variants repeatedly relax incoming directed edges to an improved label. Labels may decrease multiple times, so this is a label-correcting shortest-path algorithm.

Articles by others on the same topic (NaN)

The Bellman-Ford algorithm is an efficient algorithm used to find the shortest paths from a single source vertex to all other vertices in a graph. It is particularly useful for graphs that may contain edges with negative weights, making it more versatile than Dijkstra's algorithm, which only works with non-negative weights.