Abstract 1 Introduction 2 Preliminaries 3 The Main Result 4 Missing Proofs References

A Faster Directed Single-Source Shortest Path Algorithm

Ran Duan ORCID Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, China    Xiao Mao ORCID Stanford University, CA, USA    Xinkai Shu ORCID Max Planck Institute for Informatics, Saarbrücken, Germany    Longhui Yin ORCID Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, China
Abstract

This paper presents a new deterministic algorithm for the single-source shortest paths (SSSP) problem on real non-negative edge-weighted directed graphs, with running time O(mlogn+mnlognloglogn), which is O(mlognloglogn) for sparse graphs. This improves the recent breakthrough result of O(mlog2/3n) time for directed SSSP algorithm [Duan, Mao, Mao, Shu, Yin 2025].

Keywords and phrases:
Shortest Paths, Graph Algorithms
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image] © Ran Duan, Xiao Mao, Xinkai Shu, and Longhui Yin; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Shortest paths
; Theory of computation Data structures design and analysis
Related Version:
Full Version: https://arxiv.org/abs/2602.07868 [11]
Funding:
Ran Duan is supported by a grant from Turing AI institute of Nanjing. This work has been supported by the New Cornerstone Science Foundation.
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

The single-source shortest paths (SSSP) problem is one of the most foundational problems in graph theory, whose algorithms have seen significant improvements since the 1950s. Given a graph G=(V,E) with n vertices and m non-negative real-weighted edges, the goal is to compute the distance from a source vertex s to every vertex vV. We work under the comparison-addition model, where only comparison and addition on edge weights are allowed – a natural assumption that aligns with real-weighted inputs.

The textbook algorithm by Dijkstra [7], when implemented with a Fibonacci heap [14], solves the problem in O(m+nlogn) time. In addition to computing the distances, Dijkstra’s algorithm also produces the ordering of vertices. Haeupler, Hladík, Rozhoň, Tarjan and Tětek [18] demonstrated that Dijkstra’s algorithm is universally optimal if this order is required. On the other hand, if only the distances are needed, there were no substantial improvements until recently. Duan, Mao, Shu and Yin [8] proposed a randomized algorithm with O(mlognloglogn) running time for undirected graphs, which was subsequently derandomized by Yan [29]. Later, a groundbreaking result by Duan, Mao, Mao, Shu and Yin [10] introduced a deterministic O(mlog2/3n)-time algorithm for directed graphs, the first to break the O(nlogn) time bound in sparse graphs.

In this work, we further improve SSSP algorithm to O(mlogn+mnlognloglogn) running time on directed graphs, matching the previous results for undirected graphs.

Theorem 1.

Single-source shortest path on directed graphs with real non-negative edge weights can be solved in deterministic O(mlogn+mnlognloglogn) time.

An equivalent statement is, O(mlogn) time for mnloglogn, O(mnlognloglogn) for m<nloglogn, and O(nlognloglogn) for m=O(n).

1.1 Technical Overview

Let us begin with Dijkstra’s algorithm, which maintains a “frontier” S of vertices, such that if a vertex is “incomplete” – meaning its current distance label is greater than its true distance – then its shortest path visits some complete vertex in S. In other words, the frontier encloses a set of vertices sufficient for finding the shortest paths of all remaining incomplete vertices.

Dijkstra’s algorithm each time extracts from the frontier the vertex with smallest distance label, which is guaranteed to be complete. It then relaxes all out-going edges and adds these neighbors to frontier. This produces an ordering of all vertices by distances, creating an inherent Ω(nlogn) sorting barrier.

The breakthrough in [10] overcomes this barrier by introducing a divide-and-conquer procedure with (logn)/t levels, namely Bounded Multi-Source Shortest Path (BMSSP), which operates on a “frontier” S with respect to a bound B. BMSSP aims to settle all vertices in U~=U~(B,S)={v:𝚍𝚒𝚜(v)<B and its shortest path visits some vertex in S}. It recursively invokes subcalls of BMSSP on sets consisting of the smallest 1/2t fraction of vertices extracted from the frontier. A naïve implementation would still spend Θ(t) time on each frontier vertex, yielding a total running time of Θ(logn) per vertex.

To solve this problem, [10] reduces the size of frontier S by a factor 1/k relative to the target set U~, by running Bellman-Ford algorithm for k iterations. Any remaining incomplete vertex must lie in the shortest path tree of some xS with size at least k. Such vertices x are called “pivots”, and their number is bounded by |U~|/k. However, this approach still poses a bottleneck since Bellman-Ford requires Ω(k) time per vertex on average. This cost seems unavoidable, because the algorithm needs to determine, for each vertex vU~, which pivot’s shortest path tree it belongs to.

A key observation is that, such explicit mapping is unnecessary. Our new insight is that we can construct a spanning forest that connects the frontier S via local Dijkstra searches from S, and partition it into edge-disjoint subtrees of sizes Θ(k). This idea is inspired by [9] that tackles the single-source bottleneck path (SSBP) problem, and reduces the cost of finding pivots from O(k) to O(logk) per vertex. Then, for each subtree, the algorithm only tracks the vertex with the smallest distance label, referred to as a “pivot”, which serves as a handle for the vertices in its corresponding subtree. Then we are able to maintain 1/k of the vertices in S in the partial-sorting data structure, and meanwhile efficiently select a minimum subset of the whole frontier. For other vertices, we only need to check whether they fit the range of the subset without sorting them. Then the time for inserting a vertex in the data structure can be amortized to an edge on the subtree containing it, but that edge is not supposed to be in recursive subcalls. So the overall running time is roughly O(mlogn). However, in this recursive procedure for shortest path, the upper bound B used for each invocation is dynamically generated. If the range by bound B contains too many vertices with respect to S, the algorithm can only perform partial execution, and some vertices may be reinserted into S after extraction. This behavior must be handled carefully to achieve the running time mentioned above.

1.2 Related Works

Single-source shortest path has been extensively studied in various special cases. Pettie and Ramachandran [22] proposed an algorithm running in O(mα(m,n)+min{nlogn,nloglogr}) time for undirected graphs, where α is the inverse-Ackermann function and r is the max-min ratio of edge weights. In word-RAM model with bounded integer edge weights, a sequence of works [15, 16, 26, 23, 24, 27, 19] culminated in Thorup’s linear-time algorithm for undirected graphs [25] and O(m+nloglogmin{n,C})-time algorithm for directed graphs [28], where C is the maximum edge weight.

If negative edge weights are allowed, the Bellman-Ford algorithm [1] needs O(mn) time. Beyond this, there are nearly linear time algorithms for integer weights (with respect to bit complexity) [5, 2, 4], and strongly subcubic time algorithms for real weights [12, 20, 21].

2 Preliminaries

The single-source shortest path problem is defined on a directed graph G=(V,E) with a non-negative weight function w:E0 (typically denoted wuv) assigned to each edge. Let n=|V| and m=|E| denote the number of vertices and edges respectively. Given a source sV, the goal is to compute the length of the shortest path from s to every vertex vV. Without loss of generality we assume that every vertex is reachable from s, so mn1.

For clarity, we restate two relevant definitions. A directed tree is a directed acyclic graph whose underlying undirected graph is a tree. An arborescence rooted at some vertex v is a directed tree such that every other vertex can be reached from v via exactly one directed path.

2.1 Degree Reduction

For any degree bound 3δmn, we preprocess G in O(m) time to a graph with O(m) edges, O(m/δ) vertices, and maximum (in- and out-) degree bounded by δ, while preserving all shortest path lengths. A classical way to achieve this, similar to that in [13], proceeds as follows:

  • Substitute each v with a zero-weighted cycle Cv of Δvδ2 vertices, where Δv denotes the degree of v. For each v’s neighbor u (either incoming or outgoing), assign one vertex in Cv to represent the edge between them, denoted as xvu; make sure each vertex in Cv represents at most δ2 different xvu.

  • For every edge (u,v)G, add a directed edge from vertex xuv to xvu with weight wuv.

Note that when mnlogn, Dijkstra’s algorithm implemented with Fibonacci heap already reaches the optimal time O(m+nlogn)=O(m), thus it suffices to consider the regime mnlogn in our algorithm.

2.2 Comparison-Addition Model

