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.
