Table of Contents
Fetching ...

Simple Universally Optimal Dijkstra

Ivor van der Hoog, Eva Rotenberg, Daniel Rutschmann

TL;DR

This paper studies universal optimality for the single-source shortest-path problem and revisits Dijkstra's algorithm under a topology-sensitive performance model. It introduces timestamp-optimal heaps, a simpler alternative to the working-set framework, and proves that Dijkstra with such a heap achieves the universal lower bound $\\Omega\\left(m+\\sum_{x_i\\in V\\setminus\\{s\\}} (1+\\log(b_i-a_i))\\right)$ by connecting to the linearization count $\\ell(G,s)$. Using recent universal-sorting techniques, the authors show that this Dijkstra variant matches the universal bound, yielding universal optimality for any fixed graph topology, and they demonstrate equivalence to edge-weight-comparison-based analyses in an appendix. The results provide a streamlined, implementable path to universal optimality and suggest broader applicability to related problems.

Abstract

Let G be a weighted (directed) graph with n vertices and m edges. Given a source vertex s, Dijkstra's algorithm computes the shortest path lengths from s to all other vertices in O(m + n log n) time. This bound is known to be worst-case optimal via a reduction to sorting. Theoretical computer science has developed numerous fine-grained frameworks for analyzing algorithmic performance beyond standard worst-case analysis, such as instance optimality and output sensitivity. Haeupler et al. [FOCS '24] consider the notion of universal optimality, a refined complexity measure that accounts for both the graph topology and the edge weights. For a fixed graph topology, the universal running time of a weighted graph algorithm is defined as its worst-case running time over all possible edge weightings of G. An algorithm is universally optimal if no other algorithm achieves a better asymptotic universal running time on any particular graph topology. They show that Dijkstra's algorithm can be made universally optimal by replacing the heap with a custom data structure. We revisit their result. We introduce a simple heap property called timestamp optimality, where the cost of popping an element x is logarithmic in the number of elements inserted between pushing and popping x. We show that timestamp optimal heaps are not only easier to define but also easier to implement. Using these timestamps, we provide a significantly simpler proof that Dijkstra's algorithm, with the right kind of heap, is universally optimal.

Simple Universally Optimal Dijkstra

TL;DR

This paper studies universal optimality for the single-source shortest-path problem and revisits Dijkstra's algorithm under a topology-sensitive performance model. It introduces timestamp-optimal heaps, a simpler alternative to the working-set framework, and proves that Dijkstra with such a heap achieves the universal lower bound by connecting to the linearization count . Using recent universal-sorting techniques, the authors show that this Dijkstra variant matches the universal bound, yielding universal optimality for any fixed graph topology, and they demonstrate equivalence to edge-weight-comparison-based analyses in an appendix. The results provide a streamlined, implementable path to universal optimality and suggest broader applicability to related problems.

Abstract

Let G be a weighted (directed) graph with n vertices and m edges. Given a source vertex s, Dijkstra's algorithm computes the shortest path lengths from s to all other vertices in O(m + n log n) time. This bound is known to be worst-case optimal via a reduction to sorting. Theoretical computer science has developed numerous fine-grained frameworks for analyzing algorithmic performance beyond standard worst-case analysis, such as instance optimality and output sensitivity. Haeupler et al. [FOCS '24] consider the notion of universal optimality, a refined complexity measure that accounts for both the graph topology and the edge weights. For a fixed graph topology, the universal running time of a weighted graph algorithm is defined as its worst-case running time over all possible edge weightings of G. An algorithm is universally optimal if no other algorithm achieves a better asymptotic universal running time on any particular graph topology. They show that Dijkstra's algorithm can be made universally optimal by replacing the heap with a custom data structure. We revisit their result. We introduce a simple heap property called timestamp optimality, where the cost of popping an element x is logarithmic in the number of elements inserted between pushing and popping x. We show that timestamp optimal heaps are not only easier to define but also easier to implement. Using these timestamps, we provide a significantly simpler proof that Dijkstra's algorithm, with the right kind of heap, is universally optimal.

Paper Structure

This paper contains 14 sections, 11 theorems, 3 equations, 1 figure, 2 algorithms.

Key Result

Lemma 4

For any element $x_i \in H$ we can, given $a_i$ and $t$, compute the bucket containing $x_i$ and the Fibonacci heap that contains $x_i$ in constant time.

Figures (1)

  • Figure 1: We illustrate our invariant. Each bucket $B[j]$ contains one or two Fibonacci heaps. Each heap $F$ is associated with an interval on the number line in $[0, t)$. The elements $x_i$ stored in a Fibonacci heap $F$ are visualised by placing them at positions $a_i$ along the number line. Importantly, when the buckets in $B$ are indexed from left to right (i.e., from low to high indices), the corresponding intervals of the Fibonacci heaps appear in the reverse order along the number line.

Theorems & Definitions (16)

  • Definition 1: iacono2000improved
  • Definition 2
  • Definition 3
  • Lemma 4
  • Theorem 5
  • Corollary 6
  • Lemma 7
  • Lemma 8: Originally in cardinal2010sorting, paraphrased by Lemma 4.3 in haeupler2025fast
  • Theorem 9: Theorem 1.2 in Haeupler24
  • Definition 10
  • ...and 6 more