A forward-backward single-source shortest paths algorithm

David B. Wilson, Uri Zwick

Research output: Contribution to journalArticlepeer-review


We describe a new forward-backward variant of Dijkstra's and Spira's single-source shortest paths (SSSP) algorithms. While essentially all SSSP algorithms scan edges only forward, the new algorithm scans some edges backward. The new algorithm assumes that edges in the outgoing and incoming adjacency lists of the vertices appear in nondecreasing order of weight. (Spira's algorithm makes the same assumption about the outgoing adjacency lists but does not use incoming adjacency lists.) The running time of the algorithm on a complete directed graph on n vertices with independent exponential edge weights is O(n) with very high probability. This improves on the previous best result of O(n log n), which is best possible if only forward scans are allowed, exhibiting an interesting separation between forward-only and forward-backward SSSP algorithms. As a consequence, we also get a new all-pairs shortest paths algorithm. The expected running time of the algorithm on complete graphs with independent exponential edge weights is O(n2), matching a recent algorithm of Demetrescu and Italiano as analyzed by Peres et al. [J. ACM, 60 (2013), 26]. Furthermore, the probability that the new algorithm requires more than O(n2) time is exponentially small, improving on the O(n-1/26) probability bound obtained by Peres et al.

Original languageEnglish
Pages (from-to)698-739
Number of pages42
JournalSIAM Journal on Computing
Issue number3
StatePublished - 2015


  • Average case analysis
  • Random graphs
  • Shortest paths


Dive into the research topics of 'A forward-backward single-source shortest paths algorithm'. Together they form a unique fingerprint.

Cite this