Our algorithm works under the comparison-addition model, in which edge weights can only be compared or added, each taking O(1) time. No other arithmetic or algebraic operations on edge weights are allowed.

2.3 Edge Relaxation and Tie-Breaking

We maintain global distance labels d[v] for all vertices vV. Initially d[s]=0 and d[v]= for all vs. All updates to d[v] are through relaxation: d[v]min{d[v],d[u]+wuv} of some edge (u,v)E. A relaxation is valid, if d[v] was updated, namely d[u]+wuvd[v]. In our algorithm, we also introduce an upper bound B and require d[u]+wuv<B to prevent immature modification. Hence, d[v] is non-increasing and always corresponds to the length of some path from s to v. Let 𝚍𝚒𝚜(v) denote the length of the true shortest path from source s to v, then d[v]𝚍𝚒𝚜(v) always holds.

Similar to previous works [6, 10], for clarity in presenting the algorithm, we define a tie-breaking rule for comparing distance labels in order to:

  1. 1.

    Keep the structure of the shortest path tree throughout the algorithm;

  2. 2.

    Establish a relative ordering among the vertices with identical d[].

In principle, we treat a path of length l that traverses q edges, represented by the vertices v0=s,v1,,vq, as a tuple l,q,vq,vq1,,v0, where vertices are listed in reverse order, and sort them based on the lexicographical order. However, it turned out that the first 4 items of the above tuple are sufficient for tie-breaking: path length (𝚕𝚎𝚗𝚐𝚝𝚑), number of edges (𝚗𝙴𝚍𝚐𝚎𝚜), v itself (𝚌𝚞𝚛𝚛), and v’s predecessor (𝚙𝚛𝚎𝚍). This is because our algorithm performs such comparisons in the following scenarios:

Relaxing an edge (u,v):

If ud[v].𝚙𝚛𝚎𝚍, even if 𝚕𝚎𝚗𝚐𝚝𝚑 and 𝚗𝙴𝚍𝚐𝚎𝚜 are tied, it suffices to compare u and d[v].𝚙𝚛𝚎𝚍; if u=d[v].𝚙𝚛𝚎𝚍, then d[u] has been updated to currently “shortest” and d[v] must get updated accordingly;

Comparing two different d[u] and d[v] for uv:

In this case 𝚌𝚞𝚛𝚛 acts as a tie-breaker.

Upper bound B:

In the algorithm the upper bound B is also represented by such a 4-tuple.

Algorithm 1 illustrates how an edge (u,v) is relaxed. Note that an upper bound B is introduced to prevent premature update of vertices whose tentative distances exceed the current bound in the main algorithm.

Algorithm 1 Relaxation of an edge (u,v)E with an upper bound B.

2.4 Completeness and Frontier

For a vertex v, if d[v]=𝚍𝚒𝚜(v), we say v is complete. If all vertices in a set are complete, we say that set is complete. We need to specify the time step when referring to d[v] and completeness because they are sensitive to the algorithm progress.

Let SV be a set of vertices and B be a bound. We define U~=U~(B,S) the set of every vertex v such that 𝚍𝚒𝚜(v)<B and the shortest path of v visits some vertex in S. The goal is to make U~ complete.

Additionally, for a vertex set UV and any bound B, define dB[U]=min({B}{d[x]:xU}) and 𝚍𝚒𝚜B(U)=min({B}{𝚍𝚒𝚜(x):xU}). (B is introduced here in case U is an empty set.)

We introduce frontier, which is crucial for understanding our algorithm. This concept also appeared in [10]: at any moment and, for two sets X,YU~, we say X,Y is a frontier for U~, if any vU~ satisfies at least one of the following:

  1. 1.

    vX and v is complete;

  2. 2.

    the shortest path of v visits some complete vertex (possibly itself) in Y.

Note X is not necessarily complete; but any incomplete vertex of X must satisfy the second condition. Based on the definition, we can make the following observations:

Observation 2.

At any given moment, if X,Y is a frontier for U~=U~(B,S):

  1. 1.

    X,Y continues to be a frontier for U~ ever since;

  2. 2.

    dB[Y]=𝚍𝚒𝚜B(Y);

  3. 3.

    U~(B,Y)U~(B,S);

  4. 4.

    ,Y is a frontier for U~(B,Y);

  5. 5.

    U~(dB[Y],S)X and U~(dB[Y],S) is complete;

Proof sketch: the first observation lies from the fact that when a vertex becomes complete, it continues to be complete ever since. The second observation is because the vertex with minimum distance label d[] in Y must be complete. The third observation is because: for any vertex in U~(B,Y), its shortest path visits some vertex y in Y; and the shortest path of y, as a prefix of the shortest path of v, owing to YU~=U~(B,S), visits some vertex in S, so the shortest path of v visits S; The fourth observation is because: for any incomplete vertex in U~(B,Y), it is also in U~(B,S), then its shortest path visits some complete vertex in Y; for any complete vertex v in U~(B,Y), by definition its shortest path visits some vertex yY, and y must be complete as v is complete. The fifth is because if the distance of a vertex is less than dB[Y], then it cannot visit any complete vertex in Y.

2.5 A Framework of Dijkstra-like Algorithms

We found that Dijkstra’s algorithm, [10] and our algorithm can be restated under a unified framework:

  1. (1)

    Given a frontier X,Y for U~=U~(B,S). Our goal is to make U~ complete;

  2. (2)

    Identify a complete set ZU~; or make Z complete, possibly after performing some relaxations;

  3. (3)

    Relax the outgoing edges from Z and denote R as the set of out-going neighbors of Z but not in Z with distances less than B, and relaxations from Z to them are valid. Clearly RU~;

  4. (4)

    Update to a new frontier for U~ as X,Y=defXZ,(YZ)R;

  5. (5)

    Return to the first step and repeat the process until Y=, then U~=X is complete.

We show that for Z given by (2), after operations in (3), X,Y is indeed a frontier for U~. Since adding vertices never violates frontier conditions, it suffices to verify for vU~ whose shortest path visits some complete uZ such that u is in Y but removed from Y, v still satisfy one of the two frontier conditions.

  • If vZ, we are already done;

  • If vZ, since uZ, along the shortest path from u to v, there must exist two adjacent vertices x and y such that xZ and yZ; then y is in R and added to Y, ensuring that the shortest path of v still visits a complete vertex yY.

The efficiency of the algorithm depends critically on how we can efficiently identify Z or make Z complete. In Dijkstra’s algorithm, the smallest vertex argminxYd[x] is guaranteed to be complete. Therefore, the algorithm organizes Y using a priority queue and simply selects such x to form Z. In [10] and our approach, the algorithm repeatedly selects a subset of smallest vertices Si from the frontier, and recursively invoke a lower-level algorithm on Si to obtain a complete set Ui, which is then used to update the frontier.

3 The Main Result

Recall that we work on a preprocessed graph of O(m) edges, O(m/δ) vertices with max degree δ. Following the approach in [10], our algorithm is based on a divide-and-conquer framework in which, at each step, we attempt to extract the smallest 1/2t fraction of vertices from the frontier (tlogn).

We fix parameter t and define k=t/logt, also ensuring δlogk=O(loglogn) holds.111The algorithm also works when δ>logk. Setting δ=Θ(min{mn,loglogn}) optimizes the time bound, so we require δlogk to simplify the analysis of time complexity. A more precise choice of t will be given later; roughly tlogn. We are now ready to present our main lemma.

Lemma 3 (Bounded Multi-Source Shortest Path).

Given an upper bound B, a vertex set S of size at most t22lt, and an integer l[0,(logn)/t]. Suppose ,S is a frontier for U~=U~(B,S).

BMSSP(B,S,l) (Algorithm 3) outputs a new bound B(B), a vertex set UU~ of size O(t32lt), a set of vertices 𝒟 arranged by data structure as in Lemma 6 parameterized by M:=t2(l1)t, in O(|U|(llogt+δt)) time. After running Algorithm 3, U=U~(B,S) is complete and U,𝒟 is a frontier for U~. Moreover, one of the following is true:

  • Full execution (B=B): 𝒟= and U=U~;

  • Partial execution (B<B): |U|=Θ(t32lt).

In the top layer, we call Algorithm 3 with parameters S={s}, B= and l=(logn)/t. Since |U||V|=o(t3n), it is a full execution with all vertices complete in the end. Furthermore, the degree of each vertex in V is at most O(δ). Thus the total running time is O(m(t+lognlogtδt)).

