Does Random Arrival Order Break the External-Memory DecreaseKey Barrier?

A priority queue keeps a set of items ordered by key so the smallest can always be removed. When the queue lives on disk, cost is counted in block transfers (I/Os) of $B$ items between disk and a fast memory of size $M$. Supporting only insert and extract-min on disk costs exactly as much as sorting. Adding "decrease this item's key", the operation behind Dijkstra's shortest-path and Prim's spanning-tree algorithms, provably costs more. The reason is that the queue is told the item's name, not where the item sits on disk. That lower bound is built from a carefully correlated, adversarial sequence of operations. A separate line of streaming research shows that shuffling the input into uniformly random order sometimes collapses adversarial lower bounds dramatically, and sometimes leaves them intact.

This note proposes to settle which case holds for disk-resident priority queues. Our conjecture is a dichotomy that depends on how the updates are distributed across items. Under random order, updates aimed at items that are updated many times can be handled at sorting cost. A prefix of a random stream reveals those items early, so the queue can keep a memory-resident index for them. Updates spread thinly over many items keep the full adversarial cost, because random order preserves the "old data, new query" structure that makes locating an item hard. If this is right, the gap between sorting and decrease-key is governed by a single measurable quantity, the update-frequency profile of the workload. The note describes how to prove both sides and how to test the prediction with I/O-counting experiments on web-scale graph workloads.

The two directions and the gap between them

On the disk side, three results fix the terrain. Equivalence between Priority Queues and Sorting in External Memory shows that a queue with insert, delete and extract-min can match the per-item cost of any external sorting algorithm, treated as a black box. It does so with a recursive hierarchy of lazily rebuilt levels. This result supplies our method for the "heavy" part of the workload. DecreaseKeys are expensive for external memory priority queues proves that decrease-key forces extra cost, roughly a $\log B/\log\log N$ factor per block-amortized operation, whenever $N > M^{4+\epsilon}$. It works by reducing from a two-phase set-intersection communication problem: items are laid out in phase one, then probed by name in phase two. The bound holds even for randomized, amortized structures. A Faster External Memory Priority Queue with DecreaseKeys matches that bound. Its structure is a shallow tree with fan-out $\log^{0.01} N$. Each node buffers pending commands and keeps a Bloom filter, a compact approximate membership test, which routes decrease-key signals to the right child without reading disk. The tree assumes integer keys and amortized analysis. The lower bound constrains us, and the matching tree is the strongest upper bound we must beat.

On the streaming side, random order helps through prefix sampling. Any length-$k$ prefix of a random stream is a uniform sample of the whole, which lets an algorithm learn thresholds or heavy items early (Random-Order Models). Separations for Estimating Large Frequency Moments on Data Streams shows concretely that a one-pass random-order algorithm built on heavy-hitter detection beats the one-pass adversarial lower bound. It does so by matching what a two-pass adversarial algorithm achieves, so random order acts like a free "preview pass." Two results bound how far this goes. Streaming Lower Bounds and Asymmetric Set-Disjointness shows that detecting a lightly planted item ("needle") in a stochastic stream is as hard as in the adversarial case. (Noisy) Gap Cycle Counting Strikes Back proves exponential random-order lower bounds for connected components and related problems. It does this with a robust communication argument that survives random partitioning of the input. Together these papers motivate the conjecture: random order helps exactly when the useful signal is concentrated (heavy hitters) and fails when it is thin (needles).

No paper in the file asks the disk-queue question under random order. The closest bridges are Better Bounds for Semi-Streaming Single-Source Shortest Paths, GraphMP and I/O Efficient Core Graph Decomposition at Web Scale. The first counts sequential passes for shortest paths, not block transfers. The second and third keep all vertex data in RAM and never model arrival order.

Core Claim

