This paper proves that Dijkstra's shortest-path algorithm is universally optimal in both its running time and number of comparisons when combined with a sufficiently efficient heap data structure. Universal optimality is a powerful beyond-worst-case performance guarantee for graph algorithms that informally states that a single algorithm performs as well as possible for every single graph topology. We give the first application of this notion to any sequential algorithm. We design a new heap data structure with a working-set property guaranteeing that the heap takes advantage of locality in heap operations. Our heap matches the optimal (worst-case) bounds of Fibonacci heaps but also provides the beyond-worst-case guarantee that the cost of extracting the minimum element is merely logarithmic in the number of elements inserted after it instead of logarithmic in the number of all elements in the heap. This makes the extraction of recently added elements cheaper. We prove that our working-set property is sufficient to guarantee universal optimality, specifically, for the problem of ordering vertices by their distance from the source vertex: The locality in the sequence of heap operations generated by any run of Dijkstra's algorithm on a fixed topology is strong enough that one can couple the number of comparisons performed by any heap with our working-set property to the minimum number of comparisons required to solve the distance ordering problem on this topology.
翻译:本文证明,当与足够高效的堆数据结构结合时,Dijkstra最短路径算法在其运行时间和比较次数上均具有通用最优性。通用最优性是图算法领域一种强大的超越最坏情况性能保证,其非正式表述为:对于每一种图拓扑结构,单个算法都能达到最优性能。我们首次将该概念应用于任何顺序算法。我们设计了一种新型堆数据结构,其工作集属性可确保堆充分利用堆操作中的局部性。该堆不仅匹配斐波那契堆的最优(最坏情况)界限,还提供超越最坏情况的保证:提取最小元素的成本仅与提取后插入元素数量的对数成正比,而非堆中所有元素数量的对数。这使得最近添加元素的提取成本更低。我们证明了该工作集属性足以保证通用最优性,具体而言,对于按顶点与源点距离排序的问题:在固定拓扑上执行Dijkstra算法所产生的堆操作序列中的局部性足够强,以至于能够将满足工作集属性的堆所执行的比较次数,与解决该拓扑上距离排序问题所需的最小比较次数关联起来。