Table of Contents
Fetching ...

Universal Optimality of Dijkstra via Beyond-Worst-Case Heaps

Bernhard Haeupler, Richard Hladík, Václav Rozhoň, Robert E. Tarjan, Jakub Tětek

TL;DR

This paper establishes that Dijkstra's shortest-path algorithm, when paired with a carefully designed heap that satisfies a working-set bound, is universally optimal in running time for the distance-order problem on graphs with nonnegative weights. It introduces a new heap architecture—the outer heap composed of inner fast heaps with a small, efficiently maintained bit-vector for suffix minima—achieving a DeleteMin cost of $O(\log W(x))$ and enabling $O(m+\log D)$ time overall, where $D$ is the number of distance orders. The authors also present two extensions that are universally optimal in both time and comparisons: Dijkstra with lookahead and recursive Dijkstra, each leveraging bottlenecks and structured processing to reduce comparisons to $O(F-n+1+\log D)$ (directed) or $O(m-n+1+\log D)$. Complementing the algorithmic results, the paper proves tight lower bounds for both time ($\Omega(m+\log D)$) and comparisons, establishing universal optimality in a strong theoretical sense. Collectively, these results offer a foundational bridge between universal optimality and sequential graph algorithms, with practical implications for designing near-optimal data structures tailored to graph problems. $ $

Abstract

In this paper we prove that Dijkstra's shortest-path algorithm, if implemented with a sufficiently efficient heap, is universally optimal in its running time, and with suitable small additions is also universally optimal in its number of comparisons. Universal optimality is a powerful beyond-worst-case performance guarantee for graph algorithms that informally states that a single algorithm on a problem involving graphs with arc and/or vertex weights performs as well as possible on every graph, assuming a worst-case choice of weights. We give the first application of this notion to any sequential algorithm. We design a new heap data structure with a working-set bound, which guarantees that the heap takes advantage of a certain kind of locality in the heap operations. Our heap has the optimal (amortized) bounds of Fibonacci heaps but also has the beyond-worst-case guarantee that the cost of deleting the minimum item is logarithmic in the number of items inserted after it but before it is deleted, instead of logarithmic in the size of the heap when the item is deleted. That is, deletion of recently inserted items is especially efficient. We prove that our working-set bound guarantees universal optimality for the problem of ordering vertices by their distance from the source vertex, which we call the distance order problem. Our result relies on the observation that the sequence of heap operations generated by any run of Dijkstra's algorithm on a fixed graph possesses enough locality that one can couple the number of comparisons performed by any heap with our working-set bound to the minimum number of comparisons required to solve the distance order problem on this graph for a worst-case choice of arc lengths.

Universal Optimality of Dijkstra via Beyond-Worst-Case Heaps

TL;DR

This paper establishes that Dijkstra's shortest-path algorithm, when paired with a carefully designed heap that satisfies a working-set bound, is universally optimal in running time for the distance-order problem on graphs with nonnegative weights. It introduces a new heap architecture—the outer heap composed of inner fast heaps with a small, efficiently maintained bit-vector for suffix minima—achieving a DeleteMin cost of and enabling time overall, where is the number of distance orders. The authors also present two extensions that are universally optimal in both time and comparisons: Dijkstra with lookahead and recursive Dijkstra, each leveraging bottlenecks and structured processing to reduce comparisons to (directed) or . Complementing the algorithmic results, the paper proves tight lower bounds for both time () and comparisons, establishing universal optimality in a strong theoretical sense. Collectively, these results offer a foundational bridge between universal optimality and sequential graph algorithms, with practical implications for designing near-optimal data structures tailored to graph problems.

Abstract

In this paper we prove that Dijkstra's shortest-path algorithm, if implemented with a sufficiently efficient heap, is universally optimal in its running time, and with suitable small additions is also universally optimal in its number of comparisons. Universal optimality is a powerful beyond-worst-case performance guarantee for graph algorithms that informally states that a single algorithm on a problem involving graphs with arc and/or vertex weights performs as well as possible on every graph, assuming a worst-case choice of weights. We give the first application of this notion to any sequential algorithm. We design a new heap data structure with a working-set bound, which guarantees that the heap takes advantage of a certain kind of locality in the heap operations. Our heap has the optimal (amortized) bounds of Fibonacci heaps but also has the beyond-worst-case guarantee that the cost of deleting the minimum item is logarithmic in the number of items inserted after it but before it is deleted, instead of logarithmic in the size of the heap when the item is deleted. That is, deletion of recently inserted items is especially efficient. We prove that our working-set bound guarantees universal optimality for the problem of ordering vertices by their distance from the source vertex, which we call the distance order problem. Our result relies on the observation that the sequence of heap operations generated by any run of Dijkstra's algorithm on a fixed graph possesses enough locality that one can couple the number of comparisons performed by any heap with our working-set bound to the minimum number of comparisons required to solve the distance order problem on this graph for a worst-case choice of arc lengths.
Paper Structure (34 sections, 30 theorems, 1 equation, 1 figure)

This paper contains 34 sections, 30 theorems, 1 equation, 1 figure.

Key Result

Lemma 3.1

A total order of the vertices of $G$ is a distance order if and only if for every vertex $w\neq s$, there is an arc $vw$ such that $v$ precedes $w$ in $L$.

Figures (1)

  • Figure 1: An example graph. Dijkstra's algorithm implemented with a Fibonacci heap needs $\Omega(r \log t)$ time to finish. For $t \ll r$, this is not optimal, as there exists an $\mathrm{O}(r + t \log t)$-time algorithm.

Theorems & Definitions (62)

  • Lemma 3.1
  • proof
  • Remark 3.2
  • Remark 3.3
  • Lemma 4.1
  • proof
  • Lemma 4.2
  • proof
  • Remark 4.3
  • Lemma 6.1
  • ...and 52 more