We study a "random-order keyed-update" model. An adversary fixes a multiset of $U$ update pairs $(e, v)$, meaning "item $e$ now has candidate key $v$." It also fixes the positions of extract-min calls. The update pairs then arrive in uniformly random order, and each pair acts as a decrease-key if $v$ is below $e$'s current key and as an insert if $e$ is absent. This min-aggregation semantics is what streaming label-correcting shortest paths and event-driven simulators actually issue.

Let $f_e$ be the number of updates aimed at item $e$, and let $\tau$ be a multiplicity threshold set by memory, roughly $U/M$. Write $\mathrm{Sort}$ for the per-item sorting cost $\frac{1}{B}\log_{M/B}\frac{N}{B}$ and $\mathrm{DK}$ for the per-operation decrease-key cost of the matching tree. We conjecture that the optimal expected I/O total is

$$ \Theta\Big(U_{\ge\tau}\cdot \mathrm{Sort} \;+\; U_{<\tau}\cdot \mathrm{DK}\Big), $$

where $U_{\ge\tau}$ counts updates to items with $f_e \ge \tau$ and $U_{<\tau}$ counts the rest.

The upper bound comes from a prefix sample of length about $U/\tau$, which contains every heavy item with constant probability and fits in memory. The lower bound for light updates comes from observing that random order still places a constant fraction of each light item's updates late in the stream. The two-phase structure of the Eenberg–Larsen–Yu hard instance therefore survives.

Research Program

The first task is semantic and must come before any theorem. We need to pin down exactly which operation semantics the Eenberg et al. bound covers. In particular, we must check whether min-aggregation updates with no explicit delete fall inside it, since the duplicate-insertion trick discussed below shows that semantics decide everything here. We will restate the hard distribution in the keyed-update model and confirm the bound applies to adversarial order.

The lower-bound half then takes the hard distribution and asks what a uniform shuffle does to it. The plan is to condition on the event that, for each light item, some update lands in the last constant fraction of the stream, and to embed two-phase set intersection on that event. The random partition of the input between phases is handled with the robustness style of argument developed for noisy gap cycle counting. The question is whether the set-intersection bound tolerates the extra noise that early, misplaced updates inject. If it does not, we have instead found a random-order upper bound for light updates, which would be a surprise with its own value.

The upper-bound half builds a hybrid queue. It reads a random prefix, identifies heavy items, and gives them a memory-resident location index. Updates to heavy items become duplicate insertions into a sort-based queue in the style of Wei and Yi, with stale copies filtered through the in-memory index. Light updates go to a Jiang–Larsen tree. We will also analyze robustness, because random-order algorithms are fragile when an adversary corrupts the stream head (Random-Order Models). The question is how the guarantee degrades when an $\eta$ fraction of updates is adversarially placed. The design will fall back to the tree's cost, never worse.

Baselines

The naive reference point is an indexed heap: a disk B-tree mapping each item to its block, updated on every move. Every decrease-key pays a random lookup, and this is the cost every structured queue claims to avoid.

The strongest existing method is the buffered tournament tree with Bloom filters from A Faster External Memory Priority Queue with DecreaseKeys. It is the only structure in the file that matches the adversarial lower bound, so beating it on light-update-dominated random-order workloads would contradict our own conjecture, while matching it there and beating it on heavy-skewed workloads would confirm it. No reported result found on Lacuna for measured I/O counts of this structure or any external priority queue on real graphs. The paper reports only the asymptotic bound, so we will implement it ourselves.

The second strong competitor is duplicate insertion into a sort-based queue following Equivalence between Priority Queues and Sorting in External Memory, with a disk-resident "already extracted" set for discarding stale copies.

The key ablation keeps our hybrid queue intact but replaces the prefix-sampled heavy set with a memory-resident index of the same size, filled with items chosen uniformly at random. A second variant fills it with the first items seen, regardless of frequency. The ablation therefore isolates whether random-order prefix sampling, rather than merely having an in-memory index, produces any gain.

