Synchronous Bellman-Ford recurrence
ID: synchronous-bellman-ford-recurrence
For the single-source problem, let be the minimum cost of a directed walk from to using at most edges. Set and for , use for finite , and let a minimum over an empty set be . ThenEvery entry on the right comes from the previous round, requiring separate old and new arrays. The proof is the last-edge decomposition: a permitted directed walk either already uses at most edges, or ends with some after a prefix using at most . Conversely, each candidate describes a permitted directed walk. This dynamic programming viewpoint gives an exact meaning to every intermediate label, even when negative-cost directed cycles exist. Apply the formula to the source too: its initial zero is not a permanent constraint.
If no negative-cost directed cycle is reachable from , removing repeated-vertex portions of a directed walk cannot increase its cost. Whenever a destination is reachable, some shortest directed path therefore uses at most edges, and . Unreachable vertices keep distance . For in-place passes, every finite label still comes from a discovered directed walk; moreover, pass has offered every prefix of length of a shortest directed path, regardless of scan order. Its labels can improve faster than the synchronous labels, while the same upper bound on passes remains valid. This is why repeated local corrections eventually settle a global shortest path problem.
New to topics? Read the docs here!