With t=lognloglogn/δ and δ=14min{mn,loglogn}, it is O(mlognloglogn/δ). If mnloglogn, it is O(mlogn). If mn<loglogn, it is O(mnlognloglogn).

3.1 Finding Pivots

Recall that we hope to manage the frontier ,S more efficiently. As mentioned in Section 1.1, Algorithm 2 tries to connect S with edge-disjoint Θ(k) sized sub-trees. We perform a local Dijkstra search from every vertex xS, only adding edges with valid relaxation into the sub-tree. There are three possible cases:

  • If at least k vertices are found, we stop and record the result as a directed tree F¯j;

  • If the search encounters a vertex that already belongs to an existing F¯j (i.e., it overlaps with an existing sub-tree), we stop and merge the current explored sub-tree with that F¯j;

  • Otherwise the search fails to reach k vertices from x, we record it as an arborescence Wj.

Finally we partition each F¯j into Θ(k) sized edge-disjoint sub-trees in linear time as described in Section 4.1.

An important observation is that, under a full execution, if the search fails to reach k vertices from x, we no longer need to initiate any further search from x at current value d[x] with bound B.

  • If x is currently complete, every vertex v with 𝚍𝚒𝚜(v)<B whose shortest path visits x is already reached and updated;

  • Otherwise, the shortest path of x passes through some other complete vertex in S. We can rely on that vertex instead of x for subsequent shortest path relaxations.

Therefore, x is no longer useful for relaxation; unless d[x] is updated by another relaxation and then x reappears in S in a subsequent call. Intuitively, each search from x failing to reach k vertices is attributed to one of x’s incoming edges, so it occurs at most δ times. This statement is formally proved in Lemma 11.

Algorithm 2 Finding Pivots.
Lemma 4 (Finding Pivots).

Suppose ,S is a frontier for U~=U~(B,S), FindPivots(B,S) (Algorithm 2) returns subsets {Pj}j=1p of S each of size O(k), another subset QS and a set WU~ of size O(k|Q|), in O((p+|Q|)k(δ+logk))=O((p+|Q|)klogk) time. After running Algorithm 2, W,j=1pPj is a frontier for U~.

Proof.

We first prove that W,j=1pPj is a frontier for U~. For any vU~, its shortest path visits some complete uS. If u is contained in some Pj, we are already done; otherwise the sub-tree searched from u contains less than k vertices. Since v lies in such a sub-tree, v is included into W and becomes complete.

As for the running time, the local Dijkstra search takes O(1) time per processed edge, and O(logk) time per processed vertex as promised by Fibonacci heap [14]; by Lemma 12, the partition step takes O(1) time per edge. Every processed edge is incident to a vertex in some F¯j or some Wj, so there are most O((p+|Q|)kδ) of them. Every processed vertex evokes heap insertion only once as a vertex of some Fj¯, or possibly many times as a vertex in several Wj’s, which results in O((p+|Q|)klogk) time. Recall that δlogk, so the total time is O((p+|Q|)klogk).

 Remark 5.

We also note that:

  • Each Pj is connected by a directed tree Fj, where Fj’s are edge-disjoint, and vertices of Fj are in U~.

  • {Pj}j=1p and Q are disjoint, and their union is S. Moreover, pmin{|S|,|U~|/k}.

  • W is a union of |Q| arborescences {Wj}j=1|Q|; Q are their roots.

  • However, j=1pFj and the arborescences in W are not necessarily disjoint.

3.2 Data Structure

[10] designed a data structure to support the operations required for partially sorting the “frontiers”. In this section we present a simpler data structure with a slight improvement. We implement by a self-balanced binary search tree (BST) of M-sized blocks: blocks sorted by the BST, but items inside a block unsorted. Requiring log(N/M)M, an O(log(N/M)) time BST operation is amortized to O(1) per item in blocks, which enables us to perform operations except insertions in amortized linear time.

Lemma 6 (Data Structure).

Given at most N key/value pairs involved, a parameter M, and an upper bound B, there exists a data structure 𝒟 that supports the following operations:

Insert

Insert a key/value pair. If the key already exists, keep the one with smaller value.

Merge

For another data structure 𝒟 with smaller parameter M(<M/3) as specified in this lemma, such that all the values in 𝒟 are smaller than all the values in 𝒟, insert all pairs of 𝒟 into 𝒟 (keep the smaller value for duplicate keys).

Pull

Return a subset S of keys where |S|M associated with the smallest |S| values and an upper bound x that separates S from the remaining values in 𝒟. Specifically, if there are no remaining values, x=B; otherwise, |S|=M.

If M=1, Insert and Pull take O(logN) time with Merge unsupported, for base case only (Section 3.7).

If M>1, we require Mlog(N/M). Insert takes O(log(N/M)) amortized time; other operations are linear: Merge takes O(|𝒟|) time and Pull takes O(|S|) time.

The proof of Lemma 6 is given in Section 4.2.

3.3 Bounded Multi-Source Shortest Paths

In this section we are ready to present our main BMSSP algorithm, see Algorithm 3.

Algorithm 3 BMSSP.

The base case (l=0) can be solved using Dijkstra’s algorithm as in Section 3.7. Now we assume l>0.

We first initialize data structure 𝒟 with parameter M=t2(l1)t to hold the vertices we will scan.

Then we run FindPivots of Lemma 4 to reorganize S into disjoint subsets {Pj}j=1p and Q of S, with a set W. For each Pj we find pj=argminxPjd[x] the minimum vertex in it. We will update pj accordingly such that pj always lower bounds necessary 222By “necessary” we mean a vertex in Pj whose shortest path does not visit any complete vertex in 𝒟; because if it does visit, such a vertex need not to be tracked. For better readability, we recommend that readers first form a high-level picture of the algorithm and then return to this definition. A formal proof that the algorithm preserves this property appears in Lemma 9. vertices in Pj.

Set BB0=defmin{B,{d[pj]:1jp}}; U. B actually marks the progress of our algorithm. U will accumulate batches of complete vertices. Set J; J holds the set of j such that pj needs to be re-selected. The rest of algorithm repeats the following steps for multiple rounds until 𝒟 becomes empty or |U|>t32lt, where during the ith iteration (i1), we:

  • Pull from 𝒟 a subset Si of keys with smallest values in 𝒟 upper bounded by Bi (also a lower bound for remaining vertices in 𝒟). Scan xSi; if x=pj for some j, add {vPj:d[v]<Bi} into Si (by brute-force search);

  • Recursively call BMSSP(Bi,Si,l1) and collect its output Bi,Ui,𝒟i;

  • Merge vertices of 𝒟i into 𝒟;

  • For each uUi, if uPj for some j, remove u from Pj; and if u=pj, also add j into J.

  • For each uUi, relax every edge (u,v) such that d[u]+wuv[Bi,B); if the relaxation is valid, insert v,d[v] into 𝒟; if vPj for some jJ, also update pj to the smaller one between v and pj;

  • For each non-empty Pj from jJ, re-select pj to the minimum vertex in Pj by brute-force search and insert it into 𝒟;

  • Update U to include Ui and BBi; Reset J;

  • If 𝒟 becomes empty, then this is a full execution and we quit the loop;

  • If |U|>t32lt, this is a partial execution where we encountered a large workload. Also quit the loop.

After quitting the loop, we operate the following finalizing operations:

  • For every xS such that d[x][B,B), insert x,d[x] into 𝒟.

  • For every edge (u,v) from every uW=def{xWU:d[x]<B} such that d[u]+wuv[B,B), relax it; if the relaxation is valid, insert v,d[v] into 𝒟.

  • UUW, i.e., add every vertex uW into U.

3.4 Observations and Discussions on the Algorithm

We first present some informal explanations to give reader an intuitive overview on the algorithm, and in subsequent subsections we will provide more formal proofs on correctness and running time.

3.4.1 Recursion