Fairness rules apply to every method. All methods run inside one I/O-counting simulator with identical $M$ and $B$ and the same integer key universe. They process the same update multisets, under both the adversarial order and many independent shuffles. Each method's tunable constants, such as buffer sizes, fan-out and Bloom filter bits, get the same grid-search budget on a held-out workload.

Beating a baseline means a statistically clear reduction in mean I/Os per update, with confidence intervals over shuffles, that grows with $B$ as the formula predicts. We also require no regression on the adversarial order.

Why not just…?

Why not just insert duplicates instead of decreasing keys? This is the most serious threat, and the research file's claim that it is asymptotically worse is not convincing. Per update, sorting cost $\frac{1}{B}\log_{M/B}\frac{U}{B}$ and the tree's $\log B/\log\log N$ cost are comparable at realistic parameters. The real cost of duplicates is the stale-copy check at each extraction, which needs a membership lookup in a disk-resident extracted set. We include duplicate insertion as a full baseline rather than dismissing it. If it already matches the hybrid on random-order workloads of every frequency profile, then the light-update lower bound must fail. We would then restate the result as "random order makes the sorting bound achievable by the simplest method," which is still a clean answer to the open question.

Why not just keep all vertex data in RAM, as GraphMP and SemiCore do? Both systems state that their limitation is the requirement that vertex or node data fit in memory (GraphMP, I/O Efficient Core Graph Decomposition at Web Scale). Our regime is by definition the one where the number of live items exceeds $M$. We will still run a semi-external variant at a memory budget large enough to hold all items, as an upper reference that shows how much of the gap random order recovers.

Why not just argue that Bloom filters with random hashing are already immune to ordering? Against an adversary that does not see the hash functions, this is largely correct. That is why we do not pursue Bloom-filter degradation as the research question. Our claim concerns where items live on disk, not hash collisions, and the uniform-index ablation is designed to separate the two.

Why not just run the multi-pass semi-streaming shortest-path algorithm? Better Bounds for Semi-Streaming Single-Source Shortest Paths needs a number of passes polylogarithmic in $n$ and scaling with $1/\epsilon$, and it gives only approximate distances. Each pass is a full sequential scan of the edges, so its I/O count is about passes times $|E|/B$. We will report that figure alongside the others for the shortest-path workloads, with no expectation that it competes on exact queries.

Proposed Experiments

The first set of workloads is synthetic and directly tests the dichotomy. We generate update multisets with a fixed number of items and $U$ updates, and vary the frequency profile from uniform (every $f_e$ about constant) through Zipf distributions of increasing skew. We also include a planted two-phase set-intersection family that imitates the hard instance. Each workload is run in adversarial order and in 30 random shuffles, with $B$ swept over powers of two and $M$ held so that $N > M^4$ where feasible.

The second set uses label-correcting shortest-path relaxations issued from edge streams of the Twitter graph and subgraphs of Clueweb and EU-2015, the graphs used by I/O Efficient Core Graph Decomposition at Web Scale and GraphMP. The streams are fed in their stored order and in shuffled order, with $M$ scaled down so that vertex labels do not fit. Clueweb has 978.5M nodes and 42.6B edges per the SemiCore paper, which makes the heavy tail of its degree distribution a natural source of skewed update frequencies. The GraphMP figure of about 94 minutes for PageRank on EU-2015 serves only as a scale reference, not a priority-queue baseline.

Metrics are I/Os per update, worst-case I/O bursts per window of operations, and wall time on an SSD-backed run for the top configurations.

The decisive checks are three. First, on uniform-frequency and planted hard workloads, random order should give the hybrid no advantage over the Jiang–Larsen tree, with the ratio of their costs flat in $B$. Second, as skew increases, the hybrid's cost should track the predicted formula, with the heavy-update share costing about $\mathrm{Sort}$. Third, the uniform-index ablation should lose most of that gain. If the first check fails, the light-update lower bound is false and the theory effort pivots to a random-order upper bound. If the third check fails, the gain comes from memory, not from arrival order, and the claim that random order is the cause is refuted.