arXiv:2611.00146cs.DSOct 2026

Manuscript Offprint

arXiv:2611.00146

FastHeapDict: Permanent Slot Indexing for Efficient Decrease-Key Operations in Indexed Priority Queues

Hojjat T. Goudarzi, Arash Torabi Goodarzi, Mohammad Amir Eshraghi

Hojjat T. Goudarzi

Oregon State University

Corvallis, Oregon, USA

torabigh@oregonstate.edu

Arash Torabi Goodarzi

University of Würzburg

Würzburg, Germany

arash.goodarzi@uni-wuerzburg.de

Mohammad Amir Eshraghi

Purdue University

West Lafayette, Indiana, USA

meshragh@purdue.edu

Abstract—Efficient decrease-key support remains an important practical concern in priority queues used by shortest-path and graph-processing algorithms. Although duplicate-entry heaps avoid explicit decrease-key operations and are simple to implement, they may accumulate many stale entries when tentative priorities are repeatedly improved. This paper presents FastHeapDict, an indexed binary min-heap based on permanent slot indexing. Instead of repeatedly locating keys through hash-table lookups during heap repair, FastHeapDict assigns each key a stable integer slot and stores that slot directly in heap entries. As a result, position updates during sift-up and sift-down operations are performed through integer indexing while preserving the usual indexed-heap interface.

We evaluate FastHeapDict in both Python and C++20 using Dijkstra's algorithm as the primary experimental workload. The benchmarks include constructed dense stress graphs, randomized dense graph variants, and comparisons against duplicate-entry heaps and existing priority-queue alternatives. Across the tested Python workloads, FastHeapDict consistently outperforms the duplicate-entry heapq baseline and the tested heapdict and pqdict implementations. In the C++20 implementation, FastHeapDict also achieves strong constant-factor improvements over std::priority_queue duplicates, std::set-based decrease-key, and std::multiset duplicates. These results indicate that permanent slot indexing can provide a compact and effective implementation strategy for indexed priority queues in workloads where priority updates are frequent.

I. INTRODUCTION

Priority queues are fundamental components of many graph algorithms and optimization problems. Among their most important operations is decrease-key, which allows the priority associated with an existing element to be updated efficiently without inserting duplicate entries. Algorithms such as Dijkstra's single-source shortest-path algorithm rely heavily on this operation when tentative distances are repeatedly improved during execution [1].

Despite the theoretical importance of decrease-key, many practical implementations of Dijkstra's algorithm avoid supporting it explicitly. Instead, they rely on a duplicate-entry strategy in which every distance improvement inserts a new heap entry while obsolete entries are discarded only when they are eventually removed from the priority queue. This approach is simple, robust, and readily supported by widely used libraries such as Python's heapq [2] and C++'s std::priority_queue [3]. However, when many priority updates occur before vertices are finalized, duplicate entries accumulate, increasing the number of heap operations, memory usage, and unnecessary processing of stale elements.

Indexed priority queues address this limitation [4] by maintaining exactly one live entry for each key and updating its priority in place. Traditional indexed heaps, however, typically maintain a mapping from keys to heap positions, requiring repeated hash-table or dictionary lookups whenever heap elements move during sift-up or sift-down operations. Although these lookups have expected constant-time complexity, they contribute additional constant-factor overhead in implementations where decrease-key operations occur frequently.

This paper introduces FastHeapDict, an indexed binary min-heap based on the idea of permanent slot indexing.

Unlike conventional indexed heaps that repeatedly recover heap positions through key-based hash-table accesses, FastHeapDict performs all subsequent heap maintenance through direct integer indexing once a permanent slot has been assigned. Each key is assigned a stable integer slot when it first appears, and heap entries store this slot together with the key and its priority. A separate position array maps slots to current heap locations, allowing heap repair operations to update positions through integer indexing rather than repeated key-based hash lookups. The resulting implementation preserves the simplicity and asymptotic complexity of a conventional indexed binary heap while reducing practical overhead during decrease-key operations.

The contribution of this work is implementation-oriented rather than asymptotic. FastHeapDict does not change the theoretical complexity of indexed binary heaps; instead, it proposes a compact implementation strategy that reduces repeated hash-table access during heap maintenance. To evaluate its practical effectiveness, we implement FastHeapDict independently in both Python and C++20 and use Dijkstra's algorithm as the primary evaluation workload. The proposed design is compared against duplicate-entry heaps as well as existing indexed and tree-based priority-queue implementations across several controlled benchmark families.

The remainder of this paper is organized as follows. Section II reviews existing priority-queue designs and practical implementations of Dijkstra's algorithm. Section III presents the design of FastHeapDict. Section IV describes the C++20 implementation. Section V outlines the experimental methodology. Sections VI and VII present the Python and C++20 experimental results, respectively. Sections VIII and IX discuss the findings and limitations of the study, and Section X concludes the paper.