We first think of the recursion tree 𝒯 of Algorithm 3 where each node X denotes a call of BMSSP algorithm. We subscript X to all the parameters to denote those used in the call of X: lX,BX,SX for input, BX,UX,𝒟X for output, {PX,j}j=1pX,QX,WX for output of FindPivots (Line 4). Also denote WX={xWXUX:d(x)<BX}, PX=j=1pXPX,j, and U~X=U~(BX,SX) as above. Unless stated otherwise, all line references below are to Algorithm 3. Then we have the following properties:

  1. 1.

    In the root R of 𝒯, UR=V;

  2. 2.

    Think of the construction of SX in the caller Z of X: when pulled (Line 10), |SX|MZ=t2(lZ1)t=t2lXt. Adding {vPZ,j:d[v]<BX,pZ,jSX} into SX (Line 13) expands |SX| by at most O(k) times. Therefore |SX|t22lXt, so the depth of tree 𝒯 is at most (logn)/t;

  3. 3.

    We break when |UX|>t32lXtt|SX|. Intuitively, |UX| grow slowly enough so we still have |UX|=O(t32lXt) (see Lemma 10).

  4. 4.

    If X is a full execution, then U~X=UX. If X is a partial execution, then |UX|>t|SX|. In both cases, by Remark 5, pXmin{|U~X|/k,|SX|}|UX|/k.

  5. 5.

    Suppose Y1,Y2,,Yf are the sub-calls invoked by X, i.e., the children of X in 𝒯. Then we have:

    • UY1,UY2,,UYf are disjoint. For i<j, 𝚍𝚒𝚜() of vertices in UYi are smaller than that of UYj.

    • UX is a disjoint union of WX and UY1,UY2,UYf.

    • The UX’s for all nodes at the same layer in 𝒯 are disjoint, and total size of all these |UX| in each layer is O(|V|).

  6. 6.

    For any vertex u, there is only at most one call in each layer whose U contains it. Thus, the calls X whose UX contains u forms a path in 𝒯: R=X0,X1,,Xq such that:

    • For 0i<q, Xi+1 is a sub-call of Xi;

    • For 0i<q, uUXi; if an edge (u,v) inserts v into 𝒟 in Line 24, then d[u]+wuv lies in interval [BXi+1,BXi);

    • For the last call Xq containing u, either uWXq and if an edge (u,v) inserts v into 𝒟 in Line 37, then d[u]+wuv lies in interval [BXq,BXq); or uUXq where Xq is a base case call and if an edge (u,v) inserts v into 𝒟 in Line 8 in Algorithm 4, then d[u]+wuv lies in interval [0,BXq);

    • So all these intervals for X0,,Xq are disjoint, and any edge can insert its endpoint into 𝒟 at most once, in Line 24 or Line 37 in Algorithm 3, or Line 8 in Algorithm 4.

3.4.2 Correctness

Base case is solved using Dijkstra’s algorithm and is correct. Below we assume l>0.

The framework of Section 2.5 helps understand how our algorithm works and verify correctness. In a call of BMSSP, U~=U~(B,S) is the set that contains all vertex v with 𝚍𝚒𝚜(v)<B whose shortest path visits some vertex in S, and is our expected target. Then BMSSP should return U=U~ in a successful execution, or U={uU~:𝚍𝚒𝚜(u)<B} in a partial execution, with all vertices in U complete.

At the beginning, we reorganize S as O(k)sized chunks {PX,j}j=1pX to insert into 𝒟, with some vertices complete and added into W. Lemma 4 ensures that the shortest path of remaining incomplete vertices in U~ visit some complete vertex in P, i.e., we push the frontier to W,P.

We do not insert all of P, but only the minimum vertex (“pivot”) of each Pj , i.e., pj=argminxPjd[x] into 𝒟. Then the shortest paths of remaining incomplete vertices in U~ visit some complete vertex in 𝒟P. For any bound BiB, if 𝚍𝚒𝚜(v)<Bi, the shortest path of v must also visit some complete vertex in u𝒟P with 𝚍𝚒𝚜(u)<Bi. When we pull Si a subset from 𝒟, the pivots pjSi helps augment Si to contain necessary vertices bounded by Bi from 𝒟P. Then we call sub-procedure BMSSP on Bi and Si.

By the inductive hypothesis, each recursive call on Line 14 of Algorithm 3 returns Ui and 𝒟i, vertices in Ui are complete, and 𝒟i contains vertices remaining in Si, and vertices validly relaxed from Ui with distances less than Bi. What we do actually matches Section 2.5: relax edge (u,v) from uUi, if Bi𝚍𝚒𝚜(u)+wuv<Bi, v is already in 𝒟i; otherwise, v is relaxed and inserted to 𝒟 directly. Once again remaining incomplete vertices in U~ now visits some complete vertex in 𝒟P.

If pj is in Ui and removed, we re-select a new minimum pj and insert it into 𝒟. It becomes complicated when pj is not removed while still d[v] gets decreased for some other vPj, because we cannot afford to re-select a new pj. In this case we update pj to lower bound only a subset P^jPj, the set of vertices in Pj whose shortest paths do not visit any complete vertex in 𝒟 – we do not explicitly compute P^j, merely introducing it for explanation. Because we may rely on 𝒟, we do not need to keep track of vertices not in P^j. This observation will be explained further in Lemma 9.

After we quit the loop, if this is a full execution (B=B), we return 𝒟=. If this is a partial execution, 𝒟 already includes all vertex v relaxed from all uUi which satisfies B𝚍𝚒𝚜(u)+wuv<B. Then we first add back remaining vertices in S, whose distance labels are in [B,B); they are premature vertices and need to be added back to frontier again in the upper layer. We also need to relax from W={xWU:d[x]<B} which includes vertices whose shortest paths visit complete vertices in Q.

3.4.3 Running Time

The running time is dominated by calls of FindPivots, the overheads inside the data structures 𝒟, selecting pj=argminxPjd[x] from Pj’s and picking {xPj:d[x]<Bi} for each pjSi. First we make an observation:

Observation 7.

Any edge (u,v) can only enter the execution of Line 24 once in the whole algorithm.

Proof.

This can only happen when u becomes complete in a call X which is a child of current call Y in 𝒯, so there is at most once in one layer. Other call Z where UZ contains u must be ancestor or descendant of X. Also in the current call Y we need BXd[u]+wuv<BY to make Line 24 happen, but for descendant Z of X (including X itself) in 𝒯, BZBX, so it is impossible that d[u]+wuv<BZ. So Line 24 will not happen in lower layers, thus only once in the whole recursion.

By Item 4 and Lemma 4 above, pX|UX|/k, so the total running time of FindPivots over one layer of 𝒯 is O(|V|logt+X in one layer of 𝒯|QX|t), since t=klogt>klogk. To estimate X𝒯|QX|:

  • If X is a partial execution, |QX||SX|<|UX|/t.

  • If X is a full execution, for any vQX, vUX. For the incoming edge (u,v) whose valid relaxation most recently caused insertion of v before the beginning of call X (Line 24 or Line 37):

    • Since vSX, u is not in UX.

    • If there is another full execution Y with vQY, X and Y is of ancestor-descendant relationship.

    • We do not put vertices in QX in 𝒟X directly, thus if vQY for a descendant Y of X which is also a full execution, its latest relaxation edge must be different from (u,v).

    Thus the number of appearances of v in QX in all full executions X is bounded by δ, the degree bound of v. Therefore X𝒯|QX|=O(|V|(δ+l/t)).

The total time for FindPivots is O(|V|llogt+tX𝒯|QX|)=O(mt+(mlognlogt)/(tδ)). (Recall the number of vertices is O(m/δ).)

For the data structure 𝒟 in a call of BMSSP, the total running time is dominated by Insert as all other operations take linear time. It is clear that vertices added into 𝒟X include a subset of SX, and some out-going neighbors of UX, so the size of 𝒟X is bounded by |SX|+|UX|δt42lt, so each insertion takes time O(t).

  • For pivots pj to 𝒟 in Line 7, pX|UX|/k, so the time is O(|UX|t/k)=O(|UX|logt).

  • For vertices inserted into 𝒟 in Line 33, they are non-empty only when X is a partial execution (BX<BX), such that |SX||UX|/t, so the time is O(t|SX|)O(|UX|).

  • By Observation 7, a vertex v can only be inserted to 𝒟 by edge (u,v) in Line 24 once. Also a vertex u can only be in W once as WU(Ui), so each edge (u,v) can only cause insertion of v into 𝒟 once in Line 37.

Therefore, the total time for Line 7, Line 33, Line 24 and Line 37 is O(mt+(mlogtlogn)/(tδ)).

