English

Bidirectional Dijkstra's Algorithm is Instance-Optimal

Data Structures and Algorithms 2025-06-16 v3

Abstract

Although Dijkstra's algorithm has near-optimal time complexity for the problem of finding a shortest path from a given vertex ss to a given vertex tt, in practice other algorithms are often superior on huge graphs. A prominent example is bidirectional search, which concurrently executes Dijkstra's algorithm forward from ss and backward from tt, and stops when these executions meet. In this paper, we give a strong theoretical justification for the use of bidirectional search to find a shortest stst-path. We prove that for weighted multigraphs, both directed and undirected, a careful implementation of bidirectional search is instance-optimal with respect to the number of edges it examines. That is, we prove that no correct algorithm can outperform our implementation of bidirectional search on any single instance by more than a constant factor. For unweighted graphs, we show that bidirectional breadth-first search is instance-optimal up to a factor of O(Δ)O(\Delta) where Δ\Delta is the maximum degree of the graph. We also show that this is best possible.

Keywords

Cite

@article{arxiv.2410.14638,
  title  = {Bidirectional Dijkstra's Algorithm is Instance-Optimal},
  author = {Bernhard Haeupler and Richard Hladík and Vaclav Rozhon and Robert E. Tarjan and Jakub Tětek},
  journal= {arXiv preprint arXiv:2410.14638},
  year   = {2025}
}

Comments

Fixed a bug in the bidirectional search pseudocode where e_mid was updated even if $\mu$ wasn't. Fixed a typo in the proof of Theorem 3: changed all $v_1u_2$ to $u_2v_1$. Other polishing and rewording