Skip to main content
QUICK REVIEW

[Paper Review] Randomized Speedup of the Bellman-Ford Algorithm

Michael J. Bannister, David Eppstein|arXiv (Cornell University)|Nov 23, 2011
Complexity and Algorithms in Graphs13 references4 citations
TL;DR

This paper proposes a randomized variant of the Bellman-Ford algorithm that improves performance by randomly permuting vertices before each pass, reducing the expected number of relaxation steps by a factor of 2/3 compared to Yen's 1970 algorithm. The method achieves $ mn/3 + o(mn) $ relaxations with high probability and enables efficient negative cycle detection using high-probability bounds.

ABSTRACT

We describe a variant of the Bellman-Ford algorithm for single-source shortest paths in graphs with negative edges but no negative cycles that randomly permutes the vertices and uses this randomized order to process the vertices within each pass of the algorithm. The modification reduces the worst-case expected number of relaxation steps of the algorithm, compared to the previously-best variant by Yen (1970), by a factor of 2/3 with high probability. We also use our high probability bound to add negative cycle detection to the randomized algorithm.

Motivation & Objective

  • To reduce the worst-case expected number of relaxation steps in the Bellman-Ford algorithm for graphs with negative edges but no negative cycles.
  • To improve upon Yen’s 1970 algorithm, which already reduced relaxation steps by a factor of two, by introducing random vertex permutation to achieve an additional 2/3 speedup.
  • To provide high-probability runtime bounds that enable efficient negative cycle detection in the algorithm.
  • To demonstrate that randomization can yield a constant-factor improvement in fundamental graph algorithms, despite decades of prior optimization.

Proposed method

  • Randomly permute the vertex order at the start of each pass to guide the sequence of edge relaxations.
  • Apply Yen’s two-DAG decomposition method, but process edges in the randomized vertex order within each pass.
  • Use high-probability concentration bounds to analyze the expected number of relaxations, leveraging the fact that shortest paths are relaxed in path order with high probability.
  • Maintain a predecessor graph $ G_p $ to detect negative cycles by checking for cycles after $ n/3 + 1 + \sqrt{2cn\log n} $ iterations.
  • Perform cycle detection on $ G_p $ in $ O(n) $ time per iteration, using the fact that each vertex has at most one outgoing edge in $ G_p $.
  • Use the high-probability bound to convert the dense graph algorithm into a Monte Carlo algorithm for negative cycle detection with small error probability.

Experimental results

Research questions

  • RQ1Can random vertex permutation reduce the expected number of relaxation steps in the Bellman-Ford algorithm beyond existing optimizations?
  • RQ2What is the expected number of relaxation steps in the randomized variant, and how does it compare to Yen’s algorithm?
  • RQ3Can high-probability bounds on relaxation counts be used to detect negative cycles efficiently?
  • RQ4Does the randomized approach maintain or improve practical performance while ensuring correctness with high probability?

Key findings

  • The randomized Bellman-Ford algorithm reduces the expected number of relaxation steps to $ mn/3 + o(mn) $, a 2/3 speedup over Yen’s algorithm.
  • For dense graphs, the expected number of relaxations is at most $ n^3/6 + o(n^3) $, achieving a constant-factor improvement in the worst-case expected runtime.
  • With high probability, all vertices achieve correct distances after $ n/3 + 1 + \sqrt{2cn\log n} $ iterations, ensuring correctness with probability at least $ 1 - 1/n^{c-1} $.
  • Negative cycles can be detected with high probability after $ n/3 + 2 + \sqrt{2cn\log n} $ iterations by checking for cycles in the predecessor graph $ G_p $.
  • The algorithm can be turned into a Monte Carlo algorithm for negative cycle detection in dense graphs, with error probability bounded by $ 1/n^{c-1} $.
  • The improvement is the first constant-factor speedup in the Bellman-Ford algorithm since Yen’s 1970 work, demonstrating the power of randomization in basic graph algorithms.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.