Next we consider the time of picking (Line 13), re-selection and insertion (Line 29) of X. Similar to Item 5, suppose Y1,Y2,,Yf are sub-calls of X.

  • Picking {xPj:d[x]<Bi} (Line 13) takes time O(k) per pjSYi.

    • If Yi is a partial execution, time is bounded by O(k|SYi|)=O(|UYi|);

    • If Yi is a full execution, for any pjSYi, pjUYi and is removed from Pj, so Pj needs to re-select and insert a new pj which takes O(t) time. We amortize this O(k) to that operation as kt. (If Pj becomes empty, this happens at most one time for each Pj; these contribute to at most O(kpX)=O(|UX|).)

    So this step takes time O(|UX|) for X, and summing over all calls we get O((mlogn)/(tδ)).

  • Re-selection and insertion (Line 29) take O(t) time per pj. For a call X,

    • If X is a partial execution, time is bounded by O(|SX|t)=O(|UX|).

    • If X is a full execution, for each re-selection and insertion (Line 29) of each PX,j, we want to establish an injection from them to one tree vertex of FX,j 333Recall each vertex of PX,j is a tree vertex of FX,j. in each UYi. The number of tree vertices of FX,j in different UYi’s is no more than one plus the number of “cross-level” edges in FX,j, that is, the edges connecting two different UYi’s, which are not used by full sub-calls (full Yi only uses edges connecting two vertices within UYi), nor callers of X (X is a full execution), such that these edges are globally uniquely consumed by X.

      Instead of each pX,j in Line 29 itself, we think of its former pivot of PX,j, pX,j, which is in UYi and was removed from 𝒟 in i-th round, so j is put into J. Each pX,j uniquely corresponds to pX,j, and inside each tree FX,j, each pX,j belongs to UYi uniquely.

      Therefore, we amortize the time of re-selection and insertion (Line 29) for PX,j to edges, such that each edge is amortized at most once in the whole algorithm. (Except once for each PX,j which sums up to O(pXt)=O(|UX|logt).)

    Summing over all calls we get O((mlognlogt)/(tδ)+mt).

In total, the algorithm runs in O(m(t+lognlogtδt)) time, dominated by FindPivots.

3.5 Correctness Analysis of BMSSP

In this section we verify Algorithm 3 fits the Dijkstra-like algorithm framework proposed in Section 2.5.

Lemma 8 explains why we can invoke a recursive call on a smallest set extracted from the frontier.

Lemma 8 (Frontier Split).

Suppose at some moment, X,Y is a frontier for U~=U~(B,S). For a smaller BsB, suppose {xY:d[x]<Bs}YsU~. Then ,Ys is a frontier for U~(Bs,Ys).

Proof.

For any vU~(Bs,Ys), its shortest path visits some yYs. If y is complete, then we are done. If y is incomplete, as yYsU~, the shortest path of y, as a prefix of the shortest path of v, must visit some complete yY. Then the shortest path of v visits y and yYs as d[y]=𝚍𝚒𝚜(y)𝚍𝚒𝚜(v)<Bs.

We formally define the set R mentioned in Section 2.5. For a complete set Z and any bound B, after relaxing the outgoing edges from Z (not exceeding B), denote R(B,Z) as the set of out-neighbors v of Z but not in Z with distance less than B, and relaxations from some vertex uZ to v is valid. Equivalently, after relaxing outgoing edges from Z, R(B,Z)={v:uZ,(u,v)E,vZ,d[v]=d[u]+wuv<B}.

Denote P^j the set of vertices in Pj whose shortest paths do not visit any complete vertex in 𝒟. Also denote P=j=1pPj; P^=j=1pP^j. We define them to be up-to-date through algorithm progress. Clearly, any shortest path visits some complete vertex in 𝒟P, if and only if it visits some complete vertex in 𝒟P^.

We introduce P^j because for some vPj, after partial ith sub-call, d[v] may decrease but v is not in 𝒟i or Ui such that we cannot maintain pj to minimum among Pj. This is because in a partial execution as we will see in Lemma 9, 𝒟 contains SU and only a thin shell of out-going neighbors from U, while vertices in U~ two or more hops away from U may be modified but not returned. Fortunately, the shortest path of such vertices visit some complete vertex in 𝒟 such that we do not need to track them from Pj.

We denote Pini the initial value of P, i.e., j=1pPj returned by FindPivots.

Lemma 9 (Correctness of BMSSP, focusing on frontier and completeness).

Given an upper bound B, a vertex set S, suppose ,S is a frontier for U~=U~(B,S). After running Algorithm 3:

  1. 1.

    U,𝒟 is a frontier for U~;

  2. 2.

    maxxU𝚍𝚒𝚜(x)<BdB[𝒟], U=U~(B,S) and is complete;

  3. 3.

    𝒟 contains SU and every out-neighbor v of U but not in U validly relaxed from uU with d[u]+wuv=d[v]<B. Namely, 𝒟(SU)R(B,U).

Proof.

We prove by induction the following three propositions: at the beginning of ith iteration (immediately before Line 10, or equivalently, immediately after Line 30, at the end of (i1)th iteration):

  1. 1.

    U,𝒟P is a frontier for U~P=defU~(B,Pini);

  2. 2.

    dB[𝒟P]B(=Bi1);

  3. 3.

    For each non-empty Pj, d[pj]dB[P^j].

Clearly they hold for the first iteration by Lemma 4 and Observation 2. Now suppose they hold at the beginning of ith iteration, we prove that they hold at the end of the ith iteration.

We first show that: the prerequisite conditions of Lemma 9 are met for the ith sub-call (Line 14).

Since U,𝒟P is a frontier for U~P, U,𝒟P^ is also a frontier for U~P. 𝒟 pulls Si bounded by Bi whereas Bi lower bounds remaining vertices in 𝒟 (Line 10). Picking vertices in Pj (Line 13) adds every vP^ with d[v]<Bi into Si, because d[pj] lower bounds each P^j. Thus, Si contains every v𝒟P^ with d[v]<Bi. By Lemma 8, ,Si is a frontier for U~(Bi,Si).

Clearly base case satisfies Lemma 9. By induction, the sub-calls satisfy the conclusions of Lemma 9.

Subsequent operations in ith iteration is indeed using complete set Ui to update its frontier U,𝒟P as described in Section 2.5 (X=U, Y=𝒟P, Z=Ui):

  1. 1.

    U obtains vertices in a complete set Ui (Line 30);

  2. 2.

    𝒟P loses only vertices in Ui:

    • P loses vertices Ui (Line 18);

    • Ui is not in 𝒟, no need to remove: uUi, d[u]=𝚍𝚒𝚜(u)<BdB[𝒟].

    • SiUi was removed from 𝒟P, but merged back into 𝒟 again as 𝒟iSiUi (Line 15);

  3. 3.

    𝒟P receives R(B,Ui), the set of out-neighbors v of Ui but not in Ui validly relaxed from complete vertex uUi with d[u]+wuv=d[v]<B:

    • If d[u]+wuv<Bi, v is included by 𝒟i and merged into 𝒟 (Line 15);

    • If d[u]+wuv[Bi,B), v is directly inserted into 𝒟 (Line 24);

Therefore, at the end of the ith iteration, U,𝒟P is a new frontier for U~P.

Now we verify that: at the end of the ith iteration, dB[𝒟P]B(=Bi):

  • For 𝒟, after Pull (Line 10), dB[𝒟]Bi. For any v added into 𝒟, d[v]Bi. Finally, dB[𝒟]Bi;

  • For P^, we picked out every vP^ with d[v]<Bi (Line 13), so for the remaining vertices, dB[P^]Bi.

  • For PP^, their shortest paths visit some complete vertices in 𝒟P^, dB[PP^]dB[𝒟P^]Bi.

Now we verify that: at the end of the ith iteration, for each non-empty Pj, d[pj]dB[P^j].

  1. 1.

    If a new pj is newly re-selected from Pj (Line 29), clearly pj=dB[Pj]dB[P^j].

  2. 2.

    Otherwise, pj is not in Ui and not removed from P. For any vP^j, at the beginning, d[pj]d[v].

    • If d[v] is modified by ith sub-call, then vU~i=U~(Bi,Si). As Ui,𝒟i is a frontier of U~i:

      • If vUi, v is removed from Pj, so vP^j;

      • If the shortest path of v visits some complete vertex in 𝒟i merged into 𝒟, vP^j.

    • If d[v] is modified by valid relaxation from uUi where d[u]+wuv=d[v]Bi (Line 23), then pj is chosen to be the smaller one (Line 26): d[pj]d[v];

    • Otherwise, d[v] does not change over ith iteration, at the end, d[pj]d[v].

The induction proof of three propositions are complete. Finally, we proceed to prove Lemma 9.

Suppose in total, there are f iterations. At the end of the fth iteration, we have that: U,𝒟P is a frontier for U~P=U~(B,Pini); dB[𝒟P]B. We verify the following statements sequentially:

  • At the end of the fth iteration, W={xWU:d[x]<B} is complete.

    If vWW is incomplete, because W,Pini is a frontier for U~, v visits some complete vertex in Pini. Then vU~P, so the shortest path of v visits some complete vertex u𝒟P, such that 𝚍𝚒𝚜(v)𝚍𝚒𝚜(u)=d[u]dB[𝒟P]B, but this violates with d[v]<Bi(B) by its definition. Thus W is complete.

  • At the end of the fth iteration, for any vertex v in U~, v is complete, or the shortest path of v visits some complete vertex in 𝒟P; or the shortest path of v visits some complete vertex in qQ, such that d[q]=𝚍𝚒𝚜(q)<B and qW, or d[q]=𝚍𝚒𝚜(q)[B,B).

    In other words: U,𝒟PWQ is a frontier for U~, where Q={xQ:d[x][B,B)}.

    For any vU~, if vU~P, then v is handled by U and 𝒟P. If vU~U~P, the shortest path of v visits some qQ=SPiniW which has been complete at the beginning of this call. Currently UU~P, so qU. Thus, qW or qQ.

  • After Line 33, U,𝒟W is a frontier of U~.

    For every vertex vP, d[v]dB[P]B and is inserted back to 𝒟 (Line 33). For every vertex vQ, as d[v]B, v is also inserted back to 𝒟 (Line 33).

  • When Algorithm 3 returns, dB[𝒟]B;

    Because all values inserted into 𝒟 after the fth iteration (after Line 30) are at least B, dB[𝒟]B.

  • When Algorithm 3 returns, U,𝒟 is a frontier of U~.

    The remaining part of the algorithm (from Line 34 to Line 37) is indeed using complete set W to update its frontier U,𝒟W to U,𝒟 as described in Section 2.5 (X=U, Y=𝒟W, Z=W): maxxWd[x]<BdB[𝒟] so no need to remove W from 𝒟 ; all out-neighbors of W but not in W with distance less than B but validly relaxed by W, i.e., vertices in R(B,W), are inserted into 𝒟.

  • When Algorithm 3 returns, U is complete;

    By induction, Ui are complete; and we have shown W is complete, so U is complete.

  • When Algorithm 3 returns, maxxU𝚍𝚒𝚜(x)<B and U=U~(B,S).

    By induction, maxxU𝚍𝚒𝚜(x)max{maxxUf𝚍𝚒𝚜(x),maxxW𝚍𝚒𝚜(x)}<Bf=B.

    By Observation 2 and since U,𝒟 is a frontier for U~ such that dB[𝒟]B, we have U~(B,S)U; on the other hand, since maxxU𝚍𝚒𝚜(x)<B, UU~(B,S). Thus U=U~(B,S).

  • When Algorithm 3 returns, 𝒟 contains SU and every out-neighbor v of U but not in U validly relaxed from uU with d[u]+wuv=d[v]<B, i.e., every vertex in R(B,U).

    For any vSU~, if d[v]<BdB[𝒟], then vU~(B,S)U.

    Thus SU{xS:d[x][B,B)}𝒟.

    For every out-neighbor v of U but not in U validly relaxed from uU with d[u]+wuv=d[v]<B, by U=U~(B,S) we know that d[v]B; and we can verify v𝒟 by direct insertion or merge (Line 24, Line 15, Line 37). Thus, 𝒟(SU)R(B,U).

Lemma 10 (Correctness of BMSSP, focusing on size constraints).

Under the same conditions of Lemma 9, |U|=O(t32lt). Especially, for partial execution, |U|=Θ(t32lt). Every insertion in Algorithm 3 takes O(t) time.

For Ui’s returned by the sub-calls under one single call of BMSSP, they are disjoint. As a result, U is a disjoint union of Ui’s and W.

Proof.

|U| constraints follow from the while-condition of Algorithm 3 and induction: t32lt+t32(l1)t=Θ(t32lt). For insertion time, as |U|O(t32lt), the number of vertices added into 𝒟 is bounded by |S|+|U|δO(t42lt) (δkt). With M=t2(l1)t, each insertion takes O(log(t42lt/M))=O(t) time.

For Ui disjointness, we only need to show: {𝚍𝚒𝚜(v):vUi}[Bi1,Bi). By Lemma 9, maxuUi𝚍𝚒𝚜(u)<Bi. Also by Lemma 9, in the ith iteration, 𝚍𝚒𝚜B(Ui)𝚍𝚒𝚜B(Si)=dB[Si]dB[𝒟P]Bi1.

3.6 Time Analysis of BMSSP

Following [10], for a vertex set U and two bounds c<d, denote N[c,d)+(U)={(u,v)E:uU,𝚍𝚒𝚜(u)+wuv[c,d)}. Clearly |N[c,d)+(U)|δ|U|.

Denote E(U)={(u,v)E:u,vU}. Clearly |E(U)|δ|U|.

Recall in Section 3.4 we defined the recursion tree 𝒯 of Algorithm 3. For X a BMSSP call, we subscript X to all the parameters to denote those used in X. Denote 𝒯(X)={X:X is in the subtree rooted at X} and 𝒯(X)=𝒯(X){X}.

Lemma 11 (Time analysis of BMSSP).

Denote C to be a sufficiently large time constant. Under the same conditions with Lemma 9, a call X of BMSSP runs in time: (here U=UX)

C|U|(l+logt)logt+Ct|N[𝚍𝚒𝚜B(S),B)+(U)|+Ct|E(U)|+CtY𝒯(X)|QY|,

Moreover, Y𝒯(X)|QY||U|(δ+l/t).

Thus in the top layer when called with B=,S={s} and l=(logn)/t, it takes time O(m(t+lognlogtδt)), optimized to O(mlogn+mnlognloglogn) with best parameters.

Proof.

We first prove the time of one BMSSP call by induction. Clearly base case satisfies Lemma 11.

Now assume l>0. By induction, sub-calls satisfy Lemma 11 and take time

T0=Ci(|Ui|(l1+logt)logt+t|N[𝚍𝚒𝚜Bi(Si),Bi)+(Ui)|+t|E(Ui)|)+CtY𝒯(X)|QY|.

By Lemma 10, i|Ui||U|. By Lemma 9, in the i-th iteration, ,Si is a frontier for U~(Bi,Si) and Si is chosen from 𝒟P, so 𝚍𝚒𝚜Bi(Si)=dBi[Si]dB[𝒟P]Bi1. Thus

T0C|U|(l1+logt)logt+Cti|N[Bi1,Bi)+(Ui)|+Cti|E(Ui)|+CtY𝒯(X)|QY|.

In a full execution, U=U~. In a partial execution, |U|>t|S|. In both cases, |U|min{t|S|,|U~|}.

We pick C=C/100 to bound the time constant directly consumed by X and list them sequentially:

  1. 1.

    By Remark 5, pmin{|S|,|U~|/k}|U|/k. Thus FindPivots (Line 4) and initial insertion (Line 7) take time T1=C|U|logt+Ct|Q|.

  2. 2.

    Picking {xPj:d[x]<Bi} (Line 13) takes Ck time for each i and j such that pjSi.

    • If ith sub-call is a partial execution, T2,par,iCk|Si|C|Ui|.

    • If ith sub-call is a full execution, pjUi is removed from Pj (Line 20), causes re-selection and insertion of new pj (Line 29) of O(t) time and can be absorbed by it (Item 5); except if Pj becomes empty, but this happens at most one time for each j: T2,fullCpk=C|U|444The term T2,full only counts the cost which cannot be absorbed by Item 5, which is the time used on the iteration when Pj becomes empty..

    In total T2Ci|Ui|+C|U|=2C|U|.

  3. 3.

    Iterating Ui, updating J, Pull and Merge operations and checking edges of Ui and W (Line 20, Line 10, Line 15, Line 23, Line 36) together take linear time T3=Cδ|U|C|U|logt.

  4. 4.

    Insertion of v from edges (u,v) in N[Bi,B)+(Ui) (Line 24) takes time T4=Cti|N[Bi,B)+(Ui)|.

  5. 5.

    Re-selection and insertion of each new pj (Line 29) take time O(k+t)Ct.

    • If X is a partial execution, T5,par=Ct|S|C|U|.

    • Below we assume X is a full execution. For each Pj, in the ith iteration, if it spends Ct time (Line 29) to re-select and insert a new pj, its old pj must have been in Ui and removed (Line 20). For each j, Pj has at most one such pj removed from each Ui. Denote gj the number of such pj’s, and then the time is T5,full=Ctj=1pgj. By Lemma 10, Ui’s are disjoint. For each j, those pj’s over different iterations distribute in gj distinct Ui’s.

      By Lemma 4, each Pj is connected by an undirected tree Fj whose vertices are in U~=U. Denote =E(U)(iE(Ui)), the set of edges connecting vertices from two different Ui’s. Removing edges of from Fj splits it into at least gj weakly connected components. Thus Fj contains at least gj1 edges in . As Fj’s are edge-disjoint and tp|U|t/k=|U|logt,

      T5,full=Ctj=1pgjCtp+Ctj=1p|Fj|C|U|logt+Ct||.
  6. 6.

    Insertion of vertices in {xS:d[x][B,B)} (Line 33) takes time O(t|S|), but it is non-zero only if this call is a partial execution (B<B) such that |S||U|/t, so T6=Ct|S|C|U|.

  7. 7.

    Insertion of v from edges (u,v) in N[B,B)+(W) (Line 37) takes time T7=Ct|N[B,B)+(W)|.

To sum up, because Bi1B0dB[S]=𝚍𝚒𝚜B(S), U is a disjoint union of Ui’s and W, and ||+i|E(Ui)||E(U)|, the time of one BMSSP call is

T T0+T1+T2+T3+T4+T5,par+T5,full+T6+T7
(C|U|(l1+logt)logt+7C|U|logt)
+(Ct|N[B,B)+(W)|+i(Ct|N[Bi1,Bi)+(Ui)|+Ct|N[Bi,B)+(Ui)|))
+(Ct||+Cti|E(Ui)|)+(CtY𝒯(X)|QY|+Ct|QX|)
C|U|(l+logt)logt+Ct|N[𝚍𝚒𝚜B(S),B)+(U)|+Ct|E(U)|+CtY𝒯(X)|QY|.

Now we show that, Y𝒯(X)|QY||U|(δ+l/t).

  • For a partial execution Y, |QY||UY|/t. The UY’s for Y under 𝒯(X) on each layer are disjoint and their union is a subset of U. Summing over all layers we obtain partialY𝒯(X)|QY||U|l/t.

  • Below we assume Y is a full execution. For any vQY, think of the incoming edge (u,v) for a complete vertex u whose valid relaxation most recently caused insertion of v (Line 24 or Line 37 in Algorithm 3, or Line 8 in Algorithm 4). Then u is already complete before the execution of Y.

    If vQZ for another full execution Z, since vUY and also vUZ, Z𝒯(Y) or Y𝒯(Z). Without loss of generality, assume Z𝒯(Y). Because vQY is not passed down to descendants of Y in 𝒯(Y), and also u is not in UY, so vQZ must be owing to another edge (u,v) relaxed in some descendant of Y. Therefore, the number of appearances of v in QY of full executions Y is bounded by the number of relaxations from its complete predecessors, which is bounded by δ.

    Thus fullY𝒯(X)|QY|δ|U|.

To sum up, note that both |N+(U)| and |E(U)| are bounded by O(δ|U|), a call X of BMSSP runs in time O(|U|(llogt+δt)). Recall we work on a graph with O(m) edges, O(m/δ) vertices and max degree δ, with l=(logn)/t, so in the top layer the total time is O(m(t+lognlogtδt)).

The best555“best” in terms of order analysis, the specific constant, though not a concern of this paper, may be adjusted in implementations. parameter is t=lognloglogn/δ and δ=14min{mn,loglogn}. If mnloglogn, the total time is O(mnlognloglogn). If mn>loglogn, the total time is O(mlogn).

3.7 Base Case

The base case is solved using Dijkstra’s algorithm. It is efficient enough to spend logt time on each edge.

Algorithm 4 Base Case of BMSSP (Algorithm 3) when l=0.

4 Missing Proofs

4.1 Partition

In this section we introduce the tree partition algorithm used for pivot selection. We slightly modify the topological partition algorithm in [13], which is also used in [9]. Note that in the algorithm T is a directed tree but we treat every edge in T as undirected.

Algorithm 5 Tree partition.
Lemma 12 (Partition).

Given a tree T with n vertices and an integer s[1,n], we can partition T into edge-disjoint subtrees T1,T2,,Tp in linear time, such that |Tj|[s,3s) for all j.

Proof.

Algorithm 5 outlines the tree partition procedure. We select an arbitrary vertex as the root. The main algorithm calls Partition(T) that performs a depth-first search on T, and collects all the groups reported as T1,T2,,Tp in order. The U returned by Partition(T) is merged into Tp, or regarded as a new group if no group is reported before.

Partition(T) always returns a subset of vertices in T, including the root r. Prior to the merge, by induction we can deduce that each Tj and the final U induce a subtree, and each edge in T appears in exactly one of them. If the merge occurs, let rp be the root node when Tp is reported, then rp must be contained in both Tp and U, thus Tp after the merge can still induce a subtree in T.

It’s clear that the set U returned in line 9 has size [1,s], therefore any group reported has size [s,2s). After the final merge the size of Tp remains less than 3s.

4.2 Data Structure

Lemma 13 (Lemma 6 restated).

Given at most N key/value pairs involved, a parameter M, and an upper bound B, there exists a data structure 𝒟 that supports the following operations:

Insert

Insert a key/value pair. If the key already exists, keep the one with smaller value.

Merge

For another data structure 𝒟 with smaller parameter M(<M/3) as specified in this lemma, such that all the values in 𝒟 are smaller than all the values in 𝒟, insert all pairs of 𝒟 into 𝒟 (keep the smaller value for duplicate keys).

Pull

Return a subset S of keys where |S|M associated with the smallest |S| values and an upper bound x that separates S from the remaining values in 𝒟. Specifically, if there are no remaining values, x=B; otherwise, |S|=M.

If M=1, Insert and Pull take O(logN) time with Merge unsupported, for base case only (Section 3.7).

If M>1, we require Mlog(N/M). Insert takes O(log(N/M)) amortized time; other operations are linear: Merge takes O(|𝒟|) time and Pull takes O(|S|) time.

Proof.

We use a self-balanced binary search tree (e.g. Red-Black Tree [17]) of blocks of size Θ(M).

If M=1 in base case, a normal BST suffices, and below we assume Mlog(N/M).

We require blocks holding disjoint intervals that values stored in each block suit its interval, and blocks are ordered by their intervals. Inside each block, key/value pairs are maintained by unordered linked lists.

We store a table from key to the block linked list node that corresponds to it, to support O(1) membership inspection and deletion; keep track of the first BST block 666This is used when |𝒟| is too small described in the merge section. for O(1) access and the total number of key/value pairs present in 𝒟 used below. In the beginning, 𝒟 is initialized with a single empty block of [0,B).

Insert

Check if v already exists, and continue only if the new value is smaller. Insert the pair to the new block and delete its old occurrence (if any). This takes O(log(N/M)) time.

Merge

If 𝒟 is empty, do nothing. If 0<|𝒟|<M, restructure 𝒟 to one block and append to the first block of 𝒟, possibly inducing block normalization introduced below. Now we assume |𝒟|M.

Scan blocks of 𝒟 in ascending order, keep the smaller value for duplicates; whenever we collect at least M/3 elements or 𝒟 is exhausted, insert them into 𝒟. Causing O(|𝒟|/M) insertions of O(log(N/M))=O(M) time each, in total we spend O(|𝒟|) time.

Pull

If 𝒟 contains no more than M elements, pulling all of them takes linear time. Otherwise, continuously extract the smallest block from 𝒟 until we have at least M+1 but at most 2M elements. Find the (M+1)th element x in linear time using median-find algorithm ([3]). Output the smaller M elements and x. Join remaining elements larger than x to the current smallest block. If the size of that block exceeds M, split it into two blocks and insert them back to 𝒟. All operations above take O(log(N/M)+M)=O(M) as log(N/M)M.

Normalization

We normalize block sizes for better performance guarantees after any operation above, resulting in O(1) extra time per operated key/value pair. After Insert and Merge operation, we keep the operated block size in interval [M/3,M]; after Pull and normalization, in interval [M/2,2M/3]; or if in total there are less than M/3 elements, restructure 𝒟 to contain only one block.

Each inserted and merged pair results in at most one pair membership change in at most two blocks. When the constraint is violated, the block has interacted with Θ(M) newly inserted or merged pairs since last pull or normalization. We join it to an adjacent block if it is under-sized, or split the block into two equally sized blocks using median-find algorithm if it is over-sized. In total each normalization takes O(M) time and can be amortized to O(1) time per inserted or merged pair.

References

  • [1] Richard Bellman. On a routing problem. Quarterly of Applied Mathematics, 16:87–90, 1958. doi:10.1090/QAM/102435.
  • [2] Aaron Bernstein, Danupon Nanongkai, and Christian Wulff-Nilsen. Negative-weight single-source shortest paths in near-linear time. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 600–611, 2022. doi:10.1109/FOCS54457.2022.00063.
  • [3] Manuel Blum, Robert W. Floyd, Vaughan Pratt, Ronald L. Rivest, and Robert E. Tarjan. Time bounds for selection. Journal of Computer and System Sciences, 7(4):448–461, 1973. doi:10.1016/S0022-0000(73)80033-9.
  • [4] Karl Bringmann, Alejandro Cassis, and Nick Fischer. Negative-Weight Single-Source Shortest Paths in Near-Linear Time: Now Faster! . In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 515–538, Los Alamitos, CA, USA, November 2023. IEEE Computer Society. doi:10.1109/FOCS57990.2023.00038.
  • [5] Li Chen, Rasmus Kyng, Yang P. Liu, Richard Peng, Maximilian Probst Gutenberg, and Sushant Sachdeva. Maximum flow and minimum-cost flow in almost-linear time. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 612–623, 2022. doi:10.1109/FOCS54457.2022.00064.
  • [6] Camil Demetrescu and Giuseppe F. Italiano. A new approach to dynamic all pairs shortest paths. J. ACM, 51(6):968–992, 2004. doi:10.1145/1039488.1039492.
  • [7] E. W. Dijkstra. A note on two problems in connexion with graphs. Numerische Mathematik, 1:269–271, 1959. doi:10.1007/BF01386390.
  • [8] R. Duan, J. Mao, X. Shu, and L. Yin. A randomized algorithm for single-source shortest path on undirected real-weighted graphs. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 484–492, Los Alamitos, CA, USA, November 2023. IEEE Computer Society. doi:10.1109/FOCS57990.2023.00035.
  • [9] Ran Duan, Kaifeng Lyu, Hongxun Wu, and Yuanhang Xie. Single-source bottleneck path algorithm faster than sorting for sparse graphs. CoRR, 2018. arXiv:1808.10658.
  • [10] Ran Duan, Jiayi Mao, Xiao Mao, Xinkai Shu, and Longhui Yin. Breaking the sorting barrier for directed single-source shortest paths. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing, STOC ’25, pages 36–44, New York, NY, USA, 2025. Association for Computing Machinery. doi:10.1145/3717823.3718179.
  • [11] Ran Duan, Xiao Mao, Xinkai Shu, and Longhui Yin. A faster directed single-source shortest path algorithm, 2026. doi:10.48550/arXiv.2602.07868.
  • [12] Jeremy T. Fineman. Single-source shortest paths with negative real weights in O~(mn8/9) time. In Proceedings of the 56th Annual ACM Symposium on Theory of Computing, pages 3–14, Chicago, IL, USA, 2024. doi:10.1145/3618260.3649614.
  • [13] Greg N. Frederickson. Data structures for on-line updating of minimum spanning trees. In Proceedings of the Fifteenth Annual ACM Symposium on Theory of Computing, STOC ’83, pages 252–257, New York, NY, USA, 1983. Association for Computing Machinery. doi:10.1145/800061.808754.
  • [14] M. L. Fredman and R. E. Tarjan. Fibonacci heaps and their uses in improved network optimization algorithms. JACM, 34(3):596–615, 1987. doi:10.1145/28869.28874.
  • [15] Michael L. Fredman and Dan E. Willard. Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences, 47(3):424–436, 1993. doi:10.1016/0022-0000(93)90040-4.
  • [16] Michael L. Fredman and Dan E. Willard. Trans-dichotomous algorithms for minimum spanning trees and shortest paths. Journal of Computer and System Sciences, 48(3):533–551, 1994. doi:10.1016/S0022-0000(05)80064-9.
  • [17] Leo J. Guibas and Robert Sedgewick. A dichromatic framework for balanced trees. In 19th Annual Symposium on Foundations of Computer Science (sfcs 1978), pages 8–21, 1978. doi:10.1109/SFCS.1978.3.
  • [18] Bernhard Haeupler, Richard Hladík, Václav Rozhoň, Robert E. Tarjan, and Jakub Tětek. Universal optimality of dijkstra via beyond-worst-case heaps. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 2099–2130, 2024. doi:10.1109/FOCS61266.2024.00125.
  • [19] Torben Hagerup. Improved shortest paths on the word RAM. In Ugo Montanari, José D. P. Rolim, and Emo Welzl, editors, Automata, Languages and Programming, pages 61–72, Berlin, Heidelberg, 2000. Springer Berlin Heidelberg. doi:10.1007/3-540-45022-X_7.
  • [20] Yufan Huang, Peter Jin, and Kent Quanrud. Faster negative length shortest paths by bootstrapping hop reducers. In Kasper Green Larsen and Barna Saha, editors, Proceedings of the 37th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), SODA ’26, pages 2419–2429, USA, 2025. Society for Industrial and Applied Mathematics. doi:10.1137/1.9781611978971.86.
  • [21] Yufan Huang, Peter Jin, and Kent Quanrud. Faster single-source shortest paths with negative real weights via proper hop distance. In Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 5239–5244, Chicago, IL, USA, 2025. doi:10.1137/1.9781611978322.178.
  • [22] Seth Pettie and Vijaya Ramachandran. A shortest path algorithm for real-weighted undirected graphs. SIAM Journal on Computing, 34(6):1398–1431, 2005. doi:10.1137/S0097539702419650.
  • [23] Rajeev Raman. Priority queues: Small, monotone and trans-dichotomous. In Proceedings of the Fourth Annual European Symposium on Algorithms, ESA ’96, pages 121–137, Berlin, Heidelberg, 1996. Springer-Verlag. doi:10.1007/3-540-61680-2_51.
  • [24] Rajeev Raman. Recent results on the single-source shortest paths problem. SIGACT News, 28(2):81–87, June 1997. doi:10.1145/261342.261352.
  • [25] Mikkel Thorup. Undirected single-source shortest paths with positive integer weights in linear time. J. ACM, 46(3):362–394, May 1999. doi:10.1145/316542.316548.
  • [26] Mikkel Thorup. Floats, integers, and single source shortest paths. J. Algorithms, 35(2):189–201, May 2000. doi:10.1006/jagm.2000.1080.
  • [27] Mikkel Thorup. On RAM priority queues. SIAM Journal on Computing, 30(1):86–109, 2000. doi:10.1137/S0097539795288246.
  • [28] Mikkel Thorup. Integer priority queues with decrease key in constant time and the single source shortest paths problem. Journal of Computer and System Sciences, 69(3):330–353, 2004. Special Issue on STOC 2003. doi:10.1016/j.jcss.2004.04.003.
  • [29] Shuyi Yan. Lossless derandomization for undirected single-source shortest paths and approximate distance oracles. In 2026 SIAM Symposium on Simplicity in Algorithms (SOSA), pages 404–412, 2026. doi:10.1137/1.9781611978964.32.