Introduction
Shortest-path computation is one of the most fundamental problems in computer science. In this work, we study the problem in the Massively Parallel Computation (MPC) model [KSV10], a theoretical abstraction of widely used large-scale data processing frameworks such as Hadoop [Whi12], MapReduce [DG04], and Spark [ZCF+10]. The MPC model has received significant attention across a wide range of computational problems, including graph coloring [CFG+19; CDP20; GKU19; GGJ20], independent set [10 GGK+18, GKU19, GU19, GGJ20] , matching [1 , 10 , 18 CŁM+18, GGK+18, GKU19, GGJ20, LMS+11] , set cover [JPP+25; DDŁ+24; HLL18], graph connectivity [7 , 8 BDE+19, 22 GWZ25] , minimum spanning tree [LMS+11; Now21; ABJ+25], clustering [15 , 20 CMZ22, CLN+21, 23 CGJ+24] , subgraph finding [17 , 21 PT12, SV11] , string problems [BEG+21; GK25; HSS19; IMS17; Koo24], and geometric problems [6 CZ24, HT23, JMN+24] .
The MPC Model. The MPC model is a synchronous distributed computation model in which all machines can directly communicate with one another. The input is initially distributed between machines, where each machine has limited local memory S S S . Computation proceeds in synchronous message-passing rounds, where the total amount of information a machine can send or receive each round is bounded by S S S . The objective is to minimise the number of communication rounds, which we refer to as the round complexity . The local computation power of each machine is usually ignored in the algorithm analysis as communication is the main bottleneck in most settings; in this work, we require at most polynomial (in S S S ) running time per machine between rounds.
In this work, we study the MPC model for graph problems on weighted undirected graphs. Specifically, the input is a graph G = ( V , E ) G = (V, E) G = ( V , E ) with n n n vertices and poly ( n ) \operatorname{poly}(n) poly ( n ) -bounded positive weights ω G : V × V → Z \omega_G : V \times V \to\mathbb{Z} ω G : V × V → Z . The edge set { ( u , v , ω G ( u , v ) ) : { u , v } ∈ E } \{(u,v,\omega_G(u,v)) : \{u,v\} \in E\} {( u , v , ω G ( u , v )) : { u , v } ∈ E } is initially arbitrarily distributed across all machines; each vertex is represented by a unique vertex ID of O ( log n ) O(\log n) O ( log n ) bits.
MPC graph algorithms are typically classified based on the local memory size S S S , where memory is measured in words of O ( log n ) O(\log n) O ( log n ) bits. The following three regimes are well-studied:
Super-Linear: S ∈ Θ ( n 1 + c ) S \in\Theta(n^{1+c}) S ∈ Θ ( n 1 + c ) , where c > 0 c > 0 c > 0 is any constant.
Near-Linear: S ∈ Θ ~ ( n ) S \in\widetilde{\Theta}(n) S ∈ Θ ( n ) .
Sublinear: S ∈ Θ ( n γ ) S \in\Theta(n^\gamma) S ∈ Θ ( n γ ) , where γ ∈ ( 0 , 1 ) \gamma\in(0,1) γ ∈ ( 0 , 1 ) is any constant.
We note that the round complexity can vary significantly across different memory regimes. For instance, the state-of-the-art upper bounds on round complexity for maximal matching, maximal independent set, ( 1 − ε ) (1-\varepsilon) ( 1 − ε ) -approximation of maximum matching, and ( 2 + ε ) (2+\varepsilon) ( 2 + ε ) -approximation of minimum vertex cover in the MPC model are as follows: O ( 1 ) O(1) O ( 1 ) in the superlinear regime [LMS+11; AG18; HLL18], O ( log log n ) O(\log\log n) O ( log log n ) in the near-linear regime [18 GGK+18] , and O ( log n log log n ) O(\sqrt{\log n \log\log n}) O ( log n log log n ) in the sublinear regime [GU19].
Typically, the total memory available across all machines is O ~ ( ∣ E ∣ ) \widetilde{O}(|E|) O ( ∣ E ∣ ) , near-linear in the total input size (we use the notations O ~ ( ⋅ ) \widetilde{O}(\cdot) O ( ⋅ ) , Θ ~ ( ⋅ ) \widetilde{\Theta}(\cdot) Θ ( ⋅ ) , and Ω ~ ( ⋅ ) \widetilde{\Omega}(\cdot) Ω ( ⋅ ) to suppress factors of log ± O ( 1 ) n \log^{\pm O(1)} n log ± O ( 1 ) n ). However, following the work of Dory and Matar [DM24], we will be considering a small amount of additional total memory, i.e., O ~ ( ∣ E ∣ + n 1 + c ) \widetilde{O}(|E| + n^{1+c}) O ( ∣ E ∣ + n 1 + c ) for a small constant c ∈ ( 0 , 1 ] c \in(0,1] c ∈ ( 0 , 1 ] . Alternatively, one might view our results as applying to graphs that are slightly dense (∣ E ∣ ∈ Ω ( n 1 + c ) |E| \in\Omega(n^{1+c}) ∣ E ∣ ∈ Ω ( n 1 + c ) ).
Distance Oracles and SSSP Oracles. In this work, we are interested in the All-Pairs Shortest Paths (APSP) problem on weighted undirected graphs. A typical formulation of the problem is to output the shortest-path distances between all pairs of vertices. However, a subtle but important challenge arises in the MPC model: Explicitly storing all-pairs shortest distances requires Ω ( ( n 2 ) ) \Omega\left(\binom{n}{2}\right) Ω ( ( 2 n ) ) total memory. Unless the graph is sufficiently dense, the available total memory is insufficient to store all ( n 2 ) \binom{n}{2} ( 2 n ) distances.
To overcome this, a data structure approach is usually taken and we instead construct a distance oracle , a sparse structure that approximately preserves distances and supports efficient queries. Specifically, an a a a -approximate distance oracle returns, for any query pair ( u , v ) (u,v) ( u , v ) , an estimate of the distance between u u u and v v v that is within a factor a a a of the true shortest-path distance. The number of rounds needed to build the oracle is called the preprocessing time , and the number of rounds needed to answer a query is the query time . We will be mainly concerned with constant-round query times, and instead focus on optimising the approximation ratio and preprocessing time.
In fact, our work considers a slightly stronger data structure: an a a a -approximate single-source shortest paths (SSSP) oracle which, given a query source vertex u ∈ V u \in V u ∈ V , returns a a a -approximate distances δ ( u , v ) \delta(u,v) δ ( u , v ) for all v ∈ V v \in V v ∈ V . We emphasise that the query received by the oracle is a single source vertex u u u , while the output comprises approximate shortest-path distances from u u u to every vertex in the graph G G G , so we refer to it as an SSSP oracle. Observe that an SSSP oracle immediately yields a distance oracle.
Approaches in the Near- and Sub-Linear Regimes. Given a graph G G G , a t t t -spanner H H H is a spanning subgraph of G G G in which the distance between every pair of vertices is at most t t t times their distance in G G G [PS89]. It is known that every weighted undirected graph over n n n vertices has a ( 2 t − 1 ) (2t-1) ( 2 t − 1 ) -spanner with O ( n 1 + 1 / t ) O(n^{1+1/t}) O ( n 1 + 1/ t ) edges [3 ] , and this bound is tight assuming the Erdős girth conjecture [Erd65]. In the near-linear MPC model, Dory, Fischer, Khoury, and Leitersdorf [DFK+21] showed a near-optimal spanner construction: O ( t ) O(t) O ( t ) -spanners of size O ~ ( n 1 + 1 / t ) \widetilde{O}(n^{1+1/t}) O ( n 1 + 1/ t ) in constant rounds for any positive integer t t t . Setting t = Θ ( log n ) t=\Theta(\log n) t = Θ ( log n ) , we can build an O ~ ( n ) \widetilde{O}(n) O ( n ) -size spanner and store it on a single machine. The spanner acts as an O ( log n ) O(\log n) O ( log n ) -approximate distance oracle, where queries are answered by a local computation of shortest distances over the spanner. Similar results have been shown by Biswas et al. [13 ] and Fischer, Horowitz, and Oshman [FHO22].
While spanner constructions exist for the sublinear MPC model [13 ] , it is not clear how to transform a spanner into a constant-round query-time distance oracle when each machine only has sublinear memory. Alternatively, Dinitz and Nazari [DN20] adopted a different approach based on classical techniques for distance sketches [TZ05], and showed that constant-approximate, constant-round query-time distance oracles can be constructed in poly ( log n ) \operatorname{poly}(\log n) poly ( log n ) rounds in the sublinear MPC model.
A natural question that arises in the sublinear MPC model is whether we can achieve both O ( 1 ) O(1) O ( 1 ) distance approximations and o ( log n ) o(\log n) o ( log n ) rounds simultaneously. However, it is understood that the polylogarithmic round complexity of [DN20] is necessary under the widely-believed 1-vs-2-cycles conjecture [19 KLM+14, KSV10, NS22, RMC+13, RVW18] , which asserts that distinguishing between a single n n n -cycle and two disjoint ( n / 2 ) (n/2) ( n /2 ) -cycles requires Ω ( log n ) \Omega(\log n) Ω ( log n ) rounds in this model. Assuming this conjecture, even basic tasks such as computing s s s -t t t distances or s s s -t t t connectivity require Ω ( log n ) \Omega(\log n) Ω ( log n ) rounds in the sublinear regime.
The Heterogeneous MPC Model. Consequently, achieving faster algorithms necessitates allowing one machine to have near-linear local memory. Motivated by the 1-vs-2-cycles conjecture, Fischer, Horowitz, and Oshman [FHO22] recently introduced the heterogeneous MPC model: All machines have local memory S ∈ Θ ( n γ ) S \in\Theta(n^\gamma) S ∈ Θ ( n γ ) for some constant γ ∈ ( 0 , 1 ] \gamma\in(0,1] γ ∈ ( 0 , 1 ] , except for a single machine with local memory of size O ~ ( n ) \widetilde{O}(n) O ( n ) .
Intuitively, the heterogeneous MPC model is a hybrid between the sublinear and near-linear regimes and allows for a possibility to break the logarithmic barrier given by the 1-vs-2-cycles conjecture. For instance, while the best-known graph connectivity algorithm in the sublinear regime runs in O ( log D + log log n ) O(\log D + \log\log n) O ( log D + log log n ) rounds [BDE+19] (where D D D is the graph diameter), the same problem can be solved in O ( 1 ) O(1) O ( 1 ) rounds in the heterogeneous regime [FHO22; AGM12].
In a recent work, Dory and Matar [DM24] presented a poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) -round construction of constant-approximate distance oracles for unweighted undirected graphs in the heterogeneous MPC regime, where the total memory is O ~ ( ∣ E ∣ + n 1 + c ) \widetilde{O}(|E| + n^{1+c}) O ( ∣ E ∣ + n 1 + c ) for a small constant c > 0 c > 0 c > 0 . Their construction relies on two separate distance-preserving structures to handle different distance scales: A distance sketch for short distances and a linear-sized emulator for long distances. The distance sketches are based on the classical techniques of Thorup and Zwick [TZ05], while the emulator builds on the more recent methods of Elkin and Neiman [EN18]. A key limitation of this approach, however, is that the emulator construction only applies to unweighted graphs. Although there have been efforts to extend this to weighted graphs [EGN22], these do not achieve the same stretch guarantees and introduce an undesirable dependence on the edge weights of the graph. Consequently, the approach of Dory and Matar [DM24] remains restricted to unweighted graphs, with no immediate extension to the weighted setting.
This leads us to consider the following question:
Question 1. Does there exist a poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) -round algorithm for constructing O ( 1 ) O(1) O ( 1 ) -approximate distance oracles for weighted graphs in the heterogeneous regime?
Our Contributions
We answer the above question in the affirmative by presenting an algorithm for constructing constant-approximate SSSP oracles on weighted undirected graphs that runs in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds in the heterogeneous MPC model. Furthermore, in the near-linear MPC regime, we improve the round complexity to O ( log log n ) O(\log\log n) O ( log log n ) .
Throughout this paper, we say that an event occurs with high probability (w.h.p.) if it holds with probability at least 1 − 1 / poly ( n ) 1 - 1/\operatorname{poly}(n) 1 − 1/ poly ( n ) , where n = ∣ V ∣ n = |V| n = ∣ V ∣ is the number of vertices in the input graph G = ( V , E ) G = (V,E) G = ( V , E ) . Moreover, we reserve the symbol γ \gamma γ to refer to the exponent of the local memory Θ ( n γ ) \Theta(n^\gamma) Θ ( n γ ) of the machines in the sublinear or heterogeneous MPC model, where the model being referenced is made clear in context.
Theorem 1 (SSSP Oracles in Near-Linear MPC). Let G = ( V , E ) G = (V,E) G = ( V , E ) be a weighted undirected graph with n n n vertices, and let c ∈ ( 0 , 1 ] c \in(0,1] c ∈ ( 0 , 1 ] be a constant. In the near-linear MPC model with O ~ ( ∣ E ∣ + n 1 + c ) \widetilde{O}(|E| + n^{1+c}) O ( ∣ E ∣ + n 1 + c ) total memory, there exists a randomised algorithm that w.h.p. constructs an O ( 1 / c 2 ) O(1/c^2) O ( 1/ c 2 ) -approximate SSSP oracle in O ( log log n ) O(\log\log n) O ( log log n ) rounds. Every subsequent query can then be answered in O ( 1 ) O(1) O ( 1 ) rounds.
Theorem 2 (SSSP Oracles in Heterogeneous MPC). Let G = ( V , E ) G = (V,E) G = ( V , E ) be a weighted undirected graph with n n n vertices. In the heterogeneous MPC model with O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E| + n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory, there exists a randomised algorithm that w.h.p. constructs an O ( 1 / γ 2 ) O(1/\gamma^2) O ( 1/ γ 2 ) -approximate SSSP oracle in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds. Every subsequent query can then be answered in O ( 1 ) O(1) O ( 1 ) rounds.
Our oracle improves upon that of Dory and Matar [DM24] in two aspects. First, it applies to weighted graphs, whereas their construction is limited to unweighted graphs. Second but less significantly, it achieves a polynomial (in log log n \log\log n log log n ) speed-up in preprocessing time in the heterogeneous regime, reducing the complexity from ( log log n ) 2 + O ( 1 / γ ) (\log\log n)^{2+O(1/\gamma)} ( log log n ) 2 + O ( 1/ γ ) to O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) when the total memory is O ~ ( ∣ E ∣ + n 1 + γ ) \tilde{O}(|E|+n^{1+\gamma}) O ~ ( ∣ E ∣ + n 1 + γ ) . This completely removes the dependence on the parameter γ \gamma γ in the exponent.
We remark that while both our work and [DM24] obtain a constant approximation of distances, the oracle of [DM24] provides better stretch guarantees. When the total memory is O ~ ( ∣ E ∣ + n 1 + γ ) \tilde{O}(|E|+n^{1+\gamma}) O ~ ( ∣ E ∣ + n 1 + γ ) , while both our distance oracle and that of [DM24] achieve O ( 1 / γ 2 ) O(1/\gamma^2) O ( 1/ γ 2 ) -approximations, [DM24] was able to achieve a better O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) -approximation if we allow a poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) query time. Moreover, [DM24] showed that with more total memory, their distance oracles can achieve 3 ( 1 + ε ) 3(1+\varepsilon) 3 ( 1 + ε ) -approximations under constant-round query times (and poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) preprocessing time), or ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximations under poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) query times (and O ( 1 ) O(1) O ( 1 ) preprocessing time) for any 0 < ε < 1 / 2 0<\varepsilon<1/2 0 < ε < 1/2 .
We also remark that our algorithms can be modified to report both the approximate distance as well as a path that witnesses this distance. Specifically, we construct a constant-approximate path-reporting distance oracle : Given a query pair ( u , v ) (u,v) ( u , v ) , output a path P P P connecting u u u and v v v such that the length of P P P (i.e., the sum of the weights of all edges in P P P ) is within a constant factor of the true shortest-path distance between u u u and v v v . We refer to Section B for more details.
In view of these results, a natural question to ask is if increasing the total memory of the MPC model to, say, poly ( n ) \operatorname{poly}(n) poly ( n ) leads to faster APSP algorithms. We first note that once we have Ω ( n 2 ) \Omega(n^2) Ω ( n 2 ) total memory, we are no longer restricted to constructing a distance oracle and can instead explicitly output approximate distances for all vertex pairs. Namely in the near-linear MPC regime, Ω ( n 2 ) \Omega(n^2) Ω ( n 2 ) total memory also allows us to directly apply congested-clique algorithms (see below), for which faster constant-approximate APSP algorithms are known (e.g., [11 ] ). In the heterogeneous MPC regime, however, it is unclear to us whether additional total memory alone can lead to faster algorithms. We believe this is an interesting direction for future research.
Related Work
Bypassing the 1-vs-2-cycles conjecture. It is well known that the logarithmic barrier imposed by the 1-vs-2-cycles conjecture can be bypassed using geometric information [6 ] . Concretely, an embedded planar graph is a planar graph equipped with a straight-line drawing, where the coordinates of each vertex in the plane are provided as input. For such graphs, in the sublinear MPC model, a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate SSSP can be computed in O ( 1 ) O(1) O ( 1 ) rounds using O ( n ) O(n) O ( n ) total memory, and a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate APSP can be computed in O ( 1 ) O(1) O ( 1 ) rounds using O ( n 2 ) O(n^2) O ( n 2 ) total memory [CZ24; HT23].
Congested Clique. Of related interest is the distributed model known as the congested clique . In this model, the communication network forms a fully connected clique of n n n vertices, where each vertex can send Θ ( log n ) \Theta(\log n) Θ ( log n ) -bit messages to every other vertex in synchronous rounds. Given an n n n -vertex graph G G G as input, each vertex initially knows only the edges incident to it in G G G . By the end of an APSP algorithm, every vertex should know the (approximate) distances to all other vertices in G G G . While G G G can be an arbitrary graph on n n n vertices, the communication network itself is a clique.
The MPC and congested clique models share several similarities. For instance, any congested clique algorithm for dense graphs with O ( n 2 ) O(n^2) O ( n 2 ) edges that uses at most O ( n ) O(n) O ( n ) local memory per vertex can be simulated directly in the near-linear MPC model with nearly the same round complexity [14 ] . In fact, it is common for algorithms developed for one model to be adapted for the other [DFK+21; BDG+21; CDP20].
APSP in the congested clique has received considerable attention in recent years. Of particular relevance is the work of Dory and Parter [DP22], which presented a poly ( log log n ) \operatorname{poly}(\log\log n) poly ( log log n ) -round algorithm for ( 2 + ε ) (2+\varepsilon) ( 2 + ε ) -approximate APSP in unweighted graphs, and the more recent work of Bui et al. [11 ] , which achieved an O ( log log log n ) O(\log\log\log n) O ( log log log n ) -round algorithm for O ( 1 ) O(1) O ( 1 ) -approximate APSP in weighted graphs. Notably, both the heterogeneous MPC algorithm of Dory and Matar [DM24] and the congested clique algorithm of Dory and Parter [DP22] rely on the emulator of Elkin and Neiman [EN18] as a central component.
Skeleton Graphs. Our work adapts several ideas from Bui et al. [11 ] , the most significant of which is the skeleton graph (Definition 3.1). The general skeleton graph concept refers to the notion of building a new graph over a sampled subset of the original vertices. As far as we know, [UY90, Algorithm 2.3] is the earliest application of this technique; we however refer to the particular version used in [11 ] , which differs significantly from that of [UY90].
At a high level, our work involves a hierarchical construction of the skeleton graph to build a polylog-stretch low-hopbound emulator (Definition 2.2 ) as a key step towards constructing the SSSP oracle. We note that this manner of hierarchical construction also shares similarities with the work of Andoni, Stein, and Zhong [9 ] . We defer the comparisons to [11 ] and [9 ] to § 3.3 .
From Randomised to Deterministic. A very recent work by Cho, Dory, Maus, and de Vos [CDM+26] introduced techniques for de-randomising randomised shortest-path algorithms in the MPC and congested clique models. Their approach is based on de-randomising hitting-set computations, and applies, in particular, to the aforementioned O ( 1 ) O(1) O ( 1 ) -approximate APSP congested clique algorithm of [11 ] and the shortest-path MPC algorithms of [DM24]. Given the similar nature of the randomisation used in our work to that of previous works, we expect that the techniques of [CDM+26] can be adapted to obtain deterministic variants of Theorem 1 and Theorem 2 .
Organisation
In § 2 , we introduce the terminology and tools used throughout the paper. In § 3 , we provide a technical overview of our algorithms. In § 4 , we present our main results, the SSSP oracle algorithms. In § 6 to § 8 , we describe the three building blocks underlying these algorithms: constructing k k k -nearest hopsets, extracting k k k -nearest neighbourhoods, and constructing skeleton graphs, respectively. In Section A, we review the basic communication primitives for MPC algorithms. In Section B, we extend our construction to output the paths corresponding to the approximate distances.
Preliminaries
In this section, we present the terminology and the tools used throughout the paper.
Graph Notations
For a weighted graph G = ( V , E ) G = (V, E) G = ( V , E ) , we let d G ( u , v ) d_G(u,v) d G ( u , v ) denote the distance between vertices u u u and v v v in G G G ; if there is no path connecting u u u and v v v , then we denote d G ( u , v ) = ∞ d_G(u,v) = \infty d G ( u , v ) = ∞ . The weighted diameter of G G G is defined as the maximum distance between any pair of vertices, i.e., max u , v ∈ V d G ( u , v ) \max_{u,v\in V} d_G(u,v) max u , v ∈ V d G ( u , v ) . We write d G ( β ) ( u , v ) d_G^{(\beta)}(u,v) d G ( β ) ( u , v ) to denote the distance between u u u and v v v via a path consisting of at most β \beta β edges.
Unless otherwise specified, all graphs considered in this paper are assumed to be simple and undirected . Each vertex has a distinct ID of O ( log n ) O(\log n) O ( log n ) bits. As is standard, we assume that the input graph G G G has positive edge weights that are polynomially bounded integers.
For any edge e = { u , v } ∈ E e = \{u,v\} \in E e = { u , v } ∈ E , we denote its weight by ω G ( u , v ) = ω ( e ) \omega_G(u,v) = \omega(e) ω G ( u , v ) = ω ( e ) . As convenient shorthands, for any pair { u , v } ∉ E \{u,v\} \notin E { u , v } ∈ / E with u ≠ v u \ne v u = v , we let ω G ( u , v ) = ∞ \omega_G(u,v) = \infty ω G ( u , v ) = ∞ ; for any u ∈ V u \in V u ∈ V , we let ω G ( u , u ) = 0 \omega_G(u,u) = 0 ω G ( u , u ) = 0 . When convenient, we may use the subscript to indicate the specific edge set under consideration. For any path P P P , we use ω ( P ) \omega(P) ω ( P ) to denote its length, defined as the sum of the weights of all edges in P P P .
Approximations. We say that Δ ∈ R \Delta\in\mathbb{R} Δ ∈ R is an a a a -approximation of a value d d d if d ≤ Δ ≤ a ⋅ d d \le\Delta\le a \cdot d d ≤ Δ ≤ a ⋅ d . Similarly, we call a function δ : V × V → R ∪ { ∞ } \delta: V \times V \to\mathbb{R} \cup\{\infty\} δ : V × V → R ∪ { ∞ } an a a a -approximate distance estimate for the graph G G G if
d G ( u , v ) ≤ δ ( u , v ) ≤ a ⋅ d G ( u , v ) d_G(u,v) \le\delta(u,v) \le a \cdot d_G(u,v) d G ( u , v ) ≤ δ ( u , v ) ≤ a ⋅ d G ( u , v )
for all pairs of vertices u , v ∈ V u,v \in V u , v ∈ V .
k k k -Nearest Neighbourhoods. Consider a graph G = ( V , E ) G = (V,E) G = ( V , E ) . For any vertex v ∈ V v \in V v ∈ V and positive integer k k k , we define N G , k ( v ) ⊆ V N_{G,k}(v) \subseteq V N G , k ( v ) ⊆ V as the k k k -nearest neighbourhood of v v v , consisting of the k k k vertices in G G G that are closest to v v v , including v v v itself. We often omit G G G from the subscript when the graph is clear in context.
We also define the edge set
E k : = { { u , t } : u ∈ V ∧ t ∈ N k ( u ) } with ω E k ( u , t ) = d G ( u , t ) . E_k := \{\{u,t\}: u \in V \land t \in N_k(u)\}\quad\text{with}\quad\omega_{E_k}(u,t) = d_G(u,t). E k := {{ u , t } : u ∈ V ∧ t ∈ N k ( u )} with ω E k ( u , t ) = d G ( u , t ) .
We refer to E k E_k E k as the k k k -nearest edge set of G G G . In most instances throughout this work, computing the k k k -nearest neighbourhoods of all the vertices in G G G amounts to computing the k k k -nearest edge set of G G G – in such cases, we use the terms interchangeably.
We also consider additional useful variants of k k k -nearest neighbourhoods. We denote N k ( h ) ( v ) ⊆ V N_k^{(h)}(v) \subseteq V N k ( h ) ( v ) ⊆ V as the k k k -nearest h h h -hop neighbourhood of v v v , which consists of the k k k vertices closest to v v v according to the distances given by the function d G ( h ) d_G^{(h)} d G ( h ) . We say that N ~ k ( v ) \widetilde{N}_k(v) N k ( v ) is an a a a -approximate k k k -nearest neighbourhood of v v v if there exists an a a a -approximate distance estimate δ \delta δ for G G G such that N ~ k ( v ) \widetilde{N}_k(v) N k ( v ) consists of the k k k vertices closest to v v v according to δ \delta δ .
Unless otherwise specified, all references to k k k -nearest neighbourhoods and their variants in this work assume that ties are broken by vertex ID.
Distance-Preserving Structures
Throughout this paper, we consider three types of distance-preserving structures.
Definition 2.1 (Spanners). Given a graph G = ( V , E ) G = (V,E) G = ( V , E ) , a t t t -spanner is a subgraph H ⊆ G H \subseteq G H ⊆ G over the same vertex set V V V such that for any two vertices u , v ∈ V u,v \in V u , v ∈ V ,
d G ( u , v ) ≤ d H ( u , v ) ≤ t ⋅ d G ( u , v ) . d_G(u,v) \le d_H(u,v) \le t \cdot d_G(u,v). d G ( u , v ) ≤ d H ( u , v ) ≤ t ⋅ d G ( u , v ) .
The parameter t t t is called the stretch of the spanner.
Definition 2.2 (Hop-bounded Emulators). Given a graph G = ( V , E ) G=(V,E) G = ( V , E ) , a t t t -stretch β \beta β -hopbound emulator is an edge set H H H over the vertices V V V such that for any two vertices u , v ∈ V u,v\in V u , v ∈ V ,
d G ( u , v ) ≤ d H ( u , v ) ≤ d H ( β ) ( u , v ) ≤ t ⋅ d G ( u , v ) . d_G(u,v) \le d_H(u,v) \le d_H^{(\beta)}(u,v) \le t\cdot d_G(u,v). d G ( u , v ) ≤ d H ( u , v ) ≤ d H ( β ) ( u , v ) ≤ t ⋅ d G ( u , v ) .
Definition 2.3 (k k k -Nearest Hopsets). Given a graph G = ( V , E ) G=(V,E) G = ( V , E ) , a k k k -nearest β \beta β -hopbound hopset is an edge set H H H over the vertices V V V such that for any two vertices u , v ∈ V u,v\in V u , v ∈ V ,
d G ∪ H ( u , v ) = d G ( u , v ) , d_{G\cup H}(u,v)=d_G(u,v), d G ∪ H ( u , v ) = d G ( u , v ) , i.e., distances are not shortened. Moreover, if u ∈ N G , k ( v ) u\in N_{G,k}(v) u ∈ N G , k ( v ) or v ∈ N G , k ( u ) v\in N_{G,k}(u) v ∈ N G , k ( u ) , then
d G ∪ H ( β ) ( u , v ) = d G ( u , v ) . d_{G\cup H}^{(\beta)}(u,v)=d_G(u,v). d G ∪ H ( β ) ( u , v ) = d G ( u , v ) . Here, G ∪ H = ( V , E ∪ H ) G\cup H=(V,E\cup H) G ∪ H = ( V , E ∪ H ) , where the smallest-weight edge is taken in the case of parallel edges.
Useful Tools
We identify machines in the MPC model by their integer IDs in { 1 , 2 , … , M } \{1,2,\ldots,M\} { 1 , 2 , … , M } , where M M M is the total number of machines. We refer to a set of machines as a contiguous segment if their IDs form a consecutive sequence.
We use the following tools for various purposes throughout this work. The first tool is a constant-round O ( t ) O(t) O ( t ) -spanner construction in the heterogeneous MPC model, which also trivially extends to the near-linear MPC model.
Lemma 2.4 (Spanners in Heterogeneous MPC [DFK+21],[FHO22]). Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted graph with n n n vertices and let t ≤ log n t\le\log n t ≤ log n be a parameter. In the heterogeneous MPC model with O ~ ( ∣ E ∣ ) \widetilde{O}(|E|) O ( ∣ E ∣ ) total memory, there exists a randomised algorithm that, w.h.p., constructs an O ( t ) O(t) O ( t ) -spanner for G G G of size O ~ ( n 1 + 1 / t ) \widetilde{O}(n^{1+1/t}) O ( n 1 + 1/ t ) in O ( 1 ) O(1) O ( 1 ) rounds.
The next tool comprises four subroutines that will be useful in the design of our MPC algorithms. At a high level, each subroutine involves constructing a tree with branching factor O ( n γ ) O(n^\gamma) O ( n γ ) and depth O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) over a contiguous segment of machines.
Lemma 2.5 (Basic MPC Tools [DN20; GSZ11]). Consider the sublinear MPC model with O ~ ( ∣ E ∣ ) \widetilde{O}(|E|) O ( ∣ E ∣ ) total memory and O ( n γ ) O(n^\gamma) O ( n γ ) memory per machine. Suppose we have a contiguous segment of machines and a set of comparable items S = { x 1 , x 2 , … , x n } S=\{x_1,x_2,\ldots,x_n\} S = { x 1 , x 2 , … , x n } stored across these machines. The following tasks can be accomplished in O ( 1 ) O(1) O ( 1 ) rounds:
Sorting: Sort the items in S S S across the contiguous segment of machines.
Find Minimum: Find the minimum value in S S S .
Prefix Sum: If S S S is a set of numbers, compute the value p i = ∑ j = 1 i x j p_i=\sum_{j=1}^{i}x_j p i = ∑ j = 1 i x j for each x i ∈ S x_i\in S x i ∈ S .
Broadcast: Broadcast a message of size b ∈ O ( n γ ) b\in O(n^\gamma) b ∈ O ( n γ ) across the contiguous segment of machines.
A Connectivity Assumption
In this work, we will implicitly assume throughout that the input graph to our distance oracle algorithms is connected . To justify this assumption, we show that a distance oracle for disconnected graphs can be reduced to a distance oracle for connected graphs. Specifically, we do this by connecting high-weight edges between different connected components.
Lemma 2.6. Let G = ( V , E ) G = (V, E) G = ( V , E ) be a weighted graph with n n n vertices, let T ∈ Ω ~ ( ∣ E ∣ ) T \in\widetilde{\Omega}(|E|) T ∈ Ω ( ∣ E ∣ ) , R : = R ( n ) R := R(n) R := R ( n ) , Q : = Q ( n ) Q := Q(n) Q := Q ( n ) be functions, and let a ∈ poly ( n ) a \in\operatorname{poly}(n) a ∈ poly ( n ) . Suppose that in the heterogeneous MPC model with T T T total memory, there exists a randomised algorithm A \mathcal{A} A that, when G G G is connected, w.h.p. constructs an a a a -approximate SSSP oracle in O ( R ) O(R) O ( R ) rounds which answers queries in O ( Q ) O(Q) O ( Q ) rounds.
Then in the same model of computation, there exists another randomised algorithm A ′ \mathcal{A}' A ′ that, regardless if G G G is connected or disconnected, w.h.p. constructs an a a a -approximate SSSP oracle in O ( R + 1 ) O(R+1) O ( R + 1 ) rounds which answers queries in O ( Q + 1 ) O(Q+1) O ( Q + 1 ) rounds.
Proof. We suppose the existence of A \mathcal{A} A and describe the algorithm A ′ \mathcal{A}' A ′ . For readability, we describe only the essential details.
Given the input graph G = ( V , E ) G = (V, E) G = ( V , E ) , the near-linear-space machine M ∗ M^* M ∗ first chooses an arbitrary vertex z ∈ V z \in V z ∈ V . The entire set of incident edges on z z z is collected onto M ∗ M^* M ∗ in O ( 1 ) O(1) O ( 1 ) rounds using the tools from Lemma 2.5 . Also using the same set of tools, we find the heaviest edge weight W W W of G G G in O ( 1 ) O(1) O ( 1 ) rounds which is communicated to M ∗ M^* M ∗ . Locally, M ∗ M^* M ∗ now adds the following additional edges to the graph G G G : For each vertex v ∈ V v \in V v ∈ V such that { z , v } ∉ E \{z,v\} \notin E { z , v } ∈ / E , add the edge { z , v } \{z,v\} { z , v } with weight a ( n ) ⋅ W ( n − 1 ) + 1 a(n) \cdot W(n-1) + 1 a ( n ) ⋅ W ( n − 1 ) + 1 . This constructs a new weighted graph G ′ G' G ′ . Crucially, G ′ G' G ′ is also a connected graph.
We run the algorithm A \mathcal{A} A on G ′ G' G ′ (instead of G G G ). This requires O ( R ) O(R) O ( R ) rounds and constructs an a ( n ) a(n) a ( n ) -approximate SSSP oracle O G ′ O_{G'} O G ′ for G ′ G' G ′ which answers queries in O ( Q ) O(Q) O ( Q ) rounds. For a query vertex u u u , let O G ′ ( u ) [ v ] O_{G'}(u)[v] O G ′ ( u ) [ v ] be the a ( n ) a(n) a ( n ) -approximate distance from u u u to v v v returned by O G ′ O_{G'} O G ′ . We claim that u u u and v v v are connected in G G G if and only if O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ W ( n − 1 ) O_{G'}(u)[v] \leq a(n) \cdot W(n-1) O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ W ( n − 1 ) . Using this claim, we adapt O G ′ O_{G'} O G ′ into an SSSP oracle O G O_G O G for the original graph G G G as follows:
O G ( u ) [ v ] : = { O G ′ ( u ) [ v ] if O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ W ( n − 1 ) ∞ otherwise. O_G(u)[v] := \begin{cases}
O_{G'}(u)[v] & \text{if } O_{G'}(u)[v] \leq a(n) \cdot W(n-1) \\
\infty& \text{otherwise.}
\end{cases} O G ( u ) [ v ] := { O G ′ ( u ) [ v ] ∞ if O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ W ( n − 1 ) otherwise.
It is quick to verify that O G O_G O G satisfies the following: (1) it requires at most O ( R + 1 ) O(R+1) O ( R + 1 ) rounds of preprocessing, and (2) it is an a ( n ) a(n) a ( n ) -approximate SSSP oracle for G G G that answers queries in O ( Q + 1 ) O(Q+1) O ( Q + 1 ) rounds.
It now suffices to justify the earlier claim. If u u u and v v v are connected in G G G , we then have that d G ′ ( u , v ) = d G ( u , v ) ≤ W ( n − 1 ) d_{G'}(u,v) = d_G(u,v) \leq W(n-1) d G ′ ( u , v ) = d G ( u , v ) ≤ W ( n − 1 ) (as there are at most n − 1 n-1 n − 1 edges in any shortest path between u u u and v v v ). Therefore, we must have that O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ d G ′ ( u , v ) ≤ a ( n ) ⋅ W ( n − 1 ) O_{G'}(u)[v] \leq a(n) \cdot d_{G'}(u,v) \leq a(n) \cdot W(n-1) O G ′ ( u ) [ v ] ≤ a ( n ) ⋅ d G ′ ( u , v ) ≤ a ( n ) ⋅ W ( n − 1 ) . Conversely, suppose that u u u and v v v are not connected in G G G . By the definition of G ′ G' G ′ , we have that d G ′ ( u , v ) ≥ a ( n ) ⋅ W ( n − 1 ) + 1 d_{G'}(u,v) \geq a(n) \cdot W(n-1) + 1 d G ′ ( u , v ) ≥ a ( n ) ⋅ W ( n − 1 ) + 1 . Therefore, O G ′ ( u ) [ v ] ≥ d G ′ ( u , v ) ≥ a ( n ) ⋅ W ( n − 1 ) + 1 > a ( n ) ⋅ W ( n − 1 ) O_{G'}(u)[v] \geq d_{G'}(u,v) \geq a(n) \cdot W(n-1) + 1 > a(n) \cdot W(n-1) O G ′ ( u ) [ v ] ≥ d G ′ ( u , v ) ≥ a ( n ) ⋅ W ( n − 1 ) + 1 > a ( n ) ⋅ W ( n − 1 ) . The claim follows. □ \square □
Technical Overview
We first provide an informal, high-level overview of our SSSP oracle construction. Given the input graph G G G with n n n vertices,
Build an O ( 1 ) O(1) O ( 1 ) -spanner graph G ′ G' G ′ of G G G .
Determine approximate k k k -nearest neighbourhoods for all vertices in G ′ G' G ′ .
Transform the approximate k k k -nearest neighbourhoods into exact k k k -nearest neighbourhoods, building the k k k -nearest edge set E k E_k E k .
Using E k E_k E k , build the skeleton graph G S ′ G'_S G S ′ for G ′ G' G ′ .
Build an O ~ ( n ) \widetilde{O}(n) O ( n ) -sized constant-stretch spanner F F F for G S ′ G'_S G S ′ , which is stored on a near-linear memory machine.
F F F and E k E_k E k together act as our distance oracle for all future distance queries.
We present the technical overview as follows. We first describe the three “building blocks” in § 3.1 , which cover Steps 3 and 4 above. We then give a more precise technical description of the oracle construction in § 3.2 , with a particular focus on the construction of approximate k k k -nearest neighbourhoods (Step 2 above) for the heterogeneous MPC regime. We conclude with a comparison with prior work in § 3.3 .
Building Blocks
The first of the building blocks is a skeleton graph construction (§ 3.1.1 ), which forms the foundation of our SSSP oracle. This is supported by two additional tools: A k k k -nearest hopset construction and an algorithm for extracting k k k -nearest neighbourhoods (§ 3.1.2 ).
Skeleton Graphs
Informally, in the context of distance computation, a skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) is a weighted graph over a subset V S ⊆ V V_S \subseteq V V S ⊆ V of vertices such that approximate distances in the original graph G G G can be efficiently inferred from the approximate distances in G S G_S G S .
In this work, we consider a specific skeleton graph definition from Bui et al. [11 ] , which is based on the concept of k k k -nearest neighbourhoods. Recall that the k k k -nearest edge set E k E_k E k is defined in § 2 .
Definition 3.1 (Skeleton Graphs [11 ] ). Let G = ( V , E ) G = (V, E) G = ( V , E ) be a weighted graph with n n n vertices, and let k > 1 k > 1 k > 1 be an integer. A skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) is a weighted graph on a vertex set V S ⊆ V V_S \subseteq V V S ⊆ V with ∣ V S ∣ ≤ C S ⋅ n log k k |V_S| \le\frac{C_S \cdot n \log k}{k} ∣ V S ∣ ≤ k C S ⋅ n l o g k , where C S > 0 C_S > 0 C S > 0 is a universal constant. This is subject to the following conditions:
(No shrinking distances) For any pair of vertices u , v ∈ V S u, v \in V_S u , v ∈ V S , we have d G S ( u , v ) ≥ d G ( u , v ) d_{G_S}(u, v) \ge d_G(u, v) d G S ( u , v ) ≥ d G ( u , v ) .
(Clusters as good approximations) For all u , v ∈ V u, v \in V u , v ∈ V such that u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) and v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) , there exists a path P P P in E k ∪ E S E_k \cup E_S E k ∪ E S from u u u to v v v satisfying:
(P1) The length of P P P is a 7-approximation of d G ( u , v ) d_G(u, v) d G ( u , v ) .
(P2) The first and last edges of P P P belong to E k E_k E k , while all intermediate edges belong to E S E_S E S .
Intuitively, the path P P P in the above definition enables us to derive O ( 1 ) O(1) O ( 1 ) -approximate distances in the original graph G G G from O ( 1 ) O(1) O ( 1 ) -approximate distances in the skeleton graph G S G_S G S . The approximate distances in G S G_S G S can be efficiently obtained via spanners constructed using Lemma 2.4 . In particular, when k ∈ n Θ ( 1 ) k \in n^{\Theta(1)} k ∈ n Θ ( 1 ) , the entire spanner can be stored on a machine with near-linear memory, allowing us to obtain the desired O ( 1 ) O(1) O ( 1 ) -approximate SSSP oracle.
Following the definition of skeleton graphs, two questions remain: First, how do we construct the edge set E k E_k E k ; second, how do we build a skeleton graph? The former question requires the two remaining building blocks. We address the latter question in the discussion below.
Existing Construction. We begin by reviewing the construction of Bui et al. [11 ] in the congested clique model. The first step is to compute, via random sampling, a hitting set of size O ( n log k k ) O\left(\frac{n \log k}{k}\right) O ( k n l o g k ) for the k k k -nearest neighbourhoods N k ( v ) N_k(v) N k ( v ) for all v ∈ V v \in V v ∈ V (i.e., a set that intersects every k k k -nearest neighbourhood). These sampled vertices serve as cluster centers, and each vertex v ∈ V v \in V v ∈ V joins the cluster of its nearest center. Let c ( v ) c(v) c ( v ) denote the cluster center assigned to vertex v v v . The set of cluster centers forms the vertex set of the skeleton graph.
To construct the edge set of the skeleton graph, consider all paths of the form
c ( u ) ⇝ u ⇝ t → v ⇝ c ( v ) , where t ∈ N k ( u ) and { t , v } ∈ E . c(u) \leadsto u \leadsto t \to v \leadsto c(v), \qquad\text{where } t \in N_k(u) \text{ and } \{t,v\} \in E. c ( u ) ⇝ u ⇝ t → v ⇝ c ( v ) , where t ∈ N k ( u ) and { t , v } ∈ E .
For each such path, add the edge { c ( u ) , c ( v ) } \{c(u),c(v)\} { c ( u ) , c ( v )} to the skeleton graph, with weight equal to the total length of the path. In the case of parallel edges, retain the edge with the minimum weight.
While this construction is sufficient for the congested clique algorithm of Bui et al. [11 ] , it is not suitable for the MPC model, as the total number of edges can reach O ( n 2 / k 2 ) O(n^2/k^2) O ( n 2 / k 2 ) in the worst case, exceeding the total memory available.
Namely, consider the scenario where a vertex t t t belongs to the k k k -nearest neighbourhood of every other vertex and is adjacent to all of them. In this case, t t t leads to an edge between every pair of cluster centers, resulting in a total of O ( ∣ V S ∣ 2 ) ⊆ O ( ( n log k ) 2 / k 2 ) O\left(|V_S|^2\right) \subseteq O\left((n \log k)^2/k^2\right) O ( ∣ V S ∣ 2 ) ⊆ O ( ( n log k ) 2 / k 2 ) edges in the skeleton graph. Moreover, the construction of Bui et al. [11 ] relies on a sparse matrix multiplication algorithm that critically exploits the high total bandwidth of the congested clique model (i.e. O ( n 2 ) O(n^2) O ( n 2 ) total memory across all machines), and therefore does not extend to the MPC model.
Modified Construction. We address the issue by modifying the construction to directly include any vertex t ∈ V t \in V t ∈ V that would otherwise induce an excessive number of edges in the skeleton graph. Specifically, for each such t t t and for each candidate path of the form c ( u ) ⇝ u ⇝ t → v ⇝ c ( v ) c(u) \leadsto u \leadsto t \to v \leadsto c(v) c ( u ) ⇝ u ⇝ t → v ⇝ c ( v ) , rather than adding the edge { c ( u ) , c ( v ) } \{c(u),c(v)\} { c ( u ) , c ( v )} to the skeleton graph, we instead add the edges { t , c ( u ) } \{t,c(u)\} { t , c ( u )} and { t , c ( v ) } \{t,c(v)\} { t , c ( v )} .
This modification ensures that the total number of edges in the skeleton graph is bounded by O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) . We also provide an MPC implementation that runs in O ( 1 ) O(1) O ( 1 ) rounds. Crucially, we show that this change preserves all structural guarantees required by Definition 3.1. The construction is formalized in the following lemma.
Lemma 3.2 (Skeleton Graph Construction). Let G = ( V , E ) G = (V, E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 1 k > 1 k > 1 be an integer. Suppose the k k k -nearest edge set E k E_k E k for G G G is given. If k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) , then in the sublinear MPC model with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory, there exists a randomised algorithm that w.h.p. constructs a skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) in O ( 1 ) O(1) O ( 1 ) rounds.
We note that in all applications of Lemma 3.2 in this paper, we do not apply it on the input graph directly, but on a sparse O ( 1 ) O(1) O ( 1 ) -spanner of the input graph – this reduces the total memory requirement from O ~ ( ∣ E ∣ n γ / 2 ) \widetilde{O}(|E|n^{\gamma/2}) O ( ∣ E ∣ n γ /2 ) to O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E| + n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) .
Constructing the k k k -Nearest Edge Set
We now describe how to construct the k k k -nearest edge set E k E_k E k . However, instead of constructing E k E_k E k directly, we will show how to transform any given knowledge of the approximate k k k -nearest neighbourhoods into the exact k k k -nearest edge set E k E_k E k .
Constructing the k k k -Nearest Hopset. The first step of the transformation is to construct a k k k -nearest hopset, based on an MPC implementation of the corresponding congested clique algorithm by Bui et al. [11 ] . The algorithm starts with an a a a -approximate k k k -nearest neighbourhood N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) for each vertex u ∈ V u \in V u ∈ V . By requesting the k k k shortest edges for each vertex in N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) , vertex u u u can recover exact distances to a sufficiently large fraction of its true k k k -nearest neighbourhood N k ( u ) N_k(u) N k ( u ) . Shortcutting paths using this distance information yields a k k k -nearest hopset with hopbound O ( a log d ) O(a \log d) O ( a log d ) , where d d d is the weighted diameter of the graph.
Lemma 3.3 (k k k -Nearest Hopset). Let G = ( V , E ) G = (V, E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 0 k > 0 k > 0 be an integer. Suppose that for every vertex u ∈ V u \in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u, t) : t \in\widetilde{N}_k(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an a a a -approximate k k k -nearest neighbourhood of u u u . If k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) , then in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E| + nk^2) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic algorithm that constructs a k k k -nearest O ( a log d ) O(a \log d) O ( a log d ) -hopbound hopset H H H in O ( 1 ) O(1) O ( 1 ) rounds, where d d d is the weighted diameter of G G G .
Constructing the k k k -Nearest Edge Set. Building on the k k k -nearest hopset construction from Lemma 3.3 , we now turn to the problem of extracting the k k k -nearest neighbourhoods. Specifically, given a graph G = ( V , E ) G = (V, E) G = ( V , E ) and a hopset with hopbound h h h , the goal is to compute the k k k -nearest h h h -hopbound neighbourhoods N k ( h ) ( u ) N_k^{(h)}(u) N k ( h ) ( u ) for all vertices u ∈ V u \in V u ∈ V in O ( log h ) O(\log h) O ( log h ) rounds in the MPC model.
This task has been studied in the congested clique model and appears as a key subroutine in several APSP algorithms [11 CDK+21, DP22] . It can be solved via a standard graph exponentiation approach. Initially, each vertex u u u knows its 1-hop k k k -nearest neighbourhood N k ( 1 ) ( u ) N_k^{(1)}(u) N k ( 1 ) ( u ) . In iteration i i i , each vertex u u u collects the sets N k ( 2 i − 1 ) ( t ) N_k^{(2^{i-1})}(t) N k ( 2 i − 1 ) ( t ) for all t ∈ N k ( 2 i − 1 ) ( u ) t \in N_k^{(2^{i-1})}(u) t ∈ N k ( 2 i − 1 ) ( u ) , which is sufficient to compute N k ( 2 i ) ( u ) N_k^{(2^i)}(u) N k ( 2 i ) ( u ) . Repeating this process for O ( log h ) O(\log h) O ( log h ) iterations yields the desired k k k -nearest h h h -hop neighbourhoods.
We show that each iteration can be implemented in O ( 1 ) O(1) O ( 1 ) rounds in the sublinear MPC model, and thus the overall procedure completes in O ( log h ) O(\log h) O ( log h ) rounds. The result is summarised in the following lemma.
Lemma 3.4 (Extracting k k k -Nearest Neighbourhoods). Let G = ( V , E ) G = (V, E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 0 k > 0 k > 0 and r > 0 r > 0 r > 0 be integers, setting h = 2 r h = 2^r h = 2 r . Suppose that k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) .
Then, in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E| + nk^{2}) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic O ( r ) O(r) O ( r ) -round algorithm that constructs the set
{ ( u , t , d G ( h ) ( u , t ) ) : u ∈ V and t ∈ N k ( h ) ( u ) } . \left\{ \left(u,t,d_{G}^{(h)}(u,t)\right) : u \in V \text{ and } t \in N_{k}^{(h)}(u) \right\}. { ( u , t , d G ( h ) ( u , t ) ) : u ∈ V and t ∈ N k ( h ) ( u ) } .
In this work, we apply the above lemma in two contexts. First, in conjunction with the k k k -nearest hopset from Lemma 3.3 , it enables an efficient construction of the exact k k k -nearest edge set E k E_k E k , as previously discussed. Second, it allows us to extract c c c -approximate k k k -nearest neighbourhoods from a given c c c -stretch h h h -hopbound emulator.
We remark that the round complexity of Lemma 3.4 constitutes one of the main bottlenecks in our overall algorithm. In particular, an improved algorithm for Lemma 3.4 would directly lead to a faster implementation in the near-linear MPC model.
Building the SSSP Oracle
In this section, we provide a technical overview of our SSSP oracle, organised in two parts. In § 3.2.1 , we describe how to construct the oracle assuming access to approximate k k k -nearest neighbourhoods. This part follows by combining the previously introduced building blocks in a straightforward manner. In § 3.2.2 , we address the main technical challenge: efficiently computing approximate k k k -nearest neighbourhoods in the heterogeneous MPC model. Our approach is based on constructing an emulator via a hierarchical application of the skeleton graph construction.
We remark that in the following discussion, we hide the dependence on c c c and γ \gamma γ in the stretch terms for ease of presentation. This is justified as we consider both c c c and γ \gamma γ as constants. We treat this more carefully in the full proofs in § 4 .
From Approximate k k k -Nearest Neighbourhoods to SSSP Oracles
Using Lemmas 3.3 and 3.4, we construct the set E k E_k E k from the given approximate k k k -nearest neighbourhoods and apply Lemma 3.2 to build a skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) . We then compute an O ( 1 ) O(1) O ( 1 ) -spanner of G S G_S G S and store it on a machine with near-linear memory. Together, the spanner and E k E_k E k yield the desired O ( 1 ) O(1) O ( 1 ) -approximate SSSP oracle.
We now describe the setup in more detail. Suppose we are given a a a -approximate k k k -nearest neighbourhoods N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) for every vertex u ∈ V u \in V u ∈ V , where log a = O ( log log n ) \log a = O(\log\log n) log a = O ( log log n ) and k = n c / 4 k = n^{c/4} k = n c /4 for some constant c > 0 c > 0 c > 0 . We also assume ∣ E ∣ = O ( n 1 + c / 2 ) |E| = O(n^{1+c/2}) ∣ E ∣ = O ( n 1 + c /2 ) , which can be ensured by replacing G G G with an O ( 1 ) O(1) O ( 1 ) -spanner, which is acceptable since it only stretches the distances by a constant factor.
Construct a k k k -nearest O ( a log n ) O(a\log n) O ( a log n ) -hopbound hopset H H H for G G G using Lemma 3.3 , which takes O ( 1 ) O(1) O ( 1 ) rounds.
Apply Lemma 3.4 to the graph G ∪ H G \cup H G ∪ H , setting the parameter r r r so that 2 r = h ∈ O ( a log n ) 2^r = h \in O(a\log n) 2 r = h ∈ O ( a log n ) is at least the hopbound of the hopset. This yields the exact k k k -nearest neighbourhoods for all vertices in O ( log ( a log n ) ) = O ( log log n ) O(\log(a\log n)) = O(\log\log n) O ( log ( a log n )) = O ( log log n ) rounds and also the edge set E k E_k E k .
Using E k E_k E k , construct a skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) for G G G via Lemma 3.2 in O ( 1 ) O(1) O ( 1 ) rounds.
For a constant t ≥ 4 / c t \ge4/c t ≥ 4/ c , construct an O ( t ) O(t) O ( t ) -spanner F F F of G S G_S G S with O ~ ( ∣ V S ∣ 1 + 1 / t ) ⊆ O ~ ( n ) \widetilde{O}(|V_S|^{1+1/t}) \subseteq\widetilde{O}(n) O ( ∣ V S ∣ 1 + 1/ t ) ⊆ O ( n ) edges using Lemma 2.4 in O ( 1 ) O(1) O ( 1 ) rounds. Collect the spanner on a machine M ∗ M^* M ∗ with near-linear memory.
Overall, the algorithm completes in O ( log log n ) O(\log\log n) O ( log log n ) rounds and uses O ~ ( n 1 + c ) \widetilde{O}(n^{1+c}) O ( n 1 + c ) total memory.
SSSP Queries. To compute an O ( 1 ) O(1) O ( 1 ) -approximate SSSP from a source vertex u ∈ V u \in V u ∈ V , we consider two cases:
Case 1: v ∈ N k ( u ) v \in N_k(u) v ∈ N k ( u ) or u ∈ N k ( v ) u \in N_k(v) u ∈ N k ( v ) . Return the exact distance ω E k ( u , v ) = d G ( u , v ) \omega_{E_k}(u,v) = d_G(u,v) ω E k ( u , v ) = d G ( u , v ) .
Case 2: v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) and u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) . Return the minimum length over all paths of the form: u → s ∈ V S u \to s \in V_S u → s ∈ V S via an edge in E k E_k E k , followed by a path s ⇝ s ′ ∈ V S s \leadsto s' \in V_S s ⇝ s ′ ∈ V S in the spanner F F F , and then s ′ → v s' \to v s ′ → v via an edge in E k E_k E k .
In Case 2, the returned value is an O ( 1 ) O(1) O ( 1 ) -approximation of the true distance d G ( u , v ) d_G(u,v) d G ( u , v ) , guaranteed by the properties of the skeleton graph. Moreover, the path lengths to all vertices v ∈ V v \in V v ∈ V can be computed simultaneously in O ( 1 ) O(1) O ( 1 ) rounds. In other words, using the edge set E k E_k E k and the spanner F F F of G S G_S G S , we can answer O ( 1 ) O(1) O ( 1 ) -approximate SSSP queries in O ( 1 ) O(1) O ( 1 ) rounds.
Computing Approximate k k k -Nearest Neighbourhoods
We now describe the construction of the required a a a -approximate k k k -nearest neighbourhoods.
The Near-Linear MPC Model. In the near-linear MPC model, the problem can be solved easily by constructing an O ( log n ) O(\log n) O ( log n ) -spanner with O ~ ( n ) \widetilde{O}(n) O ( n ) edges using Lemma 2.4 . This spanner can then be broadcast to all machines, allowing each machine to compute an O ( log n ) O(\log n) O ( log n ) -approximate k k k -nearest neighbourhood for each vertex locally. Since the spanner construction takes only O ( 1 ) O(1) O ( 1 ) rounds, the overall round complexity for constructing the SSSP oracle is O ( log log n ) O(\log\log n) O ( log log n ) .
The Heterogeneous MPC Model. The spanner-based approach used in the near-linear MPC model does not extend to the heterogeneous regime, as we cannot afford to store a linear-sized spanner on each machine. To overcome this, we construct a 2 O ( log log n ) 2^{O(\log\log n)} 2 O ( l o g l o g n ) -stretch, O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator via a recursive application of skeleton graph constructions. This emulator is built in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds and constitutes the main bottleneck in the overall SSSP oracle construction. Once the emulator is constructed, we apply Lemma 3.4 to extract the desired a = 2 O ( log log n ) a = 2^{O(\log\log n)} a = 2 O ( l o g l o g n ) -approximate k k k -nearest neighbourhoods, for k k k being a small polynomial in n n n , using an additional O ( log log log n ) O(\log\log\log n) O ( log log log n ) rounds. This suffices for our purposes.
The Emulator Construction. The key idea behind the emulator construction is that the spanner-based approach used in the near-linear regime still works in the heterogeneous regime when k k k is polylogarithmic . Once the spanner is stored on the near-linear memory machine M ∗ M^* M ∗ , it can locally compute the desired approximate k k k -nearest neighbourhoods for all vertices using the spanner. Since k k k is polylogarithmic, the total output size is n k ∈ O ~ ( n ) nk \in\widetilde{O}(n) nk ∈ O ( n ) and fits within the local memory of M ∗ M^* M ∗ .
We apply the skeleton graph construction to G G G with parameter k k k , obtaining a slightly smaller skeleton graph G 1 G_1 G 1 with O ( n log k k ) O\left(\frac{n\log k}{k}\right) O ( k n l o g k ) vertices. For simplicity, in this technical overview, we assume the bound is O ( n / k ) O(n/k) O ( n / k ) .
Next, we apply the same skeleton graph construction to G 1 = ( V 1 , E 1 ) G_1 = (V_1, E_1) G 1 = ( V 1 , E 1 ) . The reduced size of G 1 G_1 G 1 allows us to increase the parameter to k 2 k^2 k 2 , yielding a new skeleton graph with O ( ∣ V 1 ∣ / k 2 ) = O ( n / k 3 ) O\left(|V_1|/k^2\right) = O(n/k^3) O ( ∣ V 1 ∣/ k 2 ) = O ( n / k 3 ) vertices. This, in turn, enables us to increase k k k even further in the next iteration. Due to the growth rate of the parameter k k k , the recursion terminates after O ( log log n ) O(\log\log n) O ( log log n ) iterations. We show that the union of the edge sets E k E_k E k across all levels of the recursion forms the desired emulator.
We now describe the idea more concretely. We initialize H : = ∅ H := \varnothing H := ∅ and proceed in iterations. At the beginning of the i i i th iteration, we maintain a graph G i = ( V i , E i ) G_i = (V_i, E_i) G i = ( V i , E i ) and a parameter k i k_i k i , where G 0 = G G_0 = G G 0 = G and k 0 = log n k_0 = \log n k 0 = log n . We assume that k i ⋅ ∣ V i ∣ ∈ O ( n log n ) k_i \cdot|V_i| \in O(n \log n) k i ⋅ ∣ V i ∣ ∈ O ( n log n ) and that the weighted diameter of G i G_i G i is bounded by poly ( n ) \operatorname{poly}(n) poly ( n ) .
We begin by sparsifying G i G_i G i by constructing an O ( 1 ) O(1) O ( 1 ) -stretch spanner G i ′ G'_i G i ′ using Lemma 2.4 , to ensure that the number of edges remains bounded.
Next, we construct an O ( log n ) O(\log n) O ( log n ) -stretch spanner S S S of G i ′ G'_i G i ′ with O ~ ( n ) \widetilde{O}(n) O ( n ) edges using Lemma 2.4 . We store S S S on the machine M ∗ M^* M ∗ with near-linear memory. Since k i ⋅ ∣ V i ∣ ∈ O ( n log n ) k_i \cdot|V_i| \in O(n \log n) k i ⋅ ∣ V i ∣ ∈ O ( n log n ) , M ∗ M^* M ∗ can locally compute the k i k_i k i -nearest neighbourhoods for all vertices in the spanner S S S . This yields a = O ( log n ) a = O(\log n) a = O ( log n ) -approximate k i k_i k i -nearest neighbourhoods for all vertices in V i V_i V i , and takes O ( 1 ) O(1) O ( 1 ) rounds.
As in § 3.2.1 , we apply Lemmas 3.3 and 3.4 to construct the edge set E k i E_{k_i} E k i in O ( log ( a log n ) ) ⊆ O ( log log n ) O(\log(a \log n)) \subseteq O(\log\log n) O ( log ( a log n )) ⊆ O ( log log n ) rounds.
We add E k i E_{k_i} E k i to the emulator edge set H H H .
Finally, we construct the skeleton graph G S G_S G S for G i ′ G'_i G i ′ and set G i + 1 : = G S G_{i+1} := G_S G i + 1 := G S and k i + 1 ∈ O ( k i 2 ) k_{i+1} \in O(k_i^2) k i + 1 ∈ O ( k i 2 ) .
We continue the process until the graph becomes small enough that all-pairs distances can be computed locally on a single machine. A minor technical detail is that once k i k_i k i reaches a small polynomial in n n n , we keep k i k_i k i fixed in all subsequent iterations to ensure that the local memory requirements of the building blocks are satisfied. Since there are O ( log log n ) O(\log\log n) O ( log log n ) iterations, where each iteration takes O ( log log n ) O(\log\log n) O ( log log n ) rounds, the overall emulator construction completes in O ( log 2 log n ) O(\log^2 \log n) O ( log 2 log n ) rounds.
Comparison with Prior Work
Comparison with [11 ] . While both our algorithm and that of Bui et al. [11 ] rely on skeleton graphs, they are used in different ways. We apply the skeleton graph construction recursively to build an emulator with small stretch and hopbound. In contrast, the O ( log log log n ) O(\log\log\log n) O ( log log log n ) -round congested clique algorithm of Bui et al. [11 ] uses a skeleton graph with k ∈ 2 Θ ( a ) k \in2^{\Theta(\sqrt{a})} k ∈ 2 Θ ( a ) as an intermediate step to improve an a a a -approximate APSP to an O ( a ) O(\sqrt{a}) O ( a ) -approximate one in O ( 1 ) O(1) O ( 1 ) rounds – starting with a = O ( log n ) a = O(\log n) a = O ( log n ) , they repeat this for O ( log log log n ) O(\log\log\log n) O ( log log log n ) iterations to obtain constant-approximate APSP.
Their approach is infeasible in our setting for two main reasons. First, constructing such a skeleton graph in O ( 1 ) O(1) O ( 1 ) rounds requires a fast k k k -nearest neighbourhood computation algorithm that leverages the high total bandwidth of the congested clique model. Second, obtaining the O ( a ) O(\sqrt{a}) O ( a ) -approximation relies on broadcasting an O ( a ) O(\sqrt{a}) O ( a ) -spanner of the skeleton graph to all machines, which demands linear local memory per machine.
Comparison with [9 ] . In the work of Andoni, Stein, and Zhong [9 ] , they demonstrated a similar recursive construction of a hop-bounded emulator in the PRAM model of computation using a structure known as a subemulator (as opposed to our use of the skeleton graph).
Although both Andoni, Stein, and Zhong [9 ] and our work employ similar recursive constructions of emulators, the motivations for the recursion and the roles played by the resulting emulators differ substantially. In Andoni, Stein, and Zhong [9 ] , the emulator is used to construct Bourgain’s embedding, metric tree embeddings, and low-diameter decompositions, whereas in our work it is used to find the required a a a -approximate k k k -nearest neighbourhoods. Moreover, Andoni, Stein, and Zhong [9 ] adopt the recursive construction, in which a smaller vertex set permits a larger choice of k k k , to satisfy the work-efficiency constraint. In contrast, we arrive at the same condition to ensure that the k k k -nearest neighbourhoods of all vertices can be stored on a single machine with near-linear memory.
O(1)-Approximate SSSP Oracles
In this section, we present the main algorithms of the paper in detail: O ( 1 ) O(1) O ( 1 ) -approximate SSSP oracles with O ( 1 ) O(1) O ( 1 ) query time. The construction requires O ( log log n ) O(\log\log n) O ( log log n ) rounds in the near-linear MPC model and O ( log 2 log n ) O(\log^{2}\log n) O ( log 2 log n ) rounds in the heterogeneous MPC model.
We first state the following lemma, which is a tool to “convert” approximate k k k -nearest neighbourhoods to exact k k k -nearest neighbourhoods.
Lemma 4.1 (Approximate to Exact k k k -Nearest). Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let integer k > 0 k>0 k > 0 be a parameter. Suppose that for every vertex u ∈ V u\in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u,t):t\in\widetilde{N}_k(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an a a a -approximate k k k -nearest neighbourhood of u u u .
Given that k 2 ∈ O ( n γ ) k^2\in O(n^\gamma) k 2 ∈ O ( n γ ) , in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic algorithm for constructing the k k k -nearest edge set E k E_k E k for G G G in O ( log log d + log a ) O(\log\log d+\log a) O ( log log d + log a ) rounds, where d d d is the weighted diameter of G G G .
Proof. We first apply Lemma 3.3 to obtain a k k k -nearest ( C a log d ) (Ca\log d) ( C a log d ) -hopbound hopset H H H in O ( 1 ) O(1) O ( 1 ) rounds, where C C C is a suitable constant. We now apply Lemma 3.4 on the graph G ∪ H G\cup H G ∪ H , setting the parameter r r r such that $2^r=h\ge Ca\log d$. This constructs the h h h -hop k k k -nearest neighbourhoods N G ∪ H , k ( h ) ( u ) N^{(h)}_{G\cup H,k}(u) N G ∪ H , k ( h ) ( u ) for all vertices u ∈ V u\in V u ∈ V in $G\cup H. We recall by the definition of k k k -nearest hopsets (Definition 2.3) that for all vertices u , v ∈ V u,v\in V u , v ∈ V such that v ∈ N G , k ( u ) v\in N_{G,k}(u) v ∈ N G , k ( u ) , we have
d G ∪ H ( h ) ( u , v ) ≤ d G ∪ H ( C a log d ) ( u , v ) = d G ( u , v ) . d^{(h)}_{G\cup H}(u,v)\le d^{(Ca\log d)}_{G\cup H}(u,v)=d_G(u,v). d G ∪ H ( h ) ( u , v ) ≤ d G ∪ H ( C a l o g d ) ( u , v ) = d G ( u , v ) .
Moreover, H H H does not shorten distances in G G G , i.e., d G ∪ H ( u , v ) = d G ( u , v ) d_{G\cup H}(u,v)=d_G(u,v) d G ∪ H ( u , v ) = d G ( u , v ) for vertex pairs u , v ∈ V u,v\in V u , v ∈ V . This implies that the k k k -nearest neighbourhood of any vertex in G ∪ H G\cup H G ∪ H is the same as that in G G G (noting that in both cases, we are breaking ties by vertex ID).
Altogether, this implies N G ∪ H , k ( h ) ( u ) = N G , k ( u ) N^{(h)}_{G\cup H,k}(u)=N_{G,k}(u) N G ∪ H , k ( h ) ( u ) = N G , k ( u ) for all u ∈ V u\in V u ∈ V , and therefore we have equivalently constructed the k k k -nearest edge set E k E_k E k , as desired.
Constructing the hopset H H H requires O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, while extracting out the k k k -nearest neighbourhoods requires O ~ ( ∣ G ∪ H ∣ + n k 2 ) \widetilde{O}(|G\cup H|+nk^2) O ( ∣ G ∪ H ∣ + n k 2 ) total memory. Therefore, our entire algorithm only requires O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, and runs in O ( r ) = O ( log ( a log d ) ) = O ( log a + log log d ) O(r)=O(\log(a\log d))=O(\log a+\log\log d) O ( r ) = O ( log ( a log d )) = O ( log a + log log d ) rounds. □
From Approximate k k k -Nearest Neighbourhoods to SSSP Oracles
In this section, we aim to prove the following lemma. Notice that while the lemma is stated explicitly for the heterogeneous regime, it trivially extends to the near-linear regime with the same total memory and round complexity. In subsequent sections, we show how to relax our input assumptions depending on the MPC regime being considered.
We remark that the restriction on the edge set ∣ E ∣ ∈ O ~ ( n 1 + c / 2 ) |E| \in\tilde{O}(n^{1+c/2}) ∣ E ∣ ∈ O ~ ( n 1 + c /2 ) is only to ensure that the additional total memory as stated in Theorem 1 and Theorem 2 is represented as an additive term n 1 + c n^{1+c} n 1 + c as opposed to a multiplicative term n c n^{c} n c , i.e., O ~ ( ∣ E ∣ + n 1 + c ) \tilde{O}(|E| + n^{1+c}) O ~ ( ∣ E ∣ + n 1 + c ) instead of O ~ ( ∣ E ∣ n c ) \tilde{O}(|E|n^{c}) O ~ ( ∣ E ∣ n c ) total memory. Namely by choosing k = n c / 4 k = n^{c/4} k = n c /4 as the parameter for the k k k -nearest neighbourhoods, we ensure that the skeleton graph construction of Lemma 3.2 requires only O ~ ( ∣ E ∣ k 2 ) = O ~ ( n 1 + c ) \tilde{O}(|E|k^{2}) = \tilde{O}(n^{1+c}) O ~ ( ∣ E ∣ k 2 ) = O ~ ( n 1 + c ) total memory.
Lemma 4.2. Let G = ( V , E ) G = (V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let c > 0 c > 0 c > 0 be a constant such that ∣ E ∣ ∈ O ~ ( n 1 + c / 2 ) |E| \in\tilde{O}(n^{1+c/2}) ∣ E ∣ ∈ O ~ ( n 1 + c /2 ) . Suppose that for every vertex u ∈ V u \in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u,t) : t \in\widetilde{N}_{k}(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_{k}(u) N k ( u ) is an a a a -approximate k k k -nearest neighbourhood of u u u with k = n c / 4 k = n^{c/4} k = n c /4 . Given that c ≤ γ c \leq\gamma c ≤ γ , in the heterogeneous MPC model with O ~ ( n 1 + c ) \tilde{O}(n^{1+c}) O ~ ( n 1 + c ) total memory, there exists a randomised algorithm that w.h.p. constructs an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate SSSP oracle in O ( log a + log log n ) O(\log a + \log\log n) O ( log a + log log n ) rounds. Every subsequent SSSP query can then be answered in O ( 1 ) O(1) O ( 1 ) rounds.
The key idea is to construct the skeleton graph G S = ( V S , E S ) G_{S} = (V_{S},E_{S}) G S = ( V S , E S ) for the input graph G G G , and subsequently construct an O ( 1 / c ) O(1/c) O ( 1/ c ) -stretch spanner F F F for G S G_{S} G S . We will show by an appropriate choice of parameters that F F F can be made linear-sized, and therefore can be stored on a single near-linear memory machine. The spanner F F F and edge set E k E_{k} E k are then sufficient to handle any future SSSP queries in O ( 1 ) O(1) O ( 1 ) rounds.
Algorithm Description
As input, we are given the weighted n n n -vertex graph G = ( V , E ) G = (V,E) G = ( V , E ) , whose edge weights are polynomially-bounded (i.e., ω G ( u , v ) ∈ poly ( n ) \omega_{G}(u,v) \in\operatorname{poly}(n) ω G ( u , v ) ∈ poly ( n ) for all { u , v } ∈ E \{u,v\} \in E { u , v } ∈ E ).
Step 1: Get Exact k k k -Nearest. Denote k = n c / 4 k = n^{c/4} k = n c /4 . By the input assumptions, we have a a a -approximate k k k -nearest neighbourhoods N ~ k ( u ) \widetilde{N}_{k}(u) N k ( u ) for all vertices u ∈ V u \in V u ∈ V . Since k 2 = n c / 2 ≤ n γ k^{2} = n^{c/2} \leq n^{\gamma} k 2 = n c /2 ≤ n γ , this allows us to find the exact k k k -nearest neighbourhoods for all vertices by applying Lemma 4.1 on G G G . This constructs the k k k -nearest edge set E k E_{k} E k for G G G .
Denoting the weighted diameter of G G G as d d d , we observe that this step runs in O ( log a + log log d ) O(\log a + \log\log d) O ( log a + log log d ) rounds. The total memory required is O ~ ( ∣ E ∣ + n k 2 ) = O ~ ( n 1 + c / 2 ) \tilde{O}(|E| + nk^{2}) = \tilde{O}(n^{1+c/2}) O ~ ( ∣ E ∣ + n k 2 ) = O ~ ( n 1 + c /2 ) , which fits within our total memory constraints.
Step 2: Construct Skeleton Graph. We apply Lemma 3.2 on G G G with k = n c / 4 k = n^{c/4} k = n c /4 to obtain the skeleton graph G S = ( V S , E S ) G_{S} = (V_{S},E_{S}) G S = ( V S , E S ) . This step runs in O ( 1 ) O(1) O ( 1 ) rounds. We note that the total memory needed is O ~ ( ∣ E ∣ k 2 ) = O ~ ( n 1 + c / 2 ⋅ n c / 2 ) = O ~ ( n 1 + c ) \tilde{O}(|E|k^{2}) = \tilde{O}(n^{1+c/2} \cdot n^{c/2}) = \tilde{O}(n^{1+c}) O ~ ( ∣ E ∣ k 2 ) = O ~ ( n 1 + c /2 ⋅ n c /2 ) = O ~ ( n 1 + c ) , which fits within our total memory constraints.
Step 3: Sparsify G S G_{S} G S . We further sparsify G S G_{S} G S into a spanner F = ( V S , E F ) F = (V_{S},E_{F}) F = ( V S , E F ) . Namely, we apply Lemma 2.4 to obtain an O ( 4 / c ) O(4/c) O ( 4/ c ) -spanner of size ∣ E F ∣ ∈ O ~ ( ∣ V S ∣ 1 + c / 4 ) |E_{F}| \in\tilde{O}(|V_{S}|^{1+c/4}) ∣ E F ∣ ∈ O ~ ( ∣ V S ∣ 1 + c /4 ) in O ( 1 ) O(1) O ( 1 ) rounds. For now, we may assume that ∣ E F ∣ ∈ O ~ ( n ) |E_{F}| \in\tilde{O}(n) ∣ E F ∣ ∈ O ~ ( n ) ; we justify this assumption in Lemma 4.3 .
Step 4: Storing the Spanner. We store the spanner F F F on the single near-linear memory machine M ∗ M^{*} M ∗ . This requires O ( 1 ) O(1) O ( 1 ) rounds.
Our final SSSP oracle consists of the following:
The edge set E k E_{k} E k , stored arbitrarily across the machines.
The graph F F F , stored entirely on the machine M ∗ M^{*} M ∗ .
This concludes our construction.
Correctness
We first justify our claim that the spanner F F F is sufficiently small to store in a single near-linear memory machine.
Lemma 4.3. For any constant c > 0 c > 0 c > 0 , the size of the graph F F F is bounded by ∣ E F ∣ ∈ O ~ ( n ) |E_F| \in\widetilde{O}(n) ∣ E F ∣ ∈ O ( n ) .
Proof. By the definition of the skeleton graph in Definition 3.1, we may denote the number of vertices in the skeleton graph G S G_S G S as ∣ V S ∣ ≤ ( C S ⋅ n log k ) / k = C S ( c / 4 ) ( n 1 − ( c / 4 ) ⋅ log n ) |V_S| \le(C_S \cdot n \log k)/k = C_S(c/4) \left(n^{1-(c/4)} \cdot\log n\right) ∣ V S ∣ ≤ ( C S ⋅ n log k ) / k = C S ( c /4 ) ( n 1 − ( c /4 ) ⋅ log n ) , where k = n c / 4 k = n^{c/4} k = n c /4 and C S C_S C S is the constant defined in Definition 3.1. Additionally by Step 3 of the algorithm, we may denote the number of edges in the graph F F F as ∣ E F ∣ ≤ C 1 ⋅ ∣ V S ∣ 1 + c / 4 log C 2 n |E_F| \le C_1 \cdot|V_S|^{1+c/4}\log^{C_2} n ∣ E F ∣ ≤ C 1 ⋅ ∣ V S ∣ 1 + c /4 log C 2 n , where C 1 , C 2 C_1,C_2 C 1 , C 2 are suitable constants. We find that
∣ E F ∣ ≤ C 1 ⋅ ∣ V S ∣ 1 + c / 4 log C 2 n ≤ C 1 ⋅ [ C S ⋅ c log n 4 ] 1 + c / 4 ⋅ ( n 1 − ( c / 4 ) ) 1 + c / 4 log C 2 n = C 1 ⋅ [ C S ⋅ c log n 4 ] 1 + c / 4 ⋅ n 1 − ( c / 4 ) 2 log C 2 n . \begin{aligned}
|E_F| &\le C_1 \cdot|V_S|^{1+c/4}\log^{C_2} n \\
&\le C_1 \cdot\left[\frac{C_S \cdot c\log n}{4}\right]^{1+c/4} \cdot\left(n^{1-(c/4)}\right)^{1+c/4}\log^{C_2} n \\
&= C_1 \cdot\left[\frac{C_S \cdot c\log n}{4}\right]^{1+c/4} \cdot n^{1-(c/4)^2}\log^{C_2} n.
\end{aligned} ∣ E F ∣ ≤ C 1 ⋅ ∣ V S ∣ 1 + c /4 log C 2 n ≤ C 1 ⋅ [ 4 C S ⋅ c log n ] 1 + c /4 ⋅ ( n 1 − ( c /4 ) ) 1 + c /4 log C 2 n = C 1 ⋅ [ 4 C S ⋅ c log n ] 1 + c /4 ⋅ n 1 − ( c /4 ) 2 log C 2 n .
Since we treat all other variables as constants except for n n n , we have that ∣ E F ∣ ∈ n ⋅ polylog ( n ) ⊆ O ~ ( n ) |E_F| \in n\cdot\operatorname{polylog}(n) \subseteq\widetilde{O}(n) ∣ E F ∣ ∈ n ⋅ polylog ( n ) ⊆ O ( n ) as desired.
We next show the round complexity of the algorithm.
Lemma 4.4. The above algorithm runs in O ( log a + log log n ) O(\log a+\log\log n) O ( log a + log log n ) rounds.
Proof. From the algorithm description, we observe that except for Step 1, all remaining steps run in O ( 1 ) O(1) O ( 1 ) rounds. It therefore suffices to show that Step 1 runs in O ( log a + log log n ) O(\log a+\log\log n) O ( log a + log log n ) rounds. Denoting g ( n ) ∈ poly ( n ) g(n) \in\operatorname{poly}(n) g ( n ) ∈ poly ( n ) as the upper bound of the edge weights in G G G , we find that the weighted diameter of G G G is at most d = ( n − 1 ) ⋅ g ( n ) ∈ poly ( n ) d=(n-1)\cdot g(n)\in\operatorname{poly}(n) d = ( n − 1 ) ⋅ g ( n ) ∈ poly ( n ) as any shortest path in G G G has at most n − 1 n-1 n − 1 edges. Therefore, Step 1 runs in O ( log a + log log d ) = O ( log a + log log n ) O(\log a+\log\log d)=O(\log a+\log\log n) O ( log a + log log d ) = O ( log a + log log n ) rounds as claimed.
Answering Queries. For any given source vertex u ∈ V u \in V u ∈ V and any other vertex v ∈ V v \in V v ∈ V , we consider all paths constructed as follows:
u → x ∈ V S u \to x \in V_S u → x ∈ V S using an edge in E k E_k E k ,
x ⇝ y ∈ V S x \leadsto y \in V_S x ⇝ y ∈ V S using a path in F F F , and lastly,
y → v y \to v y → v using another edge in E k E_k E k .
Given that v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) and u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) , we show by properties (P1) and (P2) in Definition 3.1 there must exist such a path that witnesses an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximation of the distance d G ( u , v ) d_G(u,v) d G ( u , v ) . More concretely, for any source vertex u ∈ V u \in V u ∈ V , consider the distance estimate δ u : V → R \delta_u: V \to\mathbb{R} δ u : V → R , defined as follows:
δ u ( v ) = min x , y ∈ V S ( ω E k ( u , x ) + d F ( x , y ) + ω E k ( y , v ) ) . \delta_u(v)=\min_{x,y\in V_S}\left(\omega_{E_k}(u,x)+d_F(x,y)+\omega_{E_k}(y,v)\right). δ u ( v ) = x , y ∈ V S min ( ω E k ( u , x ) + d F ( x , y ) + ω E k ( y , v ) ) .
We first show an upper bound for the estimate δ u \delta_u δ u .
Lemma 4.5. For all vertices v ∈ V v \in V v ∈ V such that v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) and u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) , the estimate δ u ( v ) \delta_u(v) δ u ( v ) is at most O ( 1 / c ) ⋅ d G ( u , v ) O(1/c) \cdot d_G(u,v) O ( 1/ c ) ⋅ d G ( u , v ) .
Proof. We first consider the path P P P from u u u to v v v which has the properties (P1) and (P2) as defined in Definition 3.1, and denote P P P as u → u ∗ ⇝ v ∗ → v u \to u^* \rightsquigarrow v^* \to v u → u ∗ ⇝ v ∗ → v . Additionally, we denote the edges u → u ∗ u \to u^* u → u ∗ and v ∗ → v v^* \to v v ∗ → v as e 1 e_1 e 1 and e 2 e_2 e 2 respectively, and denote the subpath from u ∗ ⇝ v ∗ u^* \rightsquigarrow v^* u ∗ ⇝ v ∗ in P P P as Q Q Q .
Recall from property (P1) that ω ( P ) ≤ 7 ⋅ d G ( u , v ) \omega(P) \le7 \cdot d_G(u,v) ω ( P ) ≤ 7 ⋅ d G ( u , v ) . Moreover, recall from property (P2) that e 1 , e 2 ∈ E k e_1,e_2 \in E_k e 1 , e 2 ∈ E k , and that Q Q Q is contained entirely in the graph G S G_S G S . In particular, there must exist a path Q ′ Q' Q ′ from u ∗ u^* u ∗ to v ∗ v^* v ∗ in F F F such that ω ( Q ′ ) ≤ C ( 4 / c ) ⋅ d G S ( u ∗ , v ∗ ) \omega(Q') \le C(4/c) \cdot d_{G_S}(u^*,v^*) ω ( Q ′ ) ≤ C ( 4/ c ) ⋅ d G S ( u ∗ , v ∗ ) (where C C C is a suitable constant). We are therefore able to bound δ u ( v ) \delta_u(v) δ u ( v ) as
δ u ( v ) ≤ ω ( e 1 ) + ω ( Q ′ ) + ω ( e 2 ) ≤ ω ( e 1 ) + C ( 4 / c ) ⋅ d G S ( u ∗ , v ∗ ) + ω ( e 2 ) ≤ ω ( e 1 ) + C ( 4 / c ) ⋅ ω ( Q ) + ω ( e 2 ) ≤ C ( 4 / c ) ⋅ ( ω ( e 1 ) + ω ( Q ) + ω ( e 2 ) ) = C ( 4 / c ) ⋅ ω ( P ) ≤ 7 C ( 4 / c ) ⋅ d G ( u , v ) \begin{aligned}
\delta_u(v) &\le\omega(e_1) + \omega(Q') + \omega(e_2) \\
&\le\omega(e_1) + C(4/c) \cdot d_{G_S}(u^*,v^*) + \omega(e_2) \\
&\le\omega(e_1) + C(4/c) \cdot\omega(Q) + \omega(e_2) \\
&\le C(4/c) \cdot\left(\omega(e_1) + \omega(Q) + \omega(e_2)\right) \\
&= C(4/c) \cdot\omega(P) \\
&\le7C(4/c) \cdot d_G(u,v)
\end{aligned} δ u ( v ) ≤ ω ( e 1 ) + ω ( Q ′ ) + ω ( e 2 ) ≤ ω ( e 1 ) + C ( 4/ c ) ⋅ d G S ( u ∗ , v ∗ ) + ω ( e 2 ) ≤ ω ( e 1 ) + C ( 4/ c ) ⋅ ω ( Q ) + ω ( e 2 ) ≤ C ( 4/ c ) ⋅ ( ω ( e 1 ) + ω ( Q ) + ω ( e 2 ) ) = C ( 4/ c ) ⋅ ω ( P ) ≤ 7 C ( 4/ c ) ⋅ d G ( u , v ) The desired claim follows.
We next show how to compute the estimates δ u \delta_u δ u . Since the algorithm itself does not require any new techniques, we only emphasise the important points for the sake of presentation.
Lemma 4.6. There exists a deterministic algorithm for constructing the values δ u ( v ) \delta_u(v) δ u ( v ) for all v ∈ V v \in V v ∈ V in O ( 1 ) O(1) O ( 1 ) rounds.
Proof. Computation of the values δ u ( v ) \delta_u(v) δ u ( v ) is broken up into two parts: For every vertex y ∈ V S y \in V_S y ∈ V S , we first compute the values
Δ u ( y ) = min x ∈ V S ( ω E k ( u , x ) + d F ( x , y ) ) . \Delta_u(y) = \min_{x \in V_S} \left(\omega_{E_k}(u,x) + d_F(x,y)\right). Δ u ( y ) = x ∈ V S min ( ω E k ( u , x ) + d F ( x , y ) ) . which describe the length of the path u → x ⇝ y u \to x \rightsquigarrow y u → x ⇝ y . Subsequently, for every vertex v ∈ V v \in V v ∈ V , we compute the values
Δ u ′ ( v ) = min y ∈ V S ( Δ u ( y ) + ω E k ( y , v ) ) . \Delta'_u(v) = \min_{y \in V_S} \left(\Delta_u(y) + \omega_{E_k}(y,v)\right). Δ u ′ ( v ) = y ∈ V S min ( Δ u ( y ) + ω E k ( y , v ) ) . which now fully describe the length of the path u → x ⇝ y → v u \to x \rightsquigarrow y \to v u → x ⇝ y → v . By definition, we observe that Δ u ′ ( v ) = δ u ( v ) \Delta'_u(v) = \delta_u(v) Δ u ′ ( v ) = δ u ( v ) for all vertices v ∈ V v \in V v ∈ V .
We now describe the MPC algorithm: For readability, we describe only the essential details. Below, we recall that M ∗ M^* M ∗ refers to the single near-linear memory machine.
For every vertex x ∈ V S x \in V_S x ∈ V S such that { u , x } ∈ E k \{u,x\} \in E_k { u , x } ∈ E k , we send the value ( x , ω E k ( u , x ) ) (x,\omega_{E_k}(u,x)) ( x , ω E k ( u , x )) to the machine M ∗ M^* M ∗ . Observe that there are at most n n n such values, and therefore we have sufficient local memory in M ∗ M^* M ∗ . This requires O ( 1 ) O(1) O ( 1 ) rounds.
For every vertex y ∈ V S y \in V_S y ∈ V S , M ∗ M^* M ∗ locally computes the values Δ u ( y ) \Delta_u(y) Δ u ( y ) . This requires no communication rounds.
For every vertex y ∈ V S y \in V_S y ∈ V S and v ∈ V v \in V v ∈ V such that { y , v } ∈ E k \{y,v\} \in E_k { y , v } ∈ E k , we label the edge { y , v } \{y,v\} { y , v } with the value Δ u ( y ) \Delta_u(y) Δ u ( y ) . Using the MPC tools in Lemma 2.5 (namely sorting and broadcasting), this requires O ( 1 ) O(1) O ( 1 ) rounds.
For every vertex v ∈ V v \in V v ∈ V , we now compute the values Δ u ′ ( v ) \Delta'_u(v) Δ u ′ ( v ) . Using the MPC tools in Lemma 2.5 , this also requires O ( 1 ) O(1) O ( 1 ) rounds.
Overall, we require only O ( 1 ) O(1) O ( 1 ) rounds as claimed.
We now summarise the previous two results in the following lemma.
Lemma 4.7. Given the edge set E k E_k E k stored across the machines and the spanner F F F stored entirely on the machine M ∗ M^* M ∗ , we can answer O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate SSSP queries in O ( 1 ) O(1) O ( 1 ) rounds.
Proof. For a given SSSP query u ∈ V u \in V u ∈ V , we first construct the values δ u ( v ) \delta_u(v) δ u ( v ) for all vertices v ∈ V v \in V v ∈ V in O ( 1 ) O(1) O ( 1 ) rounds using Lemma 4.6 . For every vertex v ∈ V v \in V v ∈ V , we separate them into two cases:
Case 1: v ∈ N k ( u ) v \in N_k(u) v ∈ N k ( u ) or u ∈ N k ( v ) u \in N_k(v) u ∈ N k ( v ) . By definition of E k E_k E k , there must exist an edge { u , v } ∈ E k \{u,v\} \in E_k { u , v } ∈ E k . It therefore suffices to return the edge weight ω E k ( u , v ) = d G ( u , v ) \omega_{E_k}(u,v) = d_G(u,v) ω E k ( u , v ) = d G ( u , v ) .
Case 2: v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) and u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) . We return the value δ u ( v ) \delta_u(v) δ u ( v ) . By Lemma 4.5 , we have that δ u ( v ) ≤ O ( 1 / c ) ⋅ d G ( u , v ) \delta_u(v) \le O(1/c) \cdot d_G(u,v) δ u ( v ) ≤ O ( 1/ c ) ⋅ d G ( u , v ) . Additionally, for any vertices x , y ∈ V S x,y \in V_S x , y ∈ V S , we have
d F ( x , y ) ≥ d G S ( x , y ) ≥ d G ( x , y ) d_F(x,y) \ge d_{G_S}(x,y) \ge d_G(x,y) d F ( x , y ) ≥ d G S ( x , y ) ≥ d G ( x , y )
by definition of the skeleton graph in Definition 3.1. Thus, we necessarily have that δ u ( v ) ≥ d G ( u , v ) \delta_u(v) \ge d_G(u,v) δ u ( v ) ≥ d G ( u , v ) as well.
In other words, it suffices to return the value min ( ω E k ( u , v ) , δ u ( v ) ) \min(\omega_{E_k}(u,v),\delta_u(v)) min ( ω E k ( u , v ) , δ u ( v )) for all vertices v ∈ V v \in V v ∈ V , which always gives an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximation of the distance d G ( u , v ) d_G(u,v) d G ( u , v ) as desired.
The Final Proof. We summarise this section on correctness with the following proof for Lemma 4.2 .
Proof of Lemma 4.2. We execute the algorithm described in § 4.1.1 to construct the edge set E k E_k E k and the spanner graph F F F , the latter of which is stored on the single near-linear machine M ∗ M^* M ∗ . By Lemma 4.4 , this requires O ( log a + log log n ) O(\log a + \log\log n) O ( log a + log log n ) rounds. Furthermore, from the algorithm description, observe that the algorithm requires only O ~ ( n 1 + c ) \widetilde{O}(n^{1+c}) O ( n 1 + c ) total memory. Lastly applying Lemma 4.7 , we find that this construction suffices as an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate SSSP oracle with a query time of O ( 1 ) O(1) O ( 1 ) rounds.
The Near-Linear MPC Model
In this section, we aim to prove Theorem 1 . Namely, we will describe an algorithm for constructing O ( log n ) O(\log n) O ( log n ) -approximate k k k -nearest neighbourhoods for all vertices, from which a direct application of Lemma 4.2 will give our desired claim.
Finding Approximate Neighbourhoods. In order to construct O ( log n ) O(\log n) O ( log n ) -approximate neighbourhoods, we construct an O ( log n ) O(\log n) O ( log n ) -spanner of near-linear size which can be done in O ( 1 ) O(1) O ( 1 ) rounds. The entire spanner can be stored on every machine, which enables us to determine the k k k -nearest neighbourhoods of every vertex in the spanner – these suffice as O ( log n ) O(\log n) O ( log n ) -approximate k k k -nearest neighbourhoods for the original graph . We formalise this idea in the following lemma.
Lemma 4.8. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices and let integer k > 0 k>0 k > 0 be a parameter. In the near-linear MPC model with O ~ ( ∣ E ∣ + n k ) \widetilde{O}(|E|+nk) O ( ∣ E ∣ + nk ) total memory, there exists a randomised algorithm that w.h.p. constructs the set { ( u , t ) : u ∈ V ∧ t ∈ N ~ k ( u ) } \{(u,t):u\in V\wedge t\in\widetilde{N}_k(u)\} {( u , t ) : u ∈ V ∧ t ∈ N k ( u )} where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an O ( log n ) O(\log n) O ( log n ) -approximate k k k -nearest neighbourhood of u u u . This algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds.
Proof. Using Lemma 2.4 with t = log n t=\log n t = log n , we construct an O ( log n ) O(\log n) O ( log n ) -spanner H H H of size O ~ ( n ) \widetilde{O}(n) O ( n ) in O ( 1 ) O(1) O ( 1 ) rounds. We collect the spanner H H H onto a single machine, which we then broadcast to every machine using Lemma 2.5 . In other words, after O ( 1 ) O(1) O ( 1 ) rounds, every machine now knows the entire spanner H H H .
What remains is to construct the k k k -nearest neighbourhood N k ( u ) N_k(u) N k ( u ) of every vertex u ∈ V u\in V u ∈ V in the spanner H H H , which suffices as our O ( log n ) O(\log n) O ( log n ) -approximate k k k -nearest neighbourhoods in G G G . This is done by a delegation of tasks: The machine with ID 1 determines the neighbourhoods for the first n / k n/k n / k vertices, the machine with ID 2 determines the neighbourhoods for the next n / k n/k n / k vertices, and so on. Since the size of each set ∣ N k ( u ) ∣ ≤ k |N_k(u)|\leq k ∣ N k ( u ) ∣ ≤ k by definition, this requires only O ( n ) O(n) O ( n ) memory per machine. Moreover, we only need O ( n k ) O(nk) O ( nk ) total memory to fully compute the sets N k ( u ) N_k(u) N k ( u ) for all n n n vertices, and therefore the total memory of O ~ ( ∣ E ∣ + n k ) \widetilde{O}(|E|+nk) O ( ∣ E ∣ + nk ) suffices. Additionally, since only local computation is needed, this requires no rounds of communication.
We are now ready to prove Theorem 1 . By applying Lemma 4.8 and subsequently Lemma 4.2 , we get the desired result.
Proof of Theorem 1 . By Lemma 2.6 , we may assume that G G G is a connected graph. We first apply the spanner construction in Lemma 2.4 (setting t = 2 / c t=2/c t = 2/ c ) to construct an O ( 2 / c ) O(2/c) O ( 2/ c ) -spanner G ′ G' G ′ for G G G of size O ~ ( n 1 + c / 2 ) \widetilde{O}(n^{1+c/2}) O ( n 1 + c /2 ) in O ( 1 ) O(1) O ( 1 ) rounds. We now apply Lemma 4.8 on G ′ G' G ′ to construct a a = O ( log n ) a=O(\log n) a = O ( log n ) -approximate k = n c / 4 k=n^{c/4} k = n c /4 -nearest neighbourhoods N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) for all vertices u ∈ V u\in V u ∈ V in G ′ G' G ′ using another O ( 1 ) O(1) O ( 1 ) rounds. Lastly, we apply Lemma 4.2 , which constructs an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate SSSP oracle for G ′ G' G ′ in O ( log a + log log n ) = O ( log log n ) O(\log a+\log\log n)=O(\log\log n) O ( log a + log log n ) = O ( log log n ) rounds. In total, we require O ~ ( ∣ E ∣ + n 1 + c ) \widetilde{O}(|E|+n^{1+c}) O ( ∣ E ∣ + n 1 + c ) memory across all steps.
Since G ′ G' G ′ is an O ( 2 / c ) O(2/c) O ( 2/ c ) -spanner for G G G , an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate SSSP oracle for G ′ G' G ′ directly gives an O ( 1 / c 2 ) O(1/c^2) O ( 1/ c 2 ) -approximate SSSP oracle for G G G , and we are done.
The Heterogeneous MPC Model
Similar to the near-linear MPC regime, in this section we propose a fast method for constructing approximate k k k -nearest neighbourhoods, which together with Lemma 4.2 , gives the final oracle construction. However, instead of constructing an O ( log n ) O(\log n) O ( log n ) -spanner that is distributed to all machines, we instead construct a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator, which we show can be done in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds. On this emulator we apply Lemma 3.4 to obtain ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -approximate k k k -nearest neighbourhoods. We will show that this approximation ratio is sufficient for us to apply Lemma 4.2 and construct the SSSP oracle using O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds overall.
High Level Idea. We iteratively construct a series of skeleton graphs G = G 0 , G 1 , G 2 , … G=G_0,G_1,G_2,\ldots G = G 0 , G 1 , G 2 , … until the final skeleton graph G ℓ G_\ell G ℓ is small enough that all-pairs distances can be determined entirely locally. The edges of our emulator H H H then consist of the following:
By choosing an appropriate sequence of polynomially increasing { k i } \{k_i\} { k i } , we show that each iteration requires only O ( log log n ) O(\log\log n) O ( log log n ) rounds and that we require at most ℓ ∈ O ( log log n ) \ell\in O(\log\log n) ℓ ∈ O ( log log n ) iterations. Consequently, we show that H H H is a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch, O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator for the input graph G G G which can be constructed in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
Before stating the lemma, there are some minor implementation details to take note of:
We sparsify the skeleton graph G i G_i G i into a spanner G i ′ G'_i G i ′ at the start of each iteration. This is to ensure that the number of edges in G i ′ G'_i G i ′ is well-bounded. As long as the spanner also maintains a constant approximation of distances, this will not affect the stretch analysis of the algorithm up-to a constant factor (in the exponent of the stretch term).
The sequence { k i } \{k_i\} { k i } increases polynomially until it reaches a small polynomial in n n n . Namely, once k ∈ n O ( γ ) k \in n^{O(\gamma)} k ∈ n O ( γ ) , we maintain k k k at this value until the termination condition. This is to ensure we never exceed the local computation capabilities of the machines.
Following from the above discussion, we will now prove the following lemma.
Lemma 4.9. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices. In the heterogeneous MPC model with O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory, there exists a randomised algorithm that w.h.p. constructs a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch, O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator H H H in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
We first state the algorithm description in § 4.3.1 before showing the correctness of the algorithm in § 4.3.2 .
Algorithm Description
As input, we are given the weighted n n n -vertex graph G = ( V , E ) G=(V,E) G = ( V , E ) , whose edge weights are initially polynomially-bounded. We begin with G 0 = G G_0=G G 0 = G and an empty edge set H = ∅ H=\varnothing H = ∅ . We first define the sequence { k i } \{k_i\} { k i } for all integers i ∈ { 0 , 1 , 2 , … } i\in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } recursively as follows:
k 0 = log n , k_0=\log n, k 0 = log n ,
k i = min [ k i − 1 1.99 C S , n γ / 4 ] , k_i=\min\left[\frac{k_{i-1}^{1.99}}{C_S},n^{\gamma/4}\right], k i = min [ C S k i − 1 1.99 , n γ /4 ] ,
where C S C_S C S is the constant defined in Definition 3.1.
During iteration i ∈ { 0 , 1 , 2 , … } i\in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } , we start with the graph G i = ( V i , E i ) G_i=(V_i,E_i) G i = ( V i , E i ) and parameter k i k_i k i . Assume that k i ⋅ ∣ V i ∣ ∈ O ( n log n ) k_i\cdot|V_i|\in O(n\log n) k i ⋅ ∣ V i ∣ ∈ O ( n log n ) ; we justify this assumption in Lemma 4.10 . We also assume that G i G_i G i is connected; this is justified in Lemma 4.11 . Lastly, we may assume that ∣ V i ∣ ≤ n |V_i|\le n ∣ V i ∣ ≤ n ; this is clear in the following algorithm description. The edges of G i G_i G i are stored arbitrarily across all the machines.
Step 1: Sparsify G i G_i G i . We first sparsify G i G_i G i into a spanner graph G i ′ = ( V i , E i ′ ) G'_i=(V_i,E'_i) G i ′ = ( V i , E i ′ ) . Namely, we apply Lemma 2.4 on G i G_i G i with t = 2 / γ t=2/\gamma t = 2/ γ to obtain a C ( 2 / γ ) C(2/\gamma) C ( 2/ γ ) -spanner of size ∣ E i ′ ∣ ∈ O ~ ( n 1 + γ / 2 ) |E'_i|\in\widetilde{O}(n^{1+\gamma/2}) ∣ E i ′ ∣ ∈ O ( n 1 + γ /2 ) in O ( 1 ) O(1) O ( 1 ) rounds, where C C C is a suitable constant. In all subsequent steps, we will work directly with the graph G i ′ G'_i G i ′ rather than G i G_i G i .
Step 2: Get Approximate k i k_i k i -Nearest. Our goal for this step is to obtain O ( log n ) O(\log n) O ( log n ) -approximate k i k_i k i -nearest neighbourhoods for all vertices in V i V_i V i . We accomplish this in the following manner:
We first apply Lemma 2.4 on G i ′ G'_i G i ′ with t = log ∣ V i ∣ t=\log|V_i| t = log ∣ V i ∣ to obtain an O ( log ∣ V i ∣ ) ⊆ O ( log n ) O(\log|V_i|)\subseteq O(\log n) O ( log ∣ V i ∣ ) ⊆ O ( log n ) -spanner S S S of size O ~ ( ∣ V i ∣ ) ⊆ O ~ ( n ) \widetilde{O}(|V_i|)\subseteq\widetilde{O}(n) O ( ∣ V i ∣ ) ⊆ O ( n ) in O ( 1 ) O(1) O ( 1 ) rounds.
Since the size of S S S is O ~ ( n ) \widetilde{O}(n) O ( n ) , we can collect the spanner S S S onto the single near-linear memory machine M ∗ M^* M ∗ .
Locally, M ∗ M^* M ∗ constructs the k i k_i k i -nearest neighbourhoods N k i ( u ) N_{k_i}(u) N k i ( u ) for every vertex u ∈ V i u \in V_i u ∈ V i in the spanner S S S – these suffice as O ( log n ) O(\log n) O ( log n ) -approximate k i k_i k i -nearest neighbourhoods in the graph G i ′ G'_i G i ′ . By our previous assumption, we have k i ⋅ ∣ V i ∣ ∈ O ( n log n ) k_i \cdot|V_i| \in O(n \log n) k i ⋅ ∣ V i ∣ ∈ O ( n log n ) , and this therefore fits within the local memory constraints of M ∗ M^* M ∗ .
At the end of this step, we now have O ( log n ) O(\log n) O ( log n ) -approximate k i k_i k i -nearest neighbourhoods N ~ k i ( u ) \widetilde{N}_{k_i}(u) N k i ( u ) for all vertices u ∈ V i u \in V_i u ∈ V i . This step runs in O ( 1 ) O(1) O ( 1 ) rounds.
Step 3: Get Exact k i k_i k i -Nearest. Now that we have constructed a = O ( log n ) = O(\log n) = O ( log n ) -approximate k i k_i k i -nearest neighbourhoods, we can find the exact k i k_i k i -nearest neighbourhoods for all vertices in V i V_i V i . Namely, since k i 2 ≤ n γ / 2 ≤ n γ k_i^2 \le n^{\gamma/2} \le n^\gamma k i 2 ≤ n γ /2 ≤ n γ , we can apply Lemma 4.1 on G i ′ G'_i G i ′ with parameter k = k i k = k_i k = k i . This constructs the k i k_i k i -nearest edge set E k i E_{k_i} E k i for G i ′ G'_i G i ′ .
Denoting d i d_i d i as the weighted diameter of G i ′ G'_i G i ′ , this step runs in O ( log a + log log d i ) ⊆ O ( log log n + log log d i ) O(\log a + \log\log d_i) \subseteq O(\log\log n + \log\log d_i) O ( log a + log log d i ) ⊆ O ( log log n + log log d i ) rounds. This step requires O ~ ( ∣ E i ′ ∣ + n k i 2 ) = O ~ ( n 1 + γ / 2 ) \widetilde{O}(|E'_i| + nk_i^2) = \widetilde{O}(n^{1+\gamma/2}) O ( ∣ E i ′ ∣ + n k i 2 ) = O ( n 1 + γ /2 ) total memory.
Step 4: Add Edges to H H H . We add the edge set E k i E_{k_i} E k i to H H H . That is, H : = H ∪ E k i H := H \cup E_{k_i} H := H ∪ E k i .
Step 5: Construct Skeleton Graph. We apply Lemma 3.2 on G i ′ G'_i G i ′ (with k = k i k = k_i k = k i ) to obtain the skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) . We set G i + 1 : = G S G_{i+1} := G_S G i + 1 := G S and proceed to the next iteration. This step runs in O ( 1 ) O(1) O ( 1 ) rounds. This step requires O ~ ( ∣ E i ′ ∣ k i 2 ) ⊆ O ~ ( n 1 + γ / 2 ⋅ n γ / 2 ) = O ~ ( n 1 + γ ) \widetilde{O}(|E'_i|k_i^2) \subseteq\widetilde{O}(n^{1+\gamma/2} \cdot n^{\gamma/2}) = \widetilde{O}(n^{1+\gamma}) O ( ∣ E i ′ ∣ k i 2 ) ⊆ O ( n 1 + γ /2 ⋅ n γ /2 ) = O ( n 1 + γ ) total memory.
Termination. We terminate at iteration ℓ \ell ℓ once the graph G ℓ = ( V ℓ , E ℓ ) G_\ell= (V_\ell, E_\ell) G ℓ = ( V ℓ , E ℓ ) is sufficiently small such that ∣ V ℓ ∣ 2 ∈ O ( n ) |V_\ell|^2 \in O(n) ∣ V ℓ ∣ 2 ∈ O ( n ) . We collect G ℓ G_\ell G ℓ onto the single near-linear memory machine M ∗ M^* M ∗ , which determines all-pairs distances for vertices in G ℓ G_\ell G ℓ . An edge for every pair of vertices in V ℓ V_\ell V ℓ is then added into the edge set H H H with the shortest-path distances as the edge weights. (i.e., H : = H ∪ { { u , v } : u , v ∈ V ℓ } H := H \cup\{\{u,v\}: u,v \in V_\ell\} H := H ∪ {{ u , v } : u , v ∈ V ℓ } with edge weights d G ℓ ( u , v ) d_{G_\ell}(u,v) d G ℓ ( u , v ) ). This concludes the construction, and the final edge set H H H is our emulator.
Correctness
We first justify our claims that k i ∣ V i ∣ = O ( n log n ) k_i|V_i| = O(n \log n) k i ∣ V i ∣ = O ( n log n ) and G i G_i G i is connected for all iterations i i i . We may assume that n n n is sufficiently large such that k i 0.01 ≥ log k i k_i^{0.01} \ge\log k_i k i 0.01 ≥ log k i always.
Lemma 4.10. For all i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } , we have k i ∣ V i ∣ ≤ n log n k_i|V_i| \le n \log n k i ∣ V i ∣ ≤ n log n .
Proof. We prove by induction on i i i . For the base case i = 0 i = 0 i = 0 , we have k 0 = log n k_0 = \log n k 0 = log n and ∣ V 0 ∣ = n |V_0| = n ∣ V 0 ∣ = n , and therefore k 0 ∣ V 0 ∣ = n log n k_0|V_0| = n \log n k 0 ∣ V 0 ∣ = n log n as desired. Proceeding to the inductive case: Suppose the claim holds for iteration i = j i = j i = j . Recalling Step 5 of the algorithm and the skeleton graph definition in Definition 3.1, we observe that ∣ V j + 1 ∣ ≤ ( C S ∣ V j ∣ log k j ) / k j |V_{j+1}| \le(C_S|V_j|\log k_j)/k_j ∣ V j + 1 ∣ ≤ ( C S ∣ V j ∣ log k j ) / k j . Additionally, we have that k j + 1 ≤ k j 1.99 / C S k_{j+1} \le k_j^{1.99}/C_S k j + 1 ≤ k j 1.99 / C S by construction. Therefore, applying our induction hypothesis,
k j + 1 ∣ V j + 1 ∣ ≤ k j 1.99 C S ( C S ∣ V j ∣ log k j k j ) ≤ k j 1.99 ( ∣ V j ∣ k j 0.01 k j ) = k j ∣ V j ∣ ≤ n log n . k_{j+1}|V_{j+1}| \le\frac{k_j^{1.99}}{C_S}\left(\frac{C_S|V_j|\log k_j}{k_j}\right) \le k_j^{1.99}\left(\frac{|V_j|k_j^{0.01}}{k_j}\right) = k_j|V_j| \le n\log n. k j + 1 ∣ V j + 1 ∣ ≤ C S k j 1.99 ( k j C S ∣ V j ∣ log k j ) ≤ k j 1.99 ( k j ∣ V j ∣ k j 0.01 ) = k j ∣ V j ∣ ≤ n log n .
:::
Lemma 4.11. For all i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } , the graph G i G_i G i is connected.
Proof. This is proved straightforwardly using induction. In the base case, we have that G 0 G_0 G 0 is connected by the input assumptions. In the inductive case, supposing G j G_j G j is connected for some j ≥ 0 j \ge0 j ≥ 0 , the properties of spanners and skeleton graphs (Definition 3.1) ensure that G j ′ G'_j G j ′ is connected, and therefore G j + 1 G_{j+1} G j + 1 is also connected.
Organisation. For the remainder of the section on correctness, it is convenient to describe the algorithm in terms of phases. In particular, we define the first phase and second phase as follows:
First Phase: This phase consists of the iterations where k i < n γ / 4 k_i < n^{\gamma/4} k i < n γ /4 .
Second Phase: This phase consists of the remaining iterations where k i = n γ / 4 k_i = n^{\gamma/4} k i = n γ /4 , up until iteration i = ℓ i = \ell i = ℓ when the termination condition is satisfied. In particular, denote i = ℓ ∗ i = \ell^* i = ℓ ∗ as the first iteration for which k ℓ ∗ = n γ / 4 k_{\ell^*} = n^{\gamma/4} k ℓ ∗ = n γ /4 .
We present the proof of correctness in three parts:
We first show that the algorithm terminates in O ( log log n ) O(\log\log n) O ( log log n ) iterations. In particular, we will show that the first phase requires O ( log log n ) O(\log\log n) O ( log log n ) iterations while the second phase only requires O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) iterations.
We next show that each iteration runs in O ( log log n ) O(\log\log n) O ( log log n ) rounds. The crux of the argument is to show that for both the first and second phases, the edge weights of all graphs G i G_i G i are bounded by poly ( n ) \operatorname{poly}(n) poly ( n ) .
Lastly, we show that H H H is indeed a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch and O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator for the input graph G G G .
For convenience and ease of presentation, we assume that the constant C S C_S C S defined in Definition 3.1 is at least unity, i.e., C S ≥ 1 C_S \ge1 C S ≥ 1 ; the case in which C S < 1 C_S < 1 C S < 1 is argued similarly.
Number of Iterations. We first argue that the first phase requires only O ( log log n ) O(\log\log n) O ( log log n ) iterations.
Lemma 4.12. ℓ ∗ ∈ O ( log log n ) \ell^* \in O(\log\log n) ℓ ∗ ∈ O ( log log n ) .
Proof. Let p = 1.99 p = 1.99 p = 1.99 . By the definition of k i k_i k i , observe that for all iterations i < ℓ ∗ i < \ell^* i < ℓ ∗ , we have
k i = ( 1 C S ) p i − 1 p − 1 ⋅ ( log n ) p i ≥ [ ( 1 C S ) 1 p − 1 ⋅ ( log n ) ] p i , k_i = \left(\frac{1}{C_S}\right)^{\frac{p^i-1}{p-1}} \cdot(\log n)^{p^i} \ge\left[\left(\frac{1}{C_S}\right)^{\frac{1}{p-1}} \cdot(\log n)\right]^{p^i}, k i = ( C S 1 ) p − 1 p i − 1 ⋅ ( log n ) p i ≥ [ ( C S 1 ) p − 1 1 ⋅ ( log n ) ] p i , using the fact that C S ≥ 1 C_S \ge1 C S ≥ 1 . Therefore, after
i min = 1 log p ⋅ log [ γ log n 4 log ( C S 1 / ( 1 − p ) log n ) ] ∈ O ( log log n ) i_{\min} = \frac{1}{\log p} \cdot\log\left[\frac{\gamma\log n}{4\log(C_S^{1/(1-p)}\log n)}\right] \in O(\log\log n) i m i n = log p 1 ⋅ log [ 4 log ( C S 1/ ( 1 − p ) log n ) γ log n ] ∈ O ( log log n ) iterations, we necessarily have that k i min ≥ n γ / 4 k_{i_{\min}} \ge n^{\gamma/4} k i m i n ≥ n γ /4 . It follows that ℓ ∗ ∈ O ( log log n ) \ell^* \in O(\log\log n) ℓ ∗ ∈ O ( log log n ) as claimed.
Proceeding to the second phase, observe that the number of vertices reduces roughly by a factor of n γ / 4 n^{\gamma/4} n γ /4 between iterations. Accounting for the additional log factor, we first provide an upper bound on the number of vertices V i V_i V i . Subsequently, we show that this phase requires only O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) iterations.
Lemma 4.13. For all i ∈ { 0 , 1 , 2 , … , ℓ − ℓ ∗ } i \in\{0,1,2,\ldots,\ell-\ell^*\} i ∈ { 0 , 1 , 2 , … , ℓ − ℓ ∗ } , we have that
∣ V i + ℓ ∗ ∣ ≤ C S i ( γ 4 ) i ⋅ n 1 − ( i γ / 4 ) log i n , |V_{i+\ell^*}| \le C_S^i \left(\frac{\gamma}{4}\right)^i \cdot n^{1-(i\gamma/4)}\log^i n, ∣ V i + ℓ ∗ ∣ ≤ C S i ( 4 γ ) i ⋅ n 1 − ( iγ /4 ) log i n , where C S C_S C S is the constant as defined in Definition 3.1.
Proof. We prove by induction on i i i . In the base case of i = 0 i=0 i = 0 , we have ∣ V ℓ ∗ ∣ ≤ n |V_{\ell^*}| \le n ∣ V ℓ ∗ ∣ ≤ n as expected. Consider now the inductive case: Suppose the claim holds for i = j i=j i = j . Recalling the skeleton graph definition in Definition 3.1, we observe that ∣ V j + 1 + ℓ ∗ ∣ ≤ ( C S ⋅ ∣ V j + ℓ ∗ ∣ / k j + ℓ ∗ ) log k j + ℓ ∗ |V_{j+1+\ell^*}| \le(C_S \cdot|V_{j+\ell^*}|/k_{j+\ell^*})\log k_{j+\ell^*} ∣ V j + 1 + ℓ ∗ ∣ ≤ ( C S ⋅ ∣ V j + ℓ ∗ ∣/ k j + ℓ ∗ ) log k j + ℓ ∗ . Since we are in the second phase, we also have k j + ℓ ∗ = n γ / 4 k_{j+\ell^*}=n^{\gamma/4} k j + ℓ ∗ = n γ /4 . This allows us to invoke our induction hypothesis to obtain
∣ V j + 1 + ℓ ∗ ∣ ≤ C S [ ∣ V j + ℓ ∗ ∣ log ( n γ / 4 ) n γ / 4 ] ≤ C S [ log ( n γ / 4 ) n γ / 4 ] ⋅ [ C S j ( γ 4 ) j ⋅ n 1 − ( j γ / 4 ) log j n ] = C S j + 1 ( γ 4 ) j + 1 ⋅ n 1 − ( j + 1 ) γ / 4 log j + 1 n \begin{aligned}
|V_{j+1+\ell^*}| \le C_S \left[\frac{|V_{j+\ell^*}|\log(n^{\gamma/4})}{n^{\gamma/4}}\right] \\
&\le C_S \left[\frac{\log(n^{\gamma/4})}{n^{\gamma/4}}\right]\cdot\left[C_S^j\left(\frac{\gamma}{4}\right)^j\cdot n^{1-(j\gamma/4)}\log^j n\right] \\
&= C_S^{j+1}\left(\frac{\gamma}{4}\right)^{j+1}\cdot n^{1-(j+1)\gamma/4}\log^{j+1}n
\end{aligned} ∣ V j + 1 + ℓ ∗ ∣ ≤ C S [ n γ /4 ∣ V j + ℓ ∗ ∣ log ( n γ /4 ) ] ≤ C S [ n γ /4 log ( n γ /4 ) ] ⋅ [ C S j ( 4 γ ) j ⋅ n 1 − ( j γ /4 ) log j n ] = C S j + 1 ( 4 γ ) j + 1 ⋅ n 1 − ( j + 1 ) γ /4 log j + 1 n
as claimed.
We are now ready to bound the number of iterations in the second phase.
Lemma 4.14. After i ∈ O ( 1 / γ ) i \in O(1/\gamma) i ∈ O ( 1/ γ ) iterations in the second phase, we have ∣ V i + ℓ ∗ ∣ ∈ O ( n 1 / 2 ) |V_{i+\ell^*}| \in O(n^{1/2}) ∣ V i + ℓ ∗ ∣ ∈ O ( n 1/2 ) .
Proof. Observe that the terms ( γ / 4 ) i (\gamma/4)^i ( γ /4 ) i and log i n \log^i n log i n (in Lemma 4.13 ) are both asymptotically smaller than n ϵ ⋅ i n^{\epsilon\cdot i} n ϵ ⋅ i , for any constant ϵ > 0 \epsilon>0 ϵ > 0 . More concretely, we have
O ( C S i ⋅ ( γ / 4 ) i ⋅ log i n ) ⊆ O ( n ϵ ⋅ i ) O(C_S^i\cdot(\gamma/4)^i\cdot\log^i n)\subseteq O(n^{\epsilon\cdot i}) O ( C S i ⋅ ( γ /4 ) i ⋅ log i n ) ⊆ O ( n ϵ ⋅ i )
for any ϵ > 0 \epsilon>0 ϵ > 0 . Therefore, we may rewrite the bound in Lemma 4.13 as
∣ V i + ℓ ∗ ∣ ∈ O ( n 1 − ( γ / 4 − ϵ ) ⋅ i ) . |V_{i+\ell^*}| \in O(n^{1-(\gamma/4-\epsilon)\cdot i}). ∣ V i + ℓ ∗ ∣ ∈ O ( n 1 − ( γ /4 − ϵ ) ⋅ i ) .
Fixing say, ϵ = γ / 8 \epsilon=\gamma/8 ϵ = γ /8 , we get that after i ∈ O ( 1 / [ 2 ( γ / 4 − ϵ ) ] ) = O ( 1 / γ ) i\in O(1/[2(\gamma/4-\epsilon)])=O(1/\gamma) i ∈ O ( 1/ [ 2 ( γ /4 − ϵ )]) = O ( 1/ γ ) iterations in the second phase, we necessarily have ∣ V i + ℓ ∗ ∣ ∈ O ( n 1 / 2 ) |V_{i+\ell^*}|\in O(n^{1/2}) ∣ V i + ℓ ∗ ∣ ∈ O ( n 1/2 ) .
We are now ready to show that the entire algorithm terminates in O ( log log n + 1 / γ ) O(\log\log n+1/\gamma) O ( log log n + 1/ γ ) iterations. Namely, since the first phase requires O ( log log n ) O(\log\log n) O ( log log n ) iterations (Lemma 4.12 ) and the second phase requires O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) iterations (Lemma 4.14 ), we get the desired result.
Lemma 4.15. The entire algorithm runs in O ( log log n ) O(\log\log n) O ( log log n ) iterations.
Proof. By Lemma 4.12 , we observe that the first phase runs in O ( log log n ) O(\log\log n) O ( log log n ) iterations. Additionally, by Lemma 4.14 , we observe that after O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) iterations in the second phase, the termination condition is satisfied. Therefore in total, we require O ( log log n + 1 / γ ) ⊆ O ( log log n ) O(\log\log n+1/\gamma)\subseteq O(\log\log n) O ( log log n + 1/ γ ) ⊆ O ( log log n ) iterations across the entire algorithm.
Round Complexity. We first bound the edge weights of the graphs { G i } \{G_i\} { G i } in the first phase. We do this in the following manner: We first derive a crude bound for the edge weights (Lemma 4.16 ), and thereafter a bound for the values { k i } \{k_i\} { k i } (Lemma 4.17 ). Finally, this enables us to obtain a good bound for the edge weights in the first phase, where we show that d i ∈ poly ( n ) d_i \in\operatorname{poly}(n) d i ∈ poly ( n ) (Lemma 4.18 ).
Suppose the initial weights of the graph G = G 0 G = G_0 G = G 0 are bounded above by the function g 0 ( n ) = poly ( n ) g_0(n) = \operatorname{poly}(n) g 0 ( n ) = poly ( n ) . We begin with a crude, almost trivial bound for the edge weights. Note that in the following lemma, our induction begins with i = 1 i = 1 i = 1 instead of i = 0 i = 0 i = 0 for convenience.
Lemma 4.16. For all i ∈ { 1 , 2 , … , ℓ ∗ } i \in\{1,2,\ldots,\ell^*\} i ∈ { 1 , 2 , … , ℓ ∗ } , the weights of the graph G i G_i G i are bounded above by the function
g i ( n ) = ( ∏ j = 0 i − 1 3 k j ) ⋅ g 0 ( n ) . g_i(n) = \left(\prod_{j=0}^{i-1} 3k_j\right)\cdot g_0(n). g i ( n ) = ( j = 0 ∏ i − 1 3 k j ) ⋅ g 0 ( n ) . Proof. We prove by induction on i i i . In the base case i = 1 i = 1 i = 1 , recall that G 1 G_1 G 1 is a skeleton graph of G 0 ′ G'_0 G 0 ′ . Since the edge weights of G 0 ′ G'_0 G 0 ′ are bounded above by g 0 ( n ) g_0(n) g 0 ( n ) , recalling Definition 3.1, we find that the function g 1 ( n ) = 3 k 0 ⋅ g 0 ( n ) g_1(n) = 3k_0 \cdot g_0(n) g 1 ( n ) = 3 k 0 ⋅ g 0 ( n ) is a suitable upper bound for the weights of G 1 G_1 G 1 . The inductive case works similarly: Suppose the claim holds for i = j i = j i = j . Since G j + 1 G_{j+1} G j + 1 is a skeleton graph of G j ′ G'_j G j ′ , we have that the weights of G j + 1 G_{j+1} G j + 1 are bounded above by the function g j + 1 ( n ) = 3 k j ⋅ g j ( n ) g_{j+1}(n) = 3k_j \cdot g_j(n) g j + 1 ( n ) = 3 k j ⋅ g j ( n ) . Invoking our induction hypothesis, we therefore get the desired claim.
We now provide a bound for the values { k i } \{k_i\} { k i } in the first phase. Roughly speaking, we work backwards: Rather than starting our induction with k 0 = log n k_0 = \log n k 0 = log n , we start our induction instead with k ℓ ∗ − 1 ≤ n γ / 4 k_{\ell^*-1} \le n^{\gamma/4} k ℓ ∗ − 1 ≤ n γ /4 . This allows us to express our bound for k i k_i k i in terms of a small polynomial in n n n , which will be useful later on.
Lemma 4.17. Let p = 1.99 p = 1.99 p = 1.99 , and denote S i S_i S i as the geometric sum of i i i terms with common ratio and initial term 1 / p 1/p 1/ p . For i ∈ { 0 , 1 , 2 , … , ℓ ∗ − 1 } i \in\{0,1,2,\ldots,\ell^*-1\} i ∈ { 0 , 1 , 2 , … , ℓ ∗ − 1 } , we have
k i ≤ C S S ℓ ∗ − 1 − i ⋅ ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − i . k_i \le C_S^{S_{\ell^*-1-i}}\cdot(n^{\gamma/4})^{(1/p)^{\ell^*-1-i}}. k i ≤ C S S ℓ ∗ − 1 − i ⋅ ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − i . As a direct consequence, this implies that k i ≤ C S 1 / ( p − 1 ) ⋅ ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − i k_i \le C_S^{1/(p-1)}\cdot(n^{\gamma/4})^{(1/p)^{\ell^*-1-i}} k i ≤ C S 1/ ( p − 1 ) ⋅ ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − i .
Proof. We prove by induction on i i i , starting with i = ℓ ∗ − 1 i = \ell^* - 1 i = ℓ ∗ − 1 . For the base case i = ℓ ∗ − 1 i = \ell^* - 1 i = ℓ ∗ − 1 , we get that k ℓ ∗ − 1 ≤ n γ / 4 k_{\ell^*-1} \le n^{\gamma/4} k ℓ ∗ − 1 ≤ n γ /4 as S 0 = 0 S_0 = 0 S 0 = 0 , which agrees with the definition of { k i } \{k_i\} { k i } . Proceeding to the inductive case: Suppose the claim holds for i = j i = j i = j . We recall from our definition of k j k_j k j that k j − 1 = ( C S k j ) 1 / p k_{j-1} = (C_S k_j)^{1/p} k j − 1 = ( C S k j ) 1/ p . Therefore invoking our induction hypothesis, we have that
k j − 1 = ( C S k j ) 1 / p ≤ C S 1 / p ⋅ [ C S S ℓ ∗ − 1 − j ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − j ] 1 / p = C S S ℓ ∗ − ( j − 1 ) − 1 ( n γ / 4 ) ( 1 / p ) ℓ ∗ − ( j − 1 ) − 1 , k_{j-1} = (C_S k_j)^{1/p} \le C_S^{1/p}\cdot\left[C_S^{S_{\ell^*-1-j}}(n^{\gamma/4})^{(1/p)^{\ell^*-1-j}}\right]^{1/p} = C_S^{S_{\ell^*-(j-1)-1}}(n^{\gamma/4})^{(1/p)^{\ell^*-(j-1)-1}}, k j − 1 = ( C S k j ) 1/ p ≤ C S 1/ p ⋅ [ C S S ℓ ∗ − 1 − j ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − j ] 1/ p = C S S ℓ ∗ − ( j − 1 ) − 1 ( n γ /4 ) ( 1/ p ) ℓ ∗ − ( j − 1 ) − 1 , as C S ≥ 1 C_S \ge1 C S ≥ 1 by assumption. Since 1 / p < 1 1/p < 1 1/ p < 1 , we have that as i → ∞ i \to\infty i → ∞ , S i S_i S i converges to 1 / ( p − 1 ) 1/(p-1) 1/ ( p − 1 ) by property of the geometric sum. In other words, we have that
k i ≤ C S S ℓ ∗ − i − 1 ⋅ ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − i ≤ C S 1 / ( p − 1 ) ⋅ ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − i k_i \le C_S^{S_{\ell^*-i-1}}\cdot(n^{\gamma/4})^{(1/p)^{\ell^*-1-i}} \le C_S^{1/(p-1)}\cdot(n^{\gamma/4})^{(1/p)^{\ell^*-1-i}} k i ≤ C S S ℓ ∗ − i − 1 ⋅ ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − i ≤ C S 1/ ( p − 1 ) ⋅ ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − i for all i ∈ { 0 , 1 , 2 , … , ℓ ∗ − 1 } i \in\{0,1,2,\ldots,\ell^*-1\} i ∈ { 0 , 1 , 2 , … , ℓ ∗ − 1 } .
In the following lemma, we show that the edge weights in the first phase are polynomial in n n n . This makes use of our bound for k i k_i k i in Lemma 4.17 , which we expressed in terms of n γ / 4 n^{\gamma/4} n γ /4 . The key observation is that multiplying each k i k_i k i successively results in an additive effect in the exponent of n n n . In particular, the exponent of n n n follows a geometric series that converges to a constant value, which shows the desired claim. With this lemma, we conclude our analysis of the first phase.
Lemma 4.18. Let p = 1.99 p = 1.99 p = 1.99 . For all i ∈ { 0 , 1 , 2 … , ℓ ∗ } i \in\{0,1,2\ldots,\ell^*\} i ∈ { 0 , 1 , 2 … , ℓ ∗ } , the weights of the graph G i G_i G i are bounded above by the function
g ∗ ( n ) = ( 3 C S 1 / ( p − 1 ) ) ℓ ∗ n p γ / [ 4 ( p − 1 ) ] g 0 ( n ) ∈ poly ( n ) . g^*(n) = \left(3C_S^{1/(p-1)}\right)^{\ell^*}n^{p\gamma/[4(p-1)]}g_0(n) \in\operatorname{poly}(n). g ∗ ( n ) = ( 3 C S 1/ ( p − 1 ) ) ℓ ∗ n p γ / [ 4 ( p − 1 )] g 0 ( n ) ∈ poly ( n ) .
Proof. In order to bound the weights for all the graphs in the first phase, it suffices to bound the function g ℓ ∗ ( n ) g_{\ell^*}(n) g ℓ ∗ ( n ) , as defined in Lemma 4.16 . Applying our upper bounds on k i k_i k i in Lemma 4.17 , we have that
g ℓ ∗ ( n ) = ( ∏ j = 0 ℓ ∗ − 1 3 k j ) ⋅ g 0 ( n ) ≤ ( 3 C S 1 / ( p − 1 ) ) ℓ ∗ ( ∏ i = 0 ℓ ∗ − 1 ( n γ / 4 ) ( 1 / p ) ℓ ∗ − 1 − i ) ⋅ g 0 ( n ) . g_{\ell^*}(n) = \left(\prod_{j=0}^{\ell^*-1}3k_j\right)\cdot g_0(n) \leq\left(3C_S^{1/(p-1)}\right)^{\ell^*}\left(\prod_{i=0}^{\ell^*-1}\left(n^{\gamma/4}\right)^{(1/p)^{\ell^*-1-i}}\right)\cdot g_0(n). g ℓ ∗ ( n ) = ( j = 0 ∏ ℓ ∗ − 1 3 k j ) ⋅ g 0 ( n ) ≤ ( 3 C S 1/ ( p − 1 ) ) ℓ ∗ ( i = 0 ∏ ℓ ∗ − 1 ( n γ /4 ) ( 1/ p ) ℓ ∗ − 1 − i ) ⋅ g 0 ( n ) .
Notice that the exponent for the term ( n γ / 4 ) \left(n^{\gamma/4}\right) ( n γ /4 ) is a geometric sum with the common ratio 1 / p 1/p 1/ p and initial term of 1 1 1 . Since 1 / p < 1 1/p < 1 1/ p < 1 , this sum converges to p / ( p − 1 ) p/(p-1) p / ( p − 1 ) at infinity. Therefore, we may further bound g ℓ ∗ ( n ) g_{\ell^*}(n) g ℓ ∗ ( n ) with
g ℓ ∗ ( n ) ≤ g ∗ ( n ) = ( 3 C S 1 / ( p − 1 ) ) ℓ ∗ n p γ / [ 4 ( p − 1 ) ] g 0 ( n ) . g_{\ell^*}(n) \leq g^*(n) = \left(3C_S^{1/(p-1)}\right)^{\ell^*}n^{p\gamma/[4(p-1)]}g_0(n). g ℓ ∗ ( n ) ≤ g ∗ ( n ) = ( 3 C S 1/ ( p − 1 ) ) ℓ ∗ n p γ / [ 4 ( p − 1 )] g 0 ( n ) .
Since ℓ ∗ ∈ O ( log log n ) \ell^* \in O(\log\log n) ℓ ∗ ∈ O ( log log n ) by Lemma 4.12 , γ ≤ 1 \gamma\leq1 γ ≤ 1 and the remaining variables (except for n n n ) are treated as constants, we find that g ∗ ( n ) ∈ poly ( n ) g^*(n) \in\operatorname{poly}(n) g ∗ ( n ) ∈ poly ( n ) as desired.
We now proceed to the analysis of the edge weights in the second phase. The analysis of this phase is relatively simpler compared to the first: There are only a constant number of iterations in the second phase (Lemma 4.14 ) and the weights increase by at most a factor of O ( n ) O(n) O ( n ) between iterations. Since we have shown that the first graph in the second phase G ℓ ∗ G_{\ell^*} G ℓ ∗ has polynomially-bounded weights (Lemma 4.18 ), we therefore have that the edge weights throughout the second phase must also be polynomially-bounded.
Lemma 4.19. Suppose the weights of the graph G ℓ ∗ G_{\ell^*} G ℓ ∗ are bounded above by the function g ∗ ( n ) g^*(n) g ∗ ( n ) . Then, for all i ∈ { 0 , 1 , 2 , … , ℓ − ℓ ∗ } i \in\{0,1,2,\ldots,\ell-\ell^*\} i ∈ { 0 , 1 , 2 , … , ℓ − ℓ ∗ } , the weights of the graph G i + ℓ ∗ G_{i+\ell^*} G i + ℓ ∗ are bounded above by the function
g i + ℓ ∗ ( n ) = ( 3 n γ / 4 ) i ⋅ g ∗ ( n ) . g_{i+\ell^*}(n) = \left(3n^{\gamma/4}\right)^i\cdot g^*(n). g i + ℓ ∗ ( n ) = ( 3 n γ /4 ) i ⋅ g ∗ ( n ) .
Proof. We prove by induction on i i i . In the base case of i = 0 i = 0 i = 0 , we have g ℓ ∗ ( n ) = g ∗ ( n ) g_{\ell^*}(n) = g^*(n) g ℓ ∗ ( n ) = g ∗ ( n ) as expected. Consider now the inductive case: Suppose the claim holds for i = j i = j i = j . Recalling Definition 3.1, we observe that the function g j + 1 + ℓ ∗ ( n ) : = 3 k j + ℓ ∗ ⋅ g j + ℓ ∗ ( n ) = 3 n γ / 4 ⋅ g j + ℓ ∗ ( n ) g_{j+1+\ell^*}(n) := 3k_{j+\ell^*}\cdot g_{j+\ell^*}(n) = 3n^{\gamma/4}\cdot g_{j+\ell^*}(n) g j + 1 + ℓ ∗ ( n ) := 3 k j + ℓ ∗ ⋅ g j + ℓ ∗ ( n ) = 3 n γ /4 ⋅ g j + ℓ ∗ ( n ) is a suitable upper bound for the weights in G j + 1 + ℓ ∗ G_{j+1+\ell^*} G j + 1 + ℓ ∗ . Applying our induction hypothesis, we then have g j + 1 + ℓ ∗ ( n ) = ( 3 n γ / 4 ) j + 1 ⋅ g ∗ ( n ) g_{j+1+\ell^*}(n) = \left(3n^{\gamma/4}\right)^{j+1}\cdot g^*(n) g j + 1 + ℓ ∗ ( n ) = ( 3 n γ /4 ) j + 1 ⋅ g ∗ ( n ) as claimed.
With this next lemma, we claim the edge weights of all the graphs { G i } \{G_i\} { G i } are polynomially-bounded.
Lemma 4.20. For all i ∈ { 0 , 1 , 2 , … , ℓ } i \in\{0,1,2,\ldots,\ell\} i ∈ { 0 , 1 , 2 , … , ℓ } , the edge weights of the graph G i G_i G i are bounded above by poly ( n ) \operatorname{poly}(n) poly ( n ) .
Proof. By Lemma 4.18 , we know that the weights of the graphs { G 0 , G 1 , G 2 , … , G ℓ ∗ } \{G_0,G_1,G_2,\ldots,G_{\ell^*}\} { G 0 , G 1 , G 2 , … , G ℓ ∗ } are polynomially-bounded. To bound the edge weights of the remaining graphs { G ℓ ∗ + 1 , G ℓ ∗ + 2 , … , G ℓ } \{G_{\ell^*+1},G_{\ell^*+2},\ldots,G_\ell\} { G ℓ ∗ + 1 , G ℓ ∗ + 2 , … , G ℓ } , it suffices to show that the function g ℓ ( n ) g_\ell(n) g ℓ ( n ) as defined in Lemma 4.19 is bounded above by poly ( n ) \operatorname{poly}(n) poly ( n ) , i.e., that the last graph of the second phase has polynomially-bounded weights.
By Lemma 4.18 , we know that the edge weights of G ℓ ∗ G_{\ell^*} G ℓ ∗ are bounded above by the function g ∗ ( n ) ∈ poly ( n ) g^*(n) \in\operatorname{poly}(n) g ∗ ( n ) ∈ poly ( n ) . Additionally, by Lemma 4.14 , we know that the number of iterations in the second phase is at most O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) . Therefore, we conclude that the function g ℓ ( n ) g_\ell(n) g ℓ ( n ) is bounded by
g ℓ ( n ) ∈ ( 3 n γ / 4 ) O ( 1 / γ ) ⋅ g ∗ ( n ) ∈ 3 O ( 1 / γ ) n O ( 1 ) ⋅ g ∗ ( n ) ⊆ poly ( n ) , g_\ell(n) \in\left(3n^{\gamma/4}\right)^{O(1/\gamma)} \cdot g^*(n) \in3^{O(1/\gamma)}n^{O(1)} \cdot g^*(n) \subseteq\operatorname{poly}(n), g ℓ ( n ) ∈ ( 3 n γ /4 ) O ( 1/ γ ) ⋅ g ∗ ( n ) ∈ 3 O ( 1/ γ ) n O ( 1 ) ⋅ g ∗ ( n ) ⊆ poly ( n ) ,
as desired.
We are now ready to show that the weighted diameters of the graphs G i ′ G_i' G i ′ are always polynomial in n n n for both the first and second phases. As a result, Step 3 of each iteration, and by extension the entirety of each iteration, requires only O ( log log n ) O(\log\log n) O ( log log n ) rounds. Since we only have O ( log log n ) O(\log\log n) O ( log log n ) iterations, this gives an overall round complexity of O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
Lemma 4.21. Each iteration runs in O ( log log n ) O(\log\log n) O ( log log n ) rounds. As a direct consequence, the entire algorithm runs in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
Proof. We first bound the weighted diameters d i d_i d i of the graphs G i ′ G_i' G i ′ . By Lemma 4.20 , we know that the edge weights of the graphs { G i } \{G_i\} { G i } for all iterations i i i are bounded above by some function g i ( n ) ∈ poly ( n ) g_i(n) \in\operatorname{poly}(n) g i ( n ) ∈ poly ( n ) . Moreover, recall that G i ′ G_i' G i ′ is a subgraph of G i G_i G i by the definition of spanners. Therefore, we must have that d i ≤ ( n − 1 ) ⋅ g i ( n ) ∈ poly ( n ) d_i \le(n-1)\cdot g_i(n) \in\operatorname{poly}(n) d i ≤ ( n − 1 ) ⋅ g i ( n ) ∈ poly ( n ) as any shortest path in G i ′ G_i' G i ′ has at most n − 1 n-1 n − 1 edges.
To assess the round complexity of each iteration, we break it down by steps.
Therefore, we observe that each iteration requires O ( log log n ) O(\log\log n) O ( log log n ) rounds. Since we have O ( log log n ) O(\log\log n) O ( log log n ) iterations by Lemma 4.15 , the entire algorithm requires O ( log log n ⋅ log log n ) = O ( log 2 log n ) O(\log\log n\cdot\log\log n)=O(\log^2\log n) O ( log log n ⋅ log log n ) = O ( log 2 log n ) rounds as claimed.
Emulator Properties
We are now ready to bound the hopbound and stretch of the emulator H H H . To gain an intuitive picture, you can imagine that we are “climbing a tower” of skeleton graphs using edges in H H H , starting from G = G 0 G=G_0 G = G 0 . We start with any pair of vertices u 0 , v 0 ∈ V 0 u_0,v_0 \in V_0 u 0 , v 0 ∈ V 0 and the path P 0 P_0 P 0 from u 0 u_0 u 0 to v 0 v_0 v 0 with properties (P1) and (P2) as defined in Definition 3.1. Denote the path P 0 P_0 P 0 as u 0 → u 1 ⇝ v 1 → v 0 u_0 \to u_1 \leadsto v_1 \to v_0 u 0 → u 1 ⇝ v 1 → v 0 , and denote the first and last edges of P 0 P_0 P 0 as e 1 = { u 0 , u 1 } e_1=\{u_0,u_1\} e 1 = { u 0 , u 1 } and e 2 = { v 1 , v 0 } e_2=\{v_1,v_0\} e 2 = { v 1 , v 0 } respectively. We make two observations:
Therefore, using the edges e 1 e_1 e 1 and e 2 e_2 e 2 , we can “climb up” from G 0 G_0 G 0 to G 1 G_1 G 1 . By property (P1) of path P 0 P_0 P 0 , if we find a constant approximation for d G 1 ( u 1 , v 1 ) d_{G_1}(u_1,v_1) d G 1 ( u 1 , v 1 ) , this will directly yield a constant approximation for d G 0 ( u 0 , v 0 ) d_{G_0}(u_0,v_0) d G 0 ( u 0 , v 0 ) . This motivates us to repeat the same process: We now consider the path P 1 P_1 P 1 from u 1 u_1 u 1 to v 1 v_1 v 1 (as defined in Definition 3.1) and using the same procedure, climb from G 1 G_1 G 1 to G 2 G_2 G 2 . We repeat this until we reach the graph G ℓ G_\ell G ℓ , where we are finally able to “connect” the endpoints. Since we only have an O ( log log n ) O(\log\log n) O ( log log n ) number of graphs to climb (by Lemma 4.15), we only need O ( log log n ) O(\log\log n) O ( log log n ) edges in H H H . Additionally, combining these edges yields a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -approximate length path from u 0 u_0 u 0 to v 0 v_0 v 0 in H H H .
We now formalise the above intuition in the following lemma.
Lemma 4.22. For all i ∈ { 0 , 1 , 2 , … , ℓ } i \in\{0,1,2,\ldots,\ell\} i ∈ { 0 , 1 , 2 , … , ℓ } , consider any pair of vertices u , v ∈ V i u,v \in V_i u , v ∈ V i . There exists a path P P P from u u u to v v v in H H H such that all of the following hold:
P P P has at most 1 + 2 ( ℓ − i ) 1+2(\ell-i) 1 + 2 ( ℓ − i ) edges, and
the length of P P P is at most [ 7 C ( 2 / γ ) ] ℓ − i ⋅ d G i ( u , v ) [7C(2/\gamma)]^{\ell-i}\cdot d_{G_i}(u,v) [ 7 C ( 2/ γ ) ] ℓ − i ⋅ d G i ( u , v ) , where C C C is the same constant defined in Step 1 of the algorithm.
Proof. We prove by induction on i i i , starting from i = ℓ i=\ell i = ℓ .
Base Case (i = ℓ i=\ell i = ℓ ). Recalling the termination stage of the algorithm, we know that the all-pairs distances of G ℓ G_\ell G ℓ were added to H H H as weighted edges. Therefore, the base case holds.
Inductive Case. Suppose the claim holds for i = j i=j i = j . Consider any two vertices u , v ∈ V j − 1 u,v \in V_{j-1} u , v ∈ V j − 1 . In the case where u ∈ N k j − 1 ( v ) u \in N_{k_{j-1}}(v) u ∈ N k j − 1 ( v ) or v ∈ N k j − 1 ( u ) v \in N_{k_{j-1}}(u) v ∈ N k j − 1 ( u ) (with respect to the graph G j − 1 ′ G'_{j-1} G j − 1 ′ ), the claim trivially holds. So suppose not: Consider the path P P P from u u u to v v v in E k j − 1 ∪ E j E_{k_{j-1}} \cup E_j E k j − 1 ∪ E j with the properties (P1) and (P2) as defined in Definition 3.1. We denote the path P P P as u → u ∗ ⇝ v ∗ → v u \to u^* \leadsto v^* \to v u → u ∗ ⇝ v ∗ → v . Additionally, let e 1 = { u , u ∗ } e_1=\{u,u^*\} e 1 = { u , u ∗ } and e 2 = { v ∗ , v } e_2=\{v^*,v\} e 2 = { v ∗ , v } be the first and last edges of path P P P respectively.
By property (P2), we know that e 1 , e 2 ∈ H e_1,e_2 \in H e 1 , e 2 ∈ H . Moreover, the subpath from u ∗ u^* u ∗ to v ∗ v^* v ∗ in P P P is contained entirely in the graph G j G_j G j . We therefore apply our induction hypothesis on G j G_j G j to obtain the path P ∗ ⊆ H P^* \subseteq H P ∗ ⊆ H from u ∗ u^* u ∗ to v ∗ v^* v ∗ , which has the following properties:
P ∗ P^* P ∗ has at most 1 + 2 ( ℓ − j ) 1+2(\ell-j) 1 + 2 ( ℓ − j ) edges.
The length of P ∗ P^* P ∗ is at most [ 7 C ( 2 / γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) [7C(2/\gamma)]^{\ell-j}\cdot d_{G_j}(u^*,v^*) [ 7 C ( 2/ γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) .
We now consider a new path Q Q Q from u u u to v v v , defined as follows: From u u u to u ∗ u^* u ∗ using edge e 1 e_1 e 1 , u ∗ u^* u ∗ to v ∗ v^* v ∗ using path P ∗ P^* P ∗ , and lastly v ∗ v^* v ∗ to v v v using edge e 2 e_2 e 2 . Observe that Q Q Q is entirely contained in the edge set H H H . Moreover, we find that Q Q Q has the following properties:
Q Q Q has at most 1 + 2 ( ℓ − j ) + 2 = 1 + 2 ( ℓ − ( j − 1 ) ) 1+2(\ell-j)+2=1+2(\ell-(j-1)) 1 + 2 ( ℓ − j ) + 2 = 1 + 2 ( ℓ − ( j − 1 )) edges.
Considering P P P is a 7-approximation of d G j − 1 ′ ( u , v ) d_{G'_{j-1}}(u,v) d G j − 1 ′ ( u , v ) and that G j − 1 ′ G'_{j-1} G j − 1 ′ is a C ( 2 / γ ) C(2/\gamma) C ( 2/ γ ) -spanner for
G j − 1 G_{j-1} G j − 1 , we have
ω ( Q ) = ω ( e 1 ) + ω ( P ∗ ) + ω ( e 2 ) ≤ ω ( e 1 ) + [ 7 C ( 2 / γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) + ω ( e 2 ) = d G j − 1 ′ ( u , u ∗ ) + [ 7 C ( 2 / γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) + d G j − 1 ′ ( v ∗ , v ) ≤ [ 7 C ( 2 / γ ) ] ℓ − j [ d G j − 1 ′ ( u , u ∗ ) + d G j ( u ∗ , v ∗ ) + d G j − 1 ′ ( v ∗ , v ) ] ≤ [ 7 C ( 2 / γ ) ] ℓ − j ⋅ ω ( P ) ≤ [ 7 C ( 2 / γ ) ] ℓ − j ⋅ 7 ⋅ d G j − 1 ′ ( u , v ) ≤ [ 7 C ( 2 / γ ) ] ℓ − j ⋅ 7 C ( 2 / γ ) ⋅ d G j − 1 ( u , v ) = [ 7 C ( 2 / γ ) ] ℓ − ( j − 1 ) ⋅ d G j − 1 ( u , v ) . \begin{aligned}
\omega(Q) &= \omega(e_1) + \omega(P^*) + \omega(e_2) \\
&\le\omega(e_1) + [7C(2/\gamma)]^{\ell-j} \cdot d_{G_j}(u^*, v^*) + \omega(e_2) \\
&= d_{G'_{j-1}}(u,u^*) + [7C(2/\gamma)]^{\ell-j} \cdot d_{G_j}(u^*,v^*) + d_{G'_{j-1}}(v^*,v) \\
&\le[7C(2/\gamma)]^{\ell-j} \left[d_{G'_{j-1}}(u,u^*) + d_{G_j}(u^*,v^*) + d_{G'_{j-1}}(v^*,v)\right] \\
&\le[7C(2/\gamma)]^{\ell-j} \cdot\omega(P) \\
&\le[7C(2/\gamma)]^{\ell-j} \cdot7 \cdot d_{G'_{j-1}}(u,v) \\
&\le[7C(2/\gamma)]^{\ell-j} \cdot7C(2/\gamma) \cdot d_{G_{j-1}}(u,v) \\
&= [7C(2/\gamma)]^{\ell-(j-1)} \cdot d_{G_{j-1}}(u,v).
\end{aligned} ω ( Q ) = ω ( e 1 ) + ω ( P ∗ ) + ω ( e 2 ) ≤ ω ( e 1 ) + [ 7 C ( 2/ γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) + ω ( e 2 ) = d G j − 1 ′ ( u , u ∗ ) + [ 7 C ( 2/ γ ) ] ℓ − j ⋅ d G j ( u ∗ , v ∗ ) + d G j − 1 ′ ( v ∗ , v ) ≤ [ 7 C ( 2/ γ ) ] ℓ − j [ d G j − 1 ′ ( u , u ∗ ) + d G j ( u ∗ , v ∗ ) + d G j − 1 ′ ( v ∗ , v ) ] ≤ [ 7 C ( 2/ γ ) ] ℓ − j ⋅ ω ( P ) ≤ [ 7 C ( 2/ γ ) ] ℓ − j ⋅ 7 ⋅ d G j − 1 ′ ( u , v ) ≤ [ 7 C ( 2/ γ ) ] ℓ − j ⋅ 7 C ( 2/ γ ) ⋅ d G j − 1 ( u , v ) = [ 7 C ( 2/ γ ) ] ℓ − ( j − 1 ) ⋅ d G j − 1 ( u , v ) .
We now summarise the properties of our emulator H H H in the following lemma.
Lemma 4.23. H H H is a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator of the graph G = G 0 G=G_0 G = G 0 .
Proof. By Lemma 4.15 , we have that the final iteration ℓ ≤ T ⋅ log log n \ell\le T \cdot\log\log n ℓ ≤ T ⋅ log log n for some constant T T T . Therefore, applying our stretch upper bound in Lemma 4.22 with i = 0 i=0 i = 0 , we have that for any pair of vertices u , v ∈ V u,v \in V u , v ∈ V ,
d H ( 1 + 2 T ⋅ log log n ) ( u , v ) ≤ [ 7 C ( 2 / γ ) ] ( T ⋅ log log n ) d G ( u , v ) ∈ ( 2 / γ ) O ( log log n ) d G ( u , v ) . d_H^{(1+2T\cdot\log\log n)}(u,v) \le[7C(2/\gamma)]^{(T\cdot\log\log n)}d_G(u,v) \in(2/\gamma)^{O(\log\log n)}d_G(u,v). d H ( 1 + 2 T ⋅ l o g l o g n ) ( u , v ) ≤ [ 7 C ( 2/ γ ) ] ( T ⋅ l o g l o g n ) d G ( u , v ) ∈ ( 2/ γ ) O ( l o g l o g n ) d G ( u , v ) . To show the lower bound, we recall our definition of the skeleton graph in Definition 3.1. Specifically, we observe that for all iterations i i i , the distances in G G G are never contracted in the subsequent graphs G i G_i G i , i.e., d G ( u , v ) ≤ d G i ( u , v ) d_G(u,v) \le d_{G_i}(u,v) d G ( u , v ) ≤ d G i ( u , v ) . Consequently, we have that d G ( u , v ) ≤ d H ( u , v ) d_G(u,v) \le d_H(u,v) d G ( u , v ) ≤ d H ( u , v ) for all pairs of vertices u , v ∈ V u,v \in V u , v ∈ V . Therefore, we conclude that H H H is indeed a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator for G G G .
We now conclude with the proof of Lemma 4.9 .
Proof of Lemma 4.9. We run the algorithm described in § 4.3.1 . This constructs the edge set H H H , which by Lemma 4.23 is a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator for G G G . By Lemma 4.21 , we only require O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
By the algorithm description, we observe that each iteration requires at most O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory, and since there are O ( log log n ) O(\log\log n) O ( log log n ) iterations by Lemma 4.15 , we therefore require at most O ~ ( log log n ⋅ ( ∣ E ∣ + n 1 + γ ) ) ⊆ O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(\log\log n\cdot(|E|+n^{1+\gamma})) \subseteq\widetilde{O}(|E|+n^{1+\gamma}) O ( log log n ⋅ ( ∣ E ∣ + n 1 + γ )) ⊆ O ( ∣ E ∣ + n 1 + γ ) total memory. In particular, we have sufficient total memory to store the emulator H H H across the machines.
Wrapping it Up
Now having access to a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator, we can apply Lemma 3.4 on the emulator to construct ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -approximate k k k -nearest neighbourhoods for all vertices. We state this in the following lemma.
Lemma 4.24. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices and let integer k > 0 k>0 k > 0 be a parameter. Given that k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) , in the heterogeneous MPC model with O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory, there exists a randomised algorithm that w.h.p. constructs the set { ( u , t ) : u ∈ V ∧ t ∈ N ~ k ( u ) } \{(u,t):u\in V \wedge t\in\widetilde{N}_k(u)\} {( u , t ) : u ∈ V ∧ t ∈ N k ( u )}
where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -approximate k k k -nearest neighbourhood for u u u . This algorithm runs in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
Proof. We first invoke Lemma 4.9 to construct a ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -stretch O ( log log n ) O(\log\log n) O ( log log n ) -hopbound emulator H H H for the graph G G G . This requires O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory and runs in O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds. Denote the hopbound of the emulator as C H log log n C_H\log\log n C H log log n , where C H > 0 C_H>0 C H > 0 is some constant.
We now apply Lemma 3.4 on H H H , setting the parameter r r r such that 2 r = h ≥ C H log log n 2^r=h\ge C_H\log\log n 2 r = h ≥ C H log log n . This gives us the k k k -nearest h h h -hop neighbourhoods N k ( h ) ( u ) N_k^{(h)}(u) N k ( h ) ( u ) for all vertices u ∈ V u\in V u ∈ V in the emulator H H H . By the properties of the emulator H H H , these suffice as ( 2 / γ ) O ( log log n ) (2/\gamma)^{O(\log\log n)} ( 2/ γ ) O ( l o g l o g n ) -approximate k k k -nearest neighbourhoods in the graph G G G , and we are done. This requires O ~ ( ∣ H ∣ + n k 2 ) ⊆ O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|H|+nk^2)\subseteq\widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ H ∣ + n k 2 ) ⊆ O ( ∣ E ∣ + n 1 + γ ) total memory and O ( r ) = O ( log log log n ) O(r)=O(\log\log\log n) O ( r ) = O ( log log log n ) rounds.
Overall, we require O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory and O ( log 2 log n + log log log n ) = O ( log 2 log n ) O(\log^2\log n+\log\log\log n)=O(\log^2\log n) O ( log 2 log n + log log log n ) = O ( log 2 log n ) rounds, as claimed. □
It now remains to complete the proof for Theorem 2 , which follows similarly to the proof for Theorem 1 . However, we now use Lemma 4.24 for constructing the approximate k k k -nearest neighbourhoods instead.
Proof of Theorem 2 . By Lemma 2.6 , we may assume that G G G is a connected graph. We first apply the spanner construction in Lemma 2.4 to construct an O ( 2 / γ ) O(2/\gamma) O ( 2/ γ ) -spanner G ′ G' G ′ for G G G of size O ~ ( n 1 + γ / 2 ) \widetilde{O}(n^{1+\gamma/2}) O ( n 1 + γ /2 ) in O ( 1 ) O(1) O ( 1 ) rounds. We then apply Lemma 4.24 to construct a = ( 2 / γ ) O ( log log n ) =(2/\gamma)^{O(\log\log n)} = ( 2/ γ ) O ( l o g l o g n ) -approximate k = n γ / 4 k=n^{\gamma/4} k = n γ /4 -nearest neighbourhoods N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) for all vertices u ∈ V u\in V u ∈ V in G ′ G' G ′ , which requires O ( log 2 log n ) O(\log^2\log n) O ( log 2 log n ) rounds.
We now apply Lemma 4.2 with the parameter c = γ c=\gamma c = γ , which constructs an O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) -approximate SSSP oracle for G ′ G' G ′ in O ( log a + log log n ) ⊆ O ( log log n ) O(\log a+\log\log n)\subseteq O(\log\log n) O ( log a + log log n ) ⊆ O ( log log n ) rounds – the inclusion follows as we treat γ \gamma γ as a constant. In total, we require O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory across all steps.
Since G ′ G' G ′ is an O ( 2 / γ ) O(2/\gamma) O ( 2/ γ ) -spanner for G G G , an O ( 1 / γ ) O(1/\gamma) O ( 1/ γ ) -approximate SSSP oracle for G ′ G' G ′ directly yields an O ( 1 / γ 2 ) O(1/\gamma^2) O ( 1/ γ 2 ) -approximate SSSP oracle for G G G , and we are done. In total, we require O ( log 2 log n + log log n ) = O ( log 2 log n ) O(\log^2\log n+\log\log n)=O(\log^2\log n) O ( log 2 log n + log log n ) = O ( log 2 log n ) rounds and O ~ ( ∣ E ∣ + n 1 + γ ) \widetilde{O}(|E|+n^{1+\gamma}) O ( ∣ E ∣ + n 1 + γ ) total memory, as desired. □
For the remainder of this work, we further discuss the building blocks as described in § 3.1 .
Computing k k k -Nearest Hopsets
In this section, we aim to prove the following lemma, which constructs a k k k -nearest hopset for a given weighted graph G G G in constant rounds.
Lemma 3.3 (k k k -Nearest Hopset ). Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 0 k>0 k > 0 be an integer. Suppose that for every vertex u ∈ V u\in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u,t):t\in\widetilde{N}_k(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an a a a -approximate k k k -nearest neighbourhood of u u u . If k 2 ∈ O ( n γ ) k^2\in O(n^\gamma) k 2 ∈ O ( n γ ) , then in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic algorithm that constructs a k k k -nearest O ( a log d ) O(a\log d) O ( a log d ) -hopbound hopset H H H in O ( 1 ) O(1) O ( 1 ) rounds, where d d d is the weighted diameter of G G G .
Construction. We closely follow the construction of [11 Lemma 2.2] . The central idea behind the construction is straightforward: Each vertex u u u requests the k k k shortest incident edges from every vertex t ∈ N ~ k ( u ) t\in\widetilde{N}_k(u) t ∈ N k ( u ) . This allows u u u to learn the exact distances to a significant fraction of the vertices in N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) ; these exact distances are added as weighted edges to the hopset. Subsequently, one can show that for any vertex v ∈ N k ( u ) v \in N_k(u) v ∈ N k ( u ) , an appropriate choice of a hopset edge together with one edge from the original graph covers at least 1 / a 1/a 1/ a -fraction of the distance from u u u to v v v . More concretely, for every vertex t ∈ V t \in V t ∈ V , first denote I k ( t ) I_k(t) I k ( t ) as the k k k shortest edges incident to t t t in G G G , breaking ties, say, by endpoint vertex ID. We define the edge set
T k ( u ) = ⋃ t ∈ N ~ k ( u ) I k ( t ) T_k(u) = \bigcup_{t \in\widetilde{N}_k(u)} I_k(t) T k ( u ) = t ∈ N k ( u ) ⋃ I k ( t )
and let B k ( u ) B_k(u) B k ( u ) be the set of all vertices covered by at least one edge in T k ( u ) T_k(u) T k ( u ) . Lastly, for all v ∈ B k ( u ) v \in B_k(u) v ∈ B k ( u ) , define δ u ( v ) \delta_u(v) δ u ( v ) as the distance from u u u to v v v in the subgraph of G G G induced by the edge set T k ( u ) T_k(u) T k ( u ) . We now define the weighted edge set H H H as follows:
H = { { u , v } : u ∈ V ∧ v ∈ B k ( u ) ∧ δ u ( v ) ≠ ∞ } , where ω H ( u , v ) = δ u ( v ) . H = \left\{ \{u,v\} : u \in V \land v \in B_k(u) \land\delta_u(v) \ne\infty\right\}, \qquad\text{where } \omega_H(u,v) = \delta_u(v). H = { { u , v } : u ∈ V ∧ v ∈ B k ( u ) ∧ δ u ( v ) = ∞ } , where ω H ( u , v ) = δ u ( v ) .
If multiple candidates exist, choose the edge with the lowest weight.
Correctness. The hopset construction is essentially identical to [11 Lemma 2.2] , except for a minor difference. In [11 ] , they defined δ u ( v ) \delta_u(v) δ u ( v ) as the shortest distance from u u u to v v v in the induced subgraph of T k ( u ) ∪ { { u , w } : { u , w } ∈ E } T_k(u) \cup\left\{ \{u,w\} : \{u,w\} \in E \right\} T k ( u ) ∪ { { u , w } : { u , w } ∈ E } , i.e., the edges incident to u u u are also considered in the local shortest path computation. However, it is evident from their proof technique that this difference is not significant. For the sake of completeness, we make this explicit.
We define the d d d -distance ball of a vertex u u u as Ball d ( u ) : = { v : d G ( u , v ) ≤ d } \operatorname{Ball}_d(u) := \{v : d_G(u,v) \le d\} Ball d ( u ) := { v : d G ( u , v ) ≤ d } . It is also convenient to define ℓ k ( u ) : = max v ∈ N k ( u ) d G ( u , v ) \ell_k(u) := \max_{v \in N_k(u)} d_G(u,v) ℓ k ( u ) := max v ∈ N k ( u ) d G ( u , v ) , i.e., the minimum d d d such that N k ( u ) ⊆ Ball d ( u ) N_k(u) \subseteq\operatorname{Ball}_d(u) N k ( u ) ⊆ Ball d ( u ) . Notice that for any d < ℓ k ( u ) d < \ell_k(u) d < ℓ k ( u ) , we have that ∣ Ball d ( u ) ∣ < k \lvert\operatorname{Ball}_d(u) \rvert< k ∣ Ball d ( u )∣ < k .
We first invoke two claims from [11 ] . The first claim suggests that any approximate k k k -nearest neighbourhood N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) contains a ball of a certain distance radius around u u u . The second claim shows that this distance radius is sufficiently large such that short-cutting exact distances to vertices in this ball gives us the desired hopset. We note that the original statements in [11 ] only had k = n k = \sqrt{n} k = n , but it is clear that their proofs do not require any special value of k k k .
Claim 5.1 ([11 ] ). For any u ∈ V u \in V u ∈ V and any a a a -approximate k k k -nearest neighbourhood N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) for u u u , we have Ball ( ℓ k ( u ) − 1 ) / a ( u ) ⊆ N ~ k ( u ) \operatorname{Ball}_{(\ell_k(u)-1)/a}(u) \subseteq\widetilde{N}_k(u) Ball ( ℓ k ( u ) − 1 ) / a ( u ) ⊆ N k ( u ) .
Claim 5.2 ([11 ] ). The edge set H ′ : = { { u , v } : u ∈ V ∧ v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) } H' := \left\{ \{u,v\} : u \in V \land v \in\operatorname{Ball}_{(\ell_k(u)-1)/a}(u) \right\} H ′ := { { u , v } : u ∈ V ∧ v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) } with edge weights ω H ′ ( u , v ) : = d G ( u , v ) \omega_{H'}(u,v) := d_G(u,v) ω H ′ ( u , v ) := d G ( u , v ) is a k k k -nearest O ( a log d ) O(a \log d) O ( a log d ) -hopbound hopset for G G G .
To connect the preceding two claims, we show in the following claim that the edges T k ( u ) T_k(u) T k ( u ) are sufficient to determine the exact distances to vertices in Ball ( ℓ k ( u ) − 1 ) / a ( u ) \operatorname{Ball}_{(\ell_k(u)-1)/a}(u) Ball ( ℓ k ( u ) − 1 ) / a ( u ) .
Claim 5.3. Consider any vertices u , v ∈ V u,v \in V u , v ∈ V such that v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) v \in\operatorname{Ball}_{(\ell_k(u)-1)/a}(u) v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) , and let u = w 1 → w 2 → ⋯ → w m = v u = w_1 \to w_2 \to\cdots\to w_m = v u = w 1 → w 2 → ⋯ → w m = v be any shortest path from u u u to v v v in G G G . For each integer 1 ≤ i ≤ m − 1 1 \le i \le m-1 1 ≤ i ≤ m − 1 , we have that { w i , w i + 1 } ∈ I k ( w i ) \{w_i,w_{i+1}\} \in I_k(w_i) { w i , w i + 1 } ∈ I k ( w i ) .
Proof. Suppose not, i.e., there exists some vertex w i w_i w i such that { w i , w i + 1 } ∉ I k ( w i ) \{w_i,w_{i+1}\} \notin I_k(w_i) { w i , w i + 1 } ∈ / I k ( w i ) . Observe that this implies ∣ I k ( w i ) ∣ = k \lvert I_k(w_i) \rvert= k ∣ I k ( w i )∣ = k . Moreover, for every z ∈ V z \in V z ∈ V such that { w i , z } ∈ I k ( w i ) \{w_i,z\} \in I_k(w_i) { w i , z } ∈ I k ( w i ) , we have d G ( u , z ) ≤ d G ( u , v ) d_G(u,z) \le d_G(u,v) d G ( u , z ) ≤ d G ( u , v ) —to observe this, notice that ω G ( w i , z ) ≤ ω G ( w i , w i + 1 ) ≤ d G ( w i , v ) \omega_G(w_i,z) \le\omega_G(w_i,w_{i+1}) \le d_G(w_i,v) ω G ( w i , z ) ≤ ω G ( w i , w i + 1 ) ≤ d G ( w i , v ) and therefore
d G ( u , z ) ≤ d G ( u , w i ) + ω G ( w i , z ) ≤ d G ( u , w i ) + d G ( w i , v ) = d G ( u , v ) . d_G(u,z) \le d_G(u,w_i) + \omega_G(w_i,z) \le d_G(u,w_i) + d_G(w_i,v) = d_G(u,v). d G ( u , z ) ≤ d G ( u , w i ) + ω G ( w i , z ) ≤ d G ( u , w i ) + d G ( w i , v ) = d G ( u , v ) .
In particular, this implies that d G ( u , z ) ≤ ( ℓ k ( u ) − 1 ) / a d_G(u,z) \le(\ell_k(u)-1)/a d G ( u , z ) ≤ ( ℓ k ( u ) − 1 ) / a and z ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) z \in\operatorname{Ball}_{(\ell_k(u)-1)/a}(u) z ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) . Altogether, we find that the k k k vertices { z : { w i , z } ∈ I k ( w i ) } \left\{z : \{w_i,z\} \in I_k(w_i)\right\} { z : { w i , z } ∈ I k ( w i ) } are in Ball ( ℓ k ( u ) − 1 ) / a ( u ) \operatorname{Ball}_{(\ell_k(u)-1)/a}(u) Ball ( ℓ k ( u ) − 1 ) / a ( u ) and hence ∣ Ball ( ℓ k ( u ) − 1 ) / a ( u ) ∣ ≥ k \left\lvert\operatorname{Ball}_{(\ell_k(u)-1)/a}(u)\right\rvert\ge k Ball ( ℓ k ( u ) − 1 ) / a ( u ) ≥ k . Contradiction. □ \square □
Claim 5.4 ([11 ] ). The edge set H H H is a k k k -nearest O ( a log d ) O(a \log d) O ( a log d ) -hopbound hopset for G G G .
Proof. By Claims 5.1 and 5.3, we find that the edge set T k ( u ) T_k(u) T k ( u ) is sufficient to learn the exact distances to each vertex v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) v \in\operatorname{Ball}(\ell_{k}(u)-1)/a(u) v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) ; in particular, the edges of every shortest path from u u u to v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) v \in\operatorname{Ball}(\ell_{k}(u)-1)/a(u) v ∈ Ball ( ℓ k ( u ) − 1 ) / a ( u ) are contained in T k ( u ) T_k(u) T k ( u ) . Claim 5.2 implies that H H H is indeed a k k k -nearest O ( a log d ) O(a \log d) O ( a log d ) -hopbound hopset for G G G .
For the rest of the section, to finish the proof of Lemma 3.3 , we show that H H H can be constructed efficiently in the sublinear MPC model. In the following implementation details, we use two MPC procedures: the duplication lemma and labelling lemma. For the sake of presentation, we defer the description of these lemmas and their proofs to Section A.
The high-level idea for the construction is as follows: Every vertex u u u first requests the set I k ( t ) I_k(t) I k ( t ) from every vertex t ∈ N ~ k ( u ) t \in\widetilde{N}_k(u) t ∈ N k ( u ) . After receiving the edge set T k ( u ) T_k(u) T k ( u ) , vertex u u u locally computes the distances δ u ( v ) \delta_u(v) δ u ( v ) and adds the edge { u , v } \{u,v\} { u , v } to H H H for every vertex v ∈ B k ( u ) v \in B_k(u) v ∈ B k ( u ) . Implementing this idea in the MPC model does not pose any significant challenges, although care has to be taken in the communication of edges from one vertex to another.
We remark that the size of the edge set ∣ T k ( u ) ∣ ≤ k 2 |T_k(u)| \le k^2 ∣ T k ( u ) ∣ ≤ k 2 by definition, and therefore we require k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) for the distances { δ u ( v ) : v ∈ B k ( u ) } \{\delta_u(v): v \in B_k(u)\} { δ u ( v ) : v ∈ B k ( u )} to be computed entirely on a single sublinear memory machine. Moreover, we also require the additional total memory of O ( n k 2 ) O(nk^2) O ( n k 2 ) to store the edge sets T k ( u ) T_k(u) T k ( u ) for all vertices u ∈ V u \in V u ∈ V .
Representing Information. Before discussing implementation details, we first need to describe how we represent information within the MPC model. We categorize information into two types of information packets:
Edges: For each edge { a , b } ∈ E \{a,b\} \in E { a , b } ∈ E with weight ω G ( a , b ) \omega_G(a,b) ω G ( a , b ) belonging to vertex c c c , we represent it as ( E , c , { a , b } , ω G ( a , b ) ) (\mathcal{E},c,\{a,b\},\omega_G(a,b)) ( E , c , { a , b } , ω G ( a , b )) .
k k k -Nearest: For each vertex b ∈ N ~ k ( a ) b \in\widetilde{N}_k(a) b ∈ N k ( a ) , we represent it as ( K , b , a ) (\mathcal{K},b,a) ( K , b , a ) .
The symbols E \mathcal{E} E and K \mathcal{K} K are used only to differentiate between the two types of information packets.
Step 0: Initialisation. At the start of the algorithm, we may assume for every vertex u ∈ V u \in V u ∈ V , we only have information of its incident edges and its approximate k k k -nearest neighbourhood N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) .
For each edge { u , v } ∈ E \{u,v\} \in E { u , v } ∈ E , there exists a machine that contains ( E , u , { u , v } , ω G ( u , v ) ) (\mathcal{E},u,\{u,v\},\omega_G(u,v)) ( E , u , { u , v } , ω G ( u , v )) .
For each vertex t ∈ N ~ k ( u ) t \in\widetilde{N}_k(u) t ∈ N k ( u ) , there exists a machine that contains ( K , t , u ) (\mathcal{K},t,u) ( K , t , u ) .
Initially, this information is arbitrarily distributed across all the machines. For every edge { u , v } ∈ E \{u,v\} \in E { u , v } ∈ E , we may assume there exist two packets representing this edge:
( E , u , { u , v } , ω G ( u , v ) ) and ( E , v , { u , v } , ω G ( u , v ) ) . (\mathcal{E},u,\{u,v\},\omega_G(u,v)) \quad\text{and}\quad(\mathcal{E},v,\{u,v\},\omega_G(u,v)). ( E , u , { u , v } , ω G ( u , v )) and ( E , v , { u , v } , ω G ( u , v )) .
Step 1: Send Requests. To simulate the sending of a request from one vertex to another, it suffices to sort the information packets. Namely, by applying the sorting procedure in Lemma 2.5 using the second item in the tuple as the key, each vertex t ∈ V t \in V t ∈ V now has the following information stored on a contiguous set of machines M ( t ) M(t) M ( t ) .
( E , t , { t , v } , ω G ( t , v ) ) (\mathcal{E},t,\{t,v\},\omega_G(t,v)) ( E , t , { t , v } , ω G ( t , v )) , for every edge { t , v } ∈ E \{t,v\}\in E { t , v } ∈ E incident to t t t .
( K , t , u ) (\mathcal{K},t,u) ( K , t , u ) , for every vertex u u u such that t ∈ N ~ k ( u ) t\in\widetilde{N}_k(u) t ∈ N k ( u ) .
Denote the machine in M ( t ) M(t) M ( t ) with the smallest ID as M ^ ( t ) \widehat{M}(t) M ( t ) . This step runs in O ( 1 ) O(1) O ( 1 ) rounds. Intuitively, ( K , t , u ) (\mathcal{K},t,u) ( K , t , u ) corresponds to a request from u u u asking t t t for the edge set I k ( t ) I_k(t) I k ( t ) .
Step 2: Create Duplicates of Incident Edges. For each vertex t ∈ V t\in V t ∈ V , we write D k ( t ) = { u : t ∈ N ~ k ( u ) } D_k(t)=\{u:t\in\widetilde{N}_k(u)\} D k ( t ) = { u : t ∈ N k ( u )} and d t = ∣ D k ( t ) ∣ d_t=|D_k(t)| d t = ∣ D k ( t ) ∣ . Recall that our goal is to let t t t send the edge set I k ( t ) I_k(t) I k ( t ) to each vertex in D k ( t ) D_k(t) D k ( t ) . The messages to be sent are prepared as follows: We create d t d_t d t duplicates of the edge set I k ( t ) I_k(t) I k ( t ) and thereafter label each duplicate according to the vertex IDs in D k ( t ) D_k(t) D k ( t ) . To initiate this procedure, we require that each leader machine M ^ ( t ) \widehat{M}(t) M ( t ) learns the value of d t d_t d t and the edge set I k ( t ) I_k(t) I k ( t ) . We do so in the following way:
Learning the value d t d_t d t is done by counting the total number of packets ( K , t , ⋅ ) (\mathcal{K},t,\cdot) ( K , t , ⋅ ) stored across the machines M ( t ) M(t) M ( t ) . We execute this by calling the prefix sum sub-routine in Lemma 2.5 and sorting such that the leader machine M ^ ( t ) \widehat{M}(t) M ( t ) knows the sum d t d_t d t .
Learning the edge set I k ( t ) I_k(t) I k ( t ) is done by sorting the edge packets in M ( t ) M(t) M ( t ) by their edge weights (using Lemma 2.5 ). We then collect the edges I k ( t ) I_k(t) I k ( t ) onto the leader machine M ^ ( t ) \widehat{M}(t) M ( t ) with one additional round (which can be done as ∣ I k ( t ) ∣ ≤ k |I_k(t)|\le k ∣ I k ( t ) ∣ ≤ k and k ∈ O ( n γ ) k\in O(n^\gamma) k ∈ O ( n γ ) by assumption).
Now, we are ready to duplicate and label the edges.
We first apply Lemma A.1 to create d t d_t d t duplicates of I k ( t ) I_k(t) I k ( t ) in the form ( I k ( t ) , 1 ) , ( I k ( t ) , 2 ) , … , ( I k ( t ) , d t ) (I_k(t),1),(I_k(t),2),\ldots,(I_k(t),d_t) ( I k ( t ) , 1 ) , ( I k ( t ) , 2 ) , … , ( I k ( t ) , d t ) .
We next apply Lemma A.2 to relabel each duplicate with a vertex ID in D k ( t ) D_k(t) D k ( t ) . In other words, denoting D k ( t ) = { u 1 , u 2 , … , u d t } D_k(t)=\{u_1,u_2,\ldots,u_{d_t}\} D k ( t ) = { u 1 , u 2 , … , u d t } , we now have the duplicates in the form of ( I k ( t ) , u 1 ) , ( I k ( t ) , u 2 ) , … , ( I k ( t ) , u d t ) (I_k(t),u_1),(I_k(t),u_2),\ldots,(I_k(t),u_{d_t}) ( I k ( t ) , u 1 ) , ( I k ( t ) , u 2 ) , … , ( I k ( t ) , u d t ) .
Lastly, for each duplicate ( I k ( t ) , u j ) (I_k(t),u_j) ( I k ( t ) , u j ) , we relabel every edge packet in I k ( t ) I_k(t) I k ( t ) from ( E , t , { t , v } , ω G ( t , v ) ) (\mathcal{E},t,\{t,v\},\omega_G(t,v)) ( E , t , { t , v } , ω G ( t , v )) to ( E , u j , { t , v } , ω G ( t , v ) ) (\mathcal{E},u_j,\{t,v\},\omega_G(t,v)) ( E , u j , { t , v } , ω G ( t , v )) .
Crucially, since ∑ t ∈ V d t ≤ n k \sum_{t\in V}d_t\le nk ∑ t ∈ V d t ≤ nk , we only require O ( n k 2 ) O(nk^2) O ( n k 2 ) additional total memory to apply Lemmas A.1 and A.2 which is satisfied by our constraints. Overall, this entire step runs in O ( 1 ) O(1) O ( 1 ) rounds.
Step 3: Send and Receive Edges. Similar to Step 1, we again sort the edge packets by the second item in the tuple using Lemma 2.5 . At this point, we can discard the k k k -nearest packets. After this, for each vertex u ∈ V u\in V u ∈ V , we have the packets ( E , u , { t , v } , ω G ( t , v ) ) (\mathcal{E},u,\{t,v\},\omega_G(t,v)) ( E , u , { t , v } , ω G ( t , v )) for the edges { t , v } ∈ T k ( u ) \{t,v\}\in T_k(u) { t , v } ∈ T k ( u ) stored on a set of contiguous machines M ( u ) M(u) M ( u ) (Note that these are not necessarily the same machines in Step 2).
Recalling that ∣ T k ( u ) ∣ ≤ k 2 |T_k(u)|\le k^2 ∣ T k ( u ) ∣ ≤ k 2 and k 2 ∈ O ( n γ ) k^2\in O(n^\gamma) k 2 ∈ O ( n γ ) by assumption, the entire set of edges T k ( u ) T_k(u) T k ( u ) can be collected onto the leader M ^ ( u ) \widehat{M}(u) M ( u ) with an additional O ( 1 ) O(1) O ( 1 ) rounds (note that we do not need the entire set of incident edges of u u u , which could have size larger than k 2 k^2 k 2 ). Overall, this step requires O ( 1 ) O(1) O ( 1 ) rounds.
Step 4: Add Edges to H H H . Each leader machine M ^ ( u ) \widehat{M}(u) M ( u ) (from Step 3) now locally computes the distances δ u ( v ) \delta_u(v) δ u ( v ) for all v ∈ B k ( u ) v \in B_k(u) v ∈ B k ( u ) . Subsequently, for v ∈ B k ( u ) v \in B_k(u) v ∈ B k ( u ) (and δ u ( v ) ≠ ∞ \delta_u(v) \ne\infty δ u ( v ) = ∞ ), the machine M ^ ( u ) \widehat{M}(u) M ( u ) creates a new packet ( E , u , { u , v } , δ u ( v ) ) (\mathcal{E},u,\{u,v\},\delta_u(v)) ( E , u , { u , v } , δ u ( v )) to be included into the edge set H H H .
This concludes the algorithm description. We make a few concluding remarks which are not critical to the algorithm description, but are worth mentioning for clarity:
To remove duplicate edges in H H H , it suffices to perform one final sorting step using Lemma 2.5 to group all edge weights corresponding to each edge { u , v } ∈ H \{u,v\} \in H { u , v } ∈ H onto a contiguous set of machines, with the weights within each group sorted. Then, each group can locally retain the smallest edge weight using the “finding minimum” procedure in Lemma 2.5 , and discard the rest.
We summarise the above discussion in the following proof of Lemma 3.3 .
Proof of Lemma 3.3 . We apply the algorithm as described above to construct the edge set H H H . By the algorithm description, the edge set H H H constructed by the algorithm is exactly the edge set H H H specified in Claim 5.4 , and is therefore a k k k -nearest O ( a log d ) O(a \log d) O ( a log d ) -hopbound hopset for G G G . Using O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E| + nk^2) O ( ∣ E ∣ + n k 2 ) total memory, each step of the algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds. Therefore, the entire algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds as well, as desired. □
Extracting k k k -Nearest Neighbourhoods
In this section we prove the following lemma, which gives us k k k -nearest h h h -hop neighbourhoods according to the input graph. In particular, if we have a c c c -stretch h h h -hopbound emulator for a graph G G G , we can obtain c c c -approximate k k k -nearest neighbourhoods for all vertices in G G G using O ( log h ) O(\log h) O ( log h ) rounds. Alternatively, if we have a k k k -nearest h h h -hopbound hopset H H H for G G G , applying the lemma on G ∪ H G \cup H G ∪ H gives exact k k k -nearest neighbourhoods for all vertices in G G G . That is, in conjunction with Lemma 3.3 , we have a useful tool for extracting exact k k k -nearest neighbourhoods from approximate k k k -nearest neighbourhoods in the sublinear MPC model.
Lemma 3.4 (Extracting k k k -Nearest Neighbourhoods). Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 0 k>0 k > 0 and r > 0 r>0 r > 0 be integers, setting h = 2 r h=2^r h = 2 r . Suppose that k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) . Then, in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic O ( r ) O(r) O ( r ) -round algorithm that constructs the set
{ ( u , t , d G ( h ) ( u , t ) ) : u ∈ V and t ∈ N k ( h ) ( u ) } . \left\{ \left(u,t,d_G^{(h)}(u,t)\right) : u \in V \text{ and } t \in N_k^{(h)}(u) \right\}. { ( u , t , d G ( h ) ( u , t ) ) : u ∈ V and t ∈ N k ( h ) ( u ) } .
Notation. Before describing the construction, it is convenient to define some notation for matrices. We call C C C the adjacency matrix of a graph H = ( V H , E H ) H=(V_H,E_H) H = ( V H , E H ) if C u , v = ω H ( u , v ) C_{u,v}=\omega_H(u,v) C u , v = ω H ( u , v ) for all vertices u , v ∈ V H u,v \in V_H u , v ∈ V H . We denote C ‾ \overline{C} C as the filtered matrix of C C C , where only the k k k smallest elements of each row in C C C are kept, breaking ties by ID (with the remaining elements set to ∞ \infty ∞ ). We specifically denote A \mathcal{A} A to be the adjacency matrix of the input graph G G G , i.e., A u , v = ω G ( u , v ) \mathcal{A}_{u,v}=\omega_G(u,v) A u , v = ω G ( u , v ) for all vertices u , v ∈ V u,v \in V u , v ∈ V .
In this section, we only consider matrix multiplication under the min-plus semiring. Observe that for all integers i ≥ 1 i \ge1 i ≥ 1 and for all vertices u , v ∈ V u,v \in V u , v ∈ V , we have A u , v i = d G ( i ) ( u , v ) A^{i}_{u,v} = d^{(i)}_{G}(u,v) A u , v i = d G ( i ) ( u , v ) . In other words, learning the matrix A ‾ i \overline{A}^{i} A i is equivalent to learning the neighbourhoods N k ( i ) ( u ) N_{k}^{(i)}(u) N k ( i ) ( u ) for all vertices u ∈ V u \in V u ∈ V .
Construction. The construction is an application of the well-known graph exponentiation technique: Each vertex u u u maintains a vertex set which describes its current view of its k k k -nearest neighbourhood. Initially, this vertex set is simply N k ( 1 ) ( u ) N_{k}^{(1)}(u) N k ( 1 ) ( u ) , the k k k nearest adjacent vertices to u u u in G G G . During the i i i th iteration, the vertex u u u starts with the k k k -nearest 2 i 2^{i} 2 i -hop neighbourhood N k ( 2 i ) ( u ) N_{k}^{(2^{i})}(u) N k ( 2 i ) ( u ) , and gathers the sets N k ( 2 i ) ( t ) N_{k}^{(2^{i})}(t) N k ( 2 i ) ( t ) for every vertex t ∈ N k ( 2 i ) ( u ) t \in N_{k}^{(2^{i})}(u) t ∈ N k ( 2 i ) ( u ) . Using this new information, u u u is able to exactly construct the 2 i + 1 2^{i+1} 2 i + 1 -hop neighbourhood N k ( 2 i + 1 ) ( u ) N_{k}^{(2^{i+1})}(u) N k ( 2 i + 1 ) ( u ) . We repeat this process until every u ∈ V u \in V u ∈ V knows the h h h -hop neighbourhood N k ( h ) ( u ) N_{k}^{(h)}(u) N k ( h ) ( u ) .
More concretely, we define the sequences of matrices { B i } \{B_i\} { B i } for i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } as follows:
B 0 = A ‾ , B_0 = \overline{A}, B 0 = A ,
B i = B i − 1 2 ‾ . B_i = \overline{B_{i-1}^{2}}. B i = B i − 1 2 .
For every vertex u ∈ V u \in V u ∈ V , the entries of row u u u in B i + 1 B_{i+1} B i + 1 correspond to the vertices and values that u u u learns at the end of the i i i th iteration. In other words, we want to show that B i = A 2 i ‾ B_i = \overline{A^{2^i}} B i = A 2 i for all integers i ≥ 0 i \ge0 i ≥ 0 .
Correctness. We adopt a useful lemma from Bui et al. [11 ] , which claims that for any adjacency matrix C C C representing a graph with positive integer weights, the k k k smallest entries in each row of ( C ‾ ) i (\overline{C})^i ( C ) i are the k k k smallest entries in the corresponding row of C i C^i C i .
Lemma 6.1 ([11 ] ). Let C C C be the adjacency matrix of a graph with positive integer weights. Then we have ( C ‾ ) i = C i ‾ (\overline{C})^i = \overline{C^i} ( C ) i = C i for all integers i ≥ 1 i \ge1 i ≥ 1 .
We now proceed to show that B i = A 2 i ‾ B_i = \overline{A^{2^i}} B i = A 2 i . There is a slight difference between Lemma 6.1 and the construction of the matrices { B i } \{B_i\} { B i } : For the former, the filtering occurs only at the end of all i i i iterations; for the latter, the filtering occurs between each iteration. However, by applying Lemma 6.1 between each iteration, we can show the desired claim.
Lemma 6.2. For all integers i ≥ 0 i \ge0 i ≥ 0 , we have B i = A 2 i ‾ B_i = \overline{A^{2^i}} B i = A 2 i .
Proof. We prove this by induction. In the base case i = 0 i = 0 i = 0 , we have B 0 = A ‾ = A 2 0 ‾ B_0 = \overline{A} = \overline{A^{2^0}} B 0 = A = A 2 0 as claimed. Proceeding to the inductive case: Suppose the claim holds for i = j i = j i = j . Invoking our induction hypothesis, we have that
B j + 1 = B j 2 ‾ = ( A 2 j ‾ ) 2 ‾ . B_{j+1} = \overline{B_j^2} = \overline{\left(\overline{A^{2^j}}\right)^2}. B j + 1 = B j 2 = ( A 2 j ) 2 .
Observe that the matrix A 2 j A^{2^j} A 2 j represents the adjacency matrix of the graph G ′ = ( V , E ′ ) G' = (V,E') G ′ = ( V , E ′ ) with edge weights ω G ′ ( u , v ) = d G ( 2 j ) ( u , v ) \omega_{G'}(u,v) = d_{G}^{(2^j)}(u,v) ω G ′ ( u , v ) = d G ( 2 j ) ( u , v ) . Therefore, we can apply Lemma 6.1 on the matrix A 2 j A^{2^j} A 2 j with i = 2 i = 2 i = 2 to obtain
B j + 1 = ( A 2 j ‾ ) 2 ‾ = ( A 2 j ) 2 ‾ = A 2 j + 1 ‾ , B_{j+1} = \overline{\left(\overline{A^{2^j}}\right)^2} = \overline{\left(A^{2^j}\right)^2} = \overline{A^{2^{j+1}}}, B j + 1 = ( A 2 j ) 2 = ( A 2 j ) 2 = A 2 j + 1 ,
as desired.
Algorithm Description
We describe the algorithm in iterations: For each iteration i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } , we start with the matrix B i B_i B i , and by communicating minimal but sufficient information between vertices, we show that we can construct the matrix B i + 1 B_{i+1} B i + 1 in a constant number of rounds. For ease of notation, for all i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } and for all vertices u ∈ V u \in V u ∈ V , we define
B i ( u ) = { ( u , t , d G ( 2 i ) ( u , t ) ) : t ∈ N k ( 2 i ) ( u ) } . B_i(u) = \left\{(u,t,d_G^{(2^i)}(u,t)):t \in N_k^{(2^i)}(u)\right\}. B i ( u ) = { ( u , t , d G ( 2 i ) ( u , t )) : t ∈ N k ( 2 i ) ( u ) } .
In other words, B i ( u ) B_i(u) B i ( u ) represents the entries of the row u u u of B i B_i B i (by Lemma 6.2). To perform the matrix multiplication, observe that to determine the values B i + 1 ( u ) B_{i+1}(u) B i + 1 ( u ) for any vertex u ∈ V u \in V u ∈ V , it suffices to have the following information:
The values B i ( u ) B_i(u) B i ( u ) , and
The values B i ( t ) B_i(t) B i ( t ) for all vertices t ∈ N k ( 2 i ) ( u ) t \in N_k^{(2^i)}(u) t ∈ N k ( 2 i ) ( u ) .
By extension, recalling that ∣ B i ( v ) ∣ ≤ k |B_i(v)| \leq k ∣ B i ( v ) ∣ ≤ k for all vertices v ∈ V v \in V v ∈ V , we require O ( k 2 ) O(k^2) O ( k 2 ) memory per machine in order to construct the values B i + 1 ( u ) B_{i+1}(u) B i + 1 ( u ) entirely locally. We note that the algorithm description for each iteration is nearly identical to the algorithm for Lemma 3.3 . Therefore, for the sake of brevity, we describe only the essential details.
Initialisation. To determine the values B 0 ( u ) B_0(u) B 0 ( u ) for every vertex u ∈ V u \in V u ∈ V , it suffices to sort the edges such that the k k k shortest edges incident on u u u (breaking ties by ID) are stored on a single machine. Using Lemma 2.5 , this requires O ( 1 ) O(1) O ( 1 ) rounds.
A Single Iteration. Our procedure for each iteration proceeds as follows: In iteration i ∈ { 0 , 1 , 2 , … } i \in\{0,1,2,\ldots\} i ∈ { 0 , 1 , 2 , … } , every vertex u ∈ V u \in V u ∈ V initially has the values B i ( u ) B_i(u) B i ( u ) .
Step 1. Sending Requests. For every vertex u ∈ V u \in V u ∈ V , it sends a request for the values B i ( t ) B_i(t) B i ( t ) for each vertex t ∈ N k ( 2 i ) ( u ) t \in N_k^{(2^i)}(u) t ∈ N k ( 2 i ) ( u ) . Using Lemma 2.5 , this step requires O ( 1 ) O(1) O ( 1 ) rounds.
Step 2. Duplicating Information. For every vertex t ∈ V t \in V t ∈ V , denote D i ( t ) = { u : t ∈ N k ( 2 i ) ( u ) } D_i(t) = \{u:t \in N_k^{(2^i)}(u)\} D i ( t ) = { u : t ∈ N k ( 2 i ) ( u )} and d t = ∣ D i ( t ) ∣ d_t = |D_i(t)| d t = ∣ D i ( t ) ∣ . Recall that our goal is to let t t t send the values B i ( t ) B_i(t) B i ( t ) to every vertex in D i ( t ) D_i(t) D i ( t ) . This proceeds as follows:
We duplicate d t d_t d t copies of the values B i ( t ) B_i(t) B i ( t ) .
We label each duplicate with a vertex ID in D i ( t ) D_i(t) D i ( t ) .
In other words, denoting D i ( t ) = { u 1 , u 2 , … , u d t } D_i(t) = \{u_1,u_2,\ldots,u_{d_t}\} D i ( t ) = { u 1 , u 2 , … , u d t } , we have constructed the values ( B i ( t ) , u 1 ) , ( B i ( t ) , u 2 ) , … , ( B i ( t ) , u d t ) (B_i(t),u_1),(B_i(t),u_2),\ldots,(B_i(t),u_{d_t}) ( B i ( t ) , u 1 ) , ( B i ( t ) , u 2 ) , … , ( B i ( t ) , u d t ) . Using Lemma A.1 and Lemma A.2 , this step requires O ( 1 ) O(1) O ( 1 ) rounds. Moreover, recalling that ∑ t ∈ V d t ≤ n k \sum_{t \in V}d_t \leq nk ∑ t ∈ V d t ≤ nk , this step requires O ( n k 2 ) O(nk^2) O ( n k 2 ) additional total memory.
Step 3. Performing Matrix Multiplication. For every vertex u ∈ V u \in V u ∈ V , we sort the values across the machines such that we have the following information stored on a single machine M ^ ( u ) \widehat{M}(u) M ( u ) :
Finally, using its local information, M ^ ( u ) \widehat{M}(u) M ( u ) is able to construct the values B i + 1 ( u ) B_{i+1}(u) B i + 1 ( u ) as specified in the earlier construction. Using Lemma 2.5 , this step requires O ( 1 ) O(1) O ( 1 ) rounds. All remaining information is then discarded.
Claim 6.3. Running T T T consecutive iterations of the above algorithm in the sublinear MPC model requires O ( T ) O(T) O ( T ) rounds and O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory (independent of T T T ).
Proof. We first argue about the round complexity. For each iteration, every step requires only O ( 1 ) O(1) O ( 1 ) rounds. Since there is a constant (three) number of steps, each iteration only requires O ( 1 ) O(1) O ( 1 ) rounds, and running T T T consecutive iterations requires O ( T ) O(T) O ( T ) rounds.
We next argue about the total memory constraints. Observe that each iteration requires only O ( n k 2 ) O(nk^2) O ( n k 2 ) additional memory: Step 1 requires O ( n k ) O(nk) O ( nk ) additional memory, while Steps 2 and 3 require O ( n k 2 ) O(nk^2) O ( n k 2 ) additional memory. Naively, we might assume that we therefore require O ( T ⋅ n k 2 ) O(T \cdot nk^2) O ( T ⋅ n k 2 ) additional total memory overall. However, recall that after Step 3 in each iteration, we discard all remaining information except for the values of the matrix B i + 1 B_{i+1} B i + 1 . In other words, there is no accumulation of memory usage between iterations, and the total memory required remains as O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) , regardless of the number of iterations.
The Final Proof. We summarise our discussion for this section with the proof of Lemma 3.4.
Proof. We run the above algorithm for r r r iterations, which requires O ( r ) O(r) O ( r ) rounds and O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory by Claim 6.3 . By the end of the algorithm, we have constructed the entries of the matrix B r = A h B_r=A^h B r = A h . Now applying Lemma 6.2, we observe that this is equivalent to the values { ( u , t , d G ( h ) ( u , t ) ) : u ∈ V ∧ t ∈ N k ( h ) ( u ) } \{(u,t,d_G^{(h)}(u,t)): u \in V \land t \in N_k^{(h)}(u)\} {( u , t , d G ( h ) ( u , t )) : u ∈ V ∧ t ∈ N k ( h ) ( u )} , and we are done.
Skeleton Graphs
In this section, we prove the following lemma, which provides a fast construction for the skeleton graph as defined in Definition 3.1.
Lemma 3.2 (Skeleton Graph Construction). Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 1 k>1 k > 1 be an integer. Suppose the k k k -nearest edge set E k E_k E k for G G G is given. If k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) , then in the sublinear MPC model with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory, there exists a randomised algorithm that w.h.p. constructs a skeleton graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) in O ( 1 ) O(1) O ( 1 ) rounds.
Our skeleton graph is based on the construction proposed by [11 ] , which has exactly the properties described in Definition 3.1. However, the main (and only) issue with this construction is that the number of edges in the skeleton graph is poorly bounded. Therefore, we suggest a modified construction that maintains the same properties while bounding the number of edges by O ( ∣ E ∣ k 2 ) O(|E|k^2) O ( ∣ E ∣ k 2 ) . In doing so, we require adding additional vertices to the skeleton graph; however, we show that the number of additional vertices is at most n / k n/k n / k , and therefore the number of vertices is still bounded above by O ~ ( n / k ) \widetilde{O}(n/k) O ( n / k ) .
Original Construction. We first discuss the construction proposed by [11 ] . We follow a clustering approach: The cluster centers are the vertex set C ⊆ V C \subseteq V C ⊆ V , chosen such that ∣ C ∣ ∈ O ( ( n log k ) / k ) |C| \in O((n \log k)/k) ∣ C ∣ ∈ O (( n log k ) / k ) and C ∩ N k ( u ) ≠ ∅ C \cap N_k(u) \ne\varnothing C ∩ N k ( u ) = ∅ for all u ∈ V u \in V u ∈ V (i.e., C C C is a hitting set for the k k k -nearest neighbourhoods). The vertex set C C C is constructed by first adding each vertex w ∈ V w \in V w ∈ V to C C C independently with probability p ∈ Θ ( ( log k ) / k ) p \in\Theta((\log k)/k) p ∈ Θ (( log k ) / k ) and subsequently adding any remaining vertices w ′ w' w ′ with C ∩ N k ( w ′ ) = ∅ C \cap N_k(w') = \varnothing C ∩ N k ( w ′ ) = ∅ .
For all vertices u ∈ V u \in V u ∈ V , we add u u u to the cluster with the nearest center. More concretely, we choose a c ( u ) ∈ C c(u) \in C c ( u ) ∈ C such that the distance d G ( u , c ( u ) ) d_G(u,c(u)) d G ( u , c ( u )) is the smallest among all vertices in C ∩ N k ( u ) C \cap N_k(u) C ∩ N k ( u ) (breaking ties arbitrarily). We now define the graph G S ∗ = ( V S ∗ , E S ∗ ) G^*_S = (V^*_S,E^*_S) G S ∗ = ( V S ∗ , E S ∗ ) as follows:
V S ∗ = C V^*_S = C V S ∗ = C , and
For all vertices u , v ∈ V u,v \in V u , v ∈ V , we add the edge { c ( u ) , c ( v ) } ∈ E S ∗ \{c(u),c(v)\} \in E^*_S { c ( u ) , c ( v )} ∈ E S ∗ if there exists a vertex t ∈ V t \in V t ∈ V such that all of the following hold:
t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) (i.e., t t t is in the k k k -nearest neighbourhood of u u u ), and
{ t , v } ∈ E \{t,v\} \in E { t , v } ∈ E (i.e., t t t is adjacent to v v v in G G G ) or t = v t=v t = v .
We define the edge weight ω G S ∗ ( c ( u ) , c ( v ) ) : = d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v ) ) \omega_{G^*_S}(c(u),c(v)) := d_G(c(u),u) + d_G(u,t) + \omega_G(t,v) + d_G(v,c(v)) ω G S ∗ ( c ( u ) , c ( v )) := d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v )) . If there are multiple candidate edge weights, choose the minimum weight.
We now give a proof sketch of the correctness of G S ∗ G^*_S G S ∗ . Namely, for any two vertices that are not in the k k k -nearest of each other, there exists a path in E k ∪ E S ∗ E_k \cup E^*_S E k ∪ E S ∗ that satisfies the two properties stated in Definition 3.1.
Claim 7.1 ([11 ] ). G S ∗ G^*_S G S ∗ is a skeleton graph for G G G as defined in Definition 3.1.
Proof Sketch. To show that G S ∗ G^*_S G S ∗ is a skeleton graph for G G G , we need to verify the following properties:
∣ V S ∗ ∣ ∈ O ( ( n log k ) / k ) |V^*_S| \in O((n \log k)/k) ∣ V S ∗ ∣ ∈ O (( n log k ) / k ) .
d G S ∗ ( u , v ) ≥ d G ( u , v ) d_{G^*_S}(u,v) \ge d_G(u,v) d G S ∗ ( u , v ) ≥ d G ( u , v ) for all u , v ∈ V S ∗ u,v \in V^*_S u , v ∈ V S ∗ .
If ω G ( u , v ) ≤ g ( n ) \omega_G(u,v) \le g(n) ω G ( u , v ) ≤ g ( n ) for all { u , v } ∈ E \{u,v\} \in E { u , v } ∈ E for some function g g g , then ω G S ∗ ( x , y ) ≤ 3 k ⋅ g ( n ) \omega_{G^*_S}(x,y) \le3k \cdot g(n) ω G S ∗ ( x , y ) ≤ 3 k ⋅ g ( n ) for all { x , y } ∈ E S ∗ \{x,y\} \in E^*_S { x , y } ∈ E S ∗ .
If G G G is connected, then so is G S ∗ G^*_S G S ∗ .
If u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) and v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) , then there exists a path P P P in E k ∪ E S ∗ E_k \cup E^*_S E k ∪ E S ∗ with the properties (P1) and (P2).
In this proof sketch, we focus on showing the last property; the remaining properties are relatively easier to verify.
Consider any two vertices u , v ∈ V u,v \in V u , v ∈ V such that u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) and v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) . We first consider the shortest path from u u u to v v v in G G G , which we denote as u = u 0 ⇝ t 0 → u 1 ⇝ t 1 → u 2 ⇝ t 2 → … → u ℓ ⇝ t ℓ = v u = u_0 \leadsto t_0 \to u_1 \leadsto t_1 \to u_2 \leadsto t_2 \to\ldots\to u_\ell\leadsto t_\ell= v u = u 0 ⇝ t 0 → u 1 ⇝ t 1 → u 2 ⇝ t 2 → … → u ℓ ⇝ t ℓ = v chosen such that t i ∈ N k ( u i ) t_i \in N_k(u_i) t i ∈ N k ( u i ) while u i + 1 ∉ N k ( u i ) u_{i+1} \notin N_k(u_i) u i + 1 ∈ / N k ( u i ) . By definition, observe that there must exist a path Q Q Q in E S ∗ E^*_S E S ∗ of the form c ( u 0 ) → c ( u 1 ) → c ( u 2 ) → … → c ( u ℓ ) → c ( t ℓ ) c(u_0) \to c(u_1) \to c(u_2) \to\ldots\to c(u_\ell) \to c(t_\ell) c ( u 0 ) → c ( u 1 ) → c ( u 2 ) → … → c ( u ℓ ) → c ( t ℓ ) . In particular, we observe that for i ≤ ℓ − 2 i \le\ell- 2 i ≤ ℓ − 2 ,
ω G S ∗ ( c ( u i ) , c ( u i + 1 ) ) ≤ d G ( c ( u i ) , u i ) + d G ( u i , t i ) + ω G ( t i , u i + 1 ) + d G ( u i + 1 , c ( u i + 1 ) ) ≤ d G ( u i , u i + 1 ) + d G ( u i , t i ) + ω G ( t i , u i + 1 ) + d G ( u i + 1 , u i + 2 ) = 2 ⋅ d G ( u i , u i + 1 ) + d G ( u i + 1 , u i + 2 ) . \begin{aligned}
\omega_{G^*_S}(c(u_i),c(u_{i+1})) &\le d_G(c(u_i),u_i) + d_G(u_i,t_i) + \omega_G(t_i,u_{i+1}) + d_G(u_{i+1},c(u_{i+1})) \\
&\le d_G(u_i,u_{i+1}) + d_G(u_i,t_i) + \omega_G(t_i,u_{i+1}) + d_G(u_{i+1},u_{i+2}) \\
&= 2 \cdot d_G(u_i,u_{i+1}) + d_G(u_{i+1},u_{i+2}).
\end{aligned} ω G S ∗ ( c ( u i ) , c ( u i + 1 )) ≤ d G ( c ( u i ) , u i ) + d G ( u i , t i ) + ω G ( t i , u i + 1 ) + d G ( u i + 1 , c ( u i + 1 )) ≤ d G ( u i , u i + 1 ) + d G ( u i , t i ) + ω G ( t i , u i + 1 ) + d G ( u i + 1 , u i + 2 ) = 2 ⋅ d G ( u i , u i + 1 ) + d G ( u i + 1 , u i + 2 ) .
To bound the edge weights c ( u ℓ − 1 ) → c ( u ℓ ) c(u_{\ell-1}) \to c(u_{\ell}) c ( u ℓ − 1 ) → c ( u ℓ ) and c ( u ℓ ) → c ( t ℓ ) c(u_{\ell}) \to c(t_{\ell}) c ( u ℓ ) → c ( t ℓ ) , we observe that
d G ( u ℓ , c ( u ℓ ) ) ≤ d G ( u ℓ , c ( t ℓ ) ) ≤ d G ( u ℓ , t ℓ ) + d G ( t ℓ , c ( t ℓ ) ) ≤ d G ( u ℓ , t ℓ ) + d G ( u , v ) . d_G(u_{\ell},c(u_{\ell})) \le d_G(u_{\ell},c(t_{\ell})) \le d_G(u_{\ell},t_{\ell}) + d_G(t_{\ell},c(t_{\ell})) \le d_G(u_{\ell},t_{\ell}) + d_G(u,v). d G ( u ℓ , c ( u ℓ )) ≤ d G ( u ℓ , c ( t ℓ )) ≤ d G ( u ℓ , t ℓ ) + d G ( t ℓ , c ( t ℓ )) ≤ d G ( u ℓ , t ℓ ) + d G ( u , v ) .
Therefore, we conclude that the length of path Q Q Q is at most
∑ i = 0 ℓ − 1 ω G S ∗ ( c ( u i ) , c ( u i + 1 ) ) + ω G S ∗ ( c ( u ℓ ) , c ( t ℓ ) ) \sum_{i=0}^{\ell-1} \omega_{G_S^*}(c(u_i),c(u_{i+1})) + \omega_{G_S^*}(c(u_{\ell}),c(t_{\ell})) i = 0 ∑ ℓ − 1 ω G S ∗ ( c ( u i ) , c ( u i + 1 )) + ω G S ∗ ( c ( u ℓ ) , c ( t ℓ ))
≤ 2 ⋅ d G ( u 0 , u 1 ) + 3 ( ∑ j = 1 ℓ − 1 d G ( u j , u j + 1 ) + d G ( u ℓ , t ℓ ) + d G ( u , v ) ) . \le2 \cdot d_G(u_0,u_1) + 3\left(\sum_{j=1}^{\ell-1} d_G(u_j,u_{j+1}) + d_G(u_{\ell},t_{\ell}) + d_G(u,v)\right). ≤ 2 ⋅ d G ( u 0 , u 1 ) + 3 ( j = 1 ∑ ℓ − 1 d G ( u j , u j + 1 ) + d G ( u ℓ , t ℓ ) + d G ( u , v ) ) .
We now construct the final path P P P from u u u to v v v in E k ∪ E S ∗ E_k \cup E_S^* E k ∪ E S ∗ : u → c ( u ) u \to c(u) u → c ( u ) using an edge in E k E_k E k , c ( u ) ⇝ c ( v ) c(u) \leadsto c(v) c ( u ) ⇝ c ( v ) using path Q Q Q (contained entirely in E S ∗ E_S^* E S ∗ ), and c ( v ) → v c(v) \to v c ( v ) → v using an edge in E k E_k E k . By construction, we observe that P P P obeys property (P2) of Definition 3.1. Additionally, noting that d G ( u , c ( u ) ) ≤ d G ( u 0 , u 1 ) d_G(u,c(u)) \le d_G(u_0,u_1) d G ( u , c ( u )) ≤ d G ( u 0 , u 1 ) and d G ( v , c ( v ) ) ≤ d G ( u , v ) d_G(v,c(v)) \le d_G(u,v) d G ( v , c ( v )) ≤ d G ( u , v ) , we observe the following:
The length of the path u → c ( u ) ⇝ c ( v ) u \to c(u) \leadsto c(v) u → c ( u ) ⇝ c ( v ) is at most 6 ⋅ d G ( u , v ) 6 \cdot d_G(u,v) 6 ⋅ d G ( u , v ) .
The length of the path c ( v ) → v c(v) \to v c ( v ) → v is at most d G ( u , v ) d_G(u,v) d G ( u , v ) .
Therefore, we conclude that the length of P P P is at most 7 ⋅ d G ( u , v ) 7 \cdot d_G(u,v) 7 ⋅ d G ( u , v ) . Moreover, using the fact that d G S ∗ ( u , v ) ≥ d G ( u , v ) d_{G_S^*}(u,v) \ge d_G(u,v) d G S ∗ ( u , v ) ≥ d G ( u , v ) for all u , v ∈ V ∗ u,v \in V^* u , v ∈ V ∗ , we have that the length of P P P is indeed a 7-approximation of the distance d G ( u , v ) d_G(u,v) d G ( u , v ) , and thus obeys property (P1) of Definition 3.1.
We now discuss our modified construction, which seeks to provide a better upper bound for the size of the skeleton graph while preserving the essential properties as stated in Definition 3.1.
Modified Construction. For every vertex t ∈ V t \in V t ∈ V , we call t t t a bad vertex if there exist more than k 2 k^2 k 2 distinct vertices u ∈ V u \in V u ∈ V such that t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) (i.e., ∣ { u : t ∈ N k ( u ) } ∣ > k 2 |\{u : t \in N_k(u)\}| > k^2 ∣ { u : t ∈ N k ( u )} ∣ > k 2 ); otherwise, we call t t t a good vertex . Denote B ⊆ V B \subseteq V B ⊆ V as the set of bad vertices in V V V . We also define the vertex set C C C and the vertices c ( u ) c(u) c ( u ) for all u ∈ V u \in V u ∈ V identically to the original construction. Before defining the modified skeleton graph, we first define two weighted edge sets E C E_C E C and E B E_B E B .
Edge Set E C E_C E C . Defined over the vertices C C C . For all vertices u , v ∈ V u,v \in V u , v ∈ V , we add the edge { c ( u ) , c ( v ) } \{c(u),c(v)\} { c ( u ) , c ( v )} to E C E_C E C if there exists a vertex t ∈ V t \in V t ∈ V such that all of the following hold:
t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) (i.e., t t t is in the k k k -nearest neighbourhood of u u u ),
{ t , v } ∈ E \{t,v\} \in E { t , v } ∈ E (i.e., t t t is adjacent to v v v in G G G ) or t = v t=v t = v , and
t ∉ B t \notin B t ∈ / B (i.e., t t t is a good vertex).
We define the edge weight ω E C ( c ( u ) , c ( v ) ) : = d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v ) ) \omega_{E_C}(c(u),c(v)) := d_G(c(u),u) + d_G(u,t) + \omega_G(t,v) + d_G(v,c(v)) ω E C ( c ( u ) , c ( v )) := d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v )) . If there are multiple candidate edge weights, choose the minimum weight.
Note that the definition of E C E_C E C is almost identical to the earlier definition of E S ∗ E_S^* E S ∗ , with the additional requirement that t ∉ B t \notin B t ∈ / B .
Edge Set E B E_B E B . Defined over the vertices C ∪ B C \cup B C ∪ B . For all bad vertices t ∈ B t \in B t ∈ B , we add the edge { s , t } \{s,t\} { s , t } to E B E_B E B if either one of the following conditions holds:
There exists a vertex u ∈ V u \in V u ∈ V such that s = c ( u ) s=c(u) s = c ( u ) and t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) . In this case, we set the edge weight ω E B ( s , t ) : = d G ( s , u ) + d G ( u , t ) \omega_{E_B}(s,t) := d_G(s,u)+d_G(u,t) ω E B ( s , t ) := d G ( s , u ) + d G ( u , t ) .
There exists a vertex v ∈ V v \in V v ∈ V such that s = c ( v ) s=c(v) s = c ( v ) and either { t , v } ∈ E \{t,v\} \in E { t , v } ∈ E or t = v t=v t = v . In this case, we set the edge weight ω E B ( s , t ) : = d G ( s , v ) + ω G ( v , t ) \omega_{E_B}(s,t) := d_G(s,v)+\omega_G(v,t) ω E B ( s , t ) := d G ( s , v ) + ω G ( v , t ) .
If both conditions hold simultaneously or if there are multiple candidate edge weights, we always choose the minimum weight.
We are now ready to define the graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) as follows: We define V S = C ∪ B V_S=C\cup B V S = C ∪ B and E S = E C ∪ E B E_S=E_C\cup E_B E S = E C ∪ E B (such that for any parallel edges, choose the edge with the smaller edge weight). This concludes the construction, and we claim that G S G_S G S is a skeleton graph for G G G with the additional property that ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) |E_S| \in O(|E|k^2) ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) .
Correctness
We separate the proof of correctness into multiple smaller claims. We first argue on the size of the vertex set V S V_S V S . Namely, we show that the number of bad vertices is upper bounded by n / k n/k n / k .
Claim 7.2. ∣ B ∣ ≤ n / k |B| \le n/k ∣ B ∣ ≤ n / k . Consequently, we have ∣ V S ∣ ∈ O ( ( n log k ) / k ) |V_S| \in O((n \log k)/k) ∣ V S ∣ ∈ O (( n log k ) / k ) .
Proof. By definition, we have ∣ C ∣ ∈ O ( ( n log k ) / k ) |C| \in O((n \log k)/k) ∣ C ∣ ∈ O (( n log k ) / k ) . Thus to show that ∣ V S ∣ ∈ O ( ( n log k ) / k ) |V_S| \in O((n \log k)/k) ∣ V S ∣ ∈ O (( n log k ) / k ) , it suffices to obtain a good bound for ∣ B ∣ |B| ∣ B ∣ . Consider the following “token distribution” procedure: For every vertex u ∈ V u \in V u ∈ V , u u u gives the vertex t ∈ V t \in V t ∈ V a token if t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) . Observe that the set B B B is equivalent to the set of vertices with more than k 2 k^2 k 2 tokens. Additionally, we observe that there are at most n k nk nk tokens across all vertices. Therefore by the pigeonhole principle, we can only have at most n k / k 2 = n / k nk/k^2=n/k nk / k 2 = n / k bad vertices. In other words, ∣ B ∣ ≤ n / k |B| \le n/k ∣ B ∣ ≤ n / k as claimed.
We next argue on the size of the edge set E S E_S E S . In particular, we will show that both E C E_C E C and E B E_B E B have at most O ( ∣ E ∣ k 2 ) O(|E|k^2) O ( ∣ E ∣ k 2 ) edges, and therefore E S E_S E S has O ( ∣ E ∣ k 2 ) O(|E|k^2) O ( ∣ E ∣ k 2 ) edges as well.
Claim 7.3. ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) |E_S| \in O(|E|k^2) ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) .
Proof. A useful observation here is that in any simple undirected graph, the number of non-isolated vertices (i.e., vertices with at least one adjacent edge) is at most 2 ∣ E ∣ 2|E| 2∣ E ∣ ; in particular, ∣ B ∣ ≤ 2 ∣ E ∣ |B| \le2|E| ∣ B ∣ ≤ 2∣ E ∣ .
Bounding ∣ E B ∣ |E_B| ∣ E B ∣ . For every bad vertex t ∈ B t \in B t ∈ B , define the integers a t = ∣ { v : { v , t } ∈ E or v = t } ∣ a_t=|\{v:\{v,t\}\in E\text{ or }v=t\}| a t = ∣ { v : { v , t } ∈ E or v = t } ∣ and b t = ∣ { u : t ∈ N k ( u ) } ∣ b_t=|\{u:t\in N_k(u)\}| b t = ∣ { u : t ∈ N k ( u )} ∣ (i.e., a t a_t a t is the number of vertices adjacent to t t t in G G G (and itself) and b t b_t b t is the number of vertices that t t t is in the k k k -nearest of).
We find that ∑ t ∈ B a t ≤ 2 ∣ E ∣ + ∣ B ∣ \sum_{t\in B}a_t \le2|E|+|B| ∑ t ∈ B a t ≤ 2∣ E ∣ + ∣ B ∣ and ∑ t ∈ B b t ≤ 2 ∣ E ∣ k \sum_{t\in B}b_t \le2|E|k ∑ t ∈ B b t ≤ 2∣ E ∣ k – to observe the latter, sum the k k k -nearest neighbourhoods of each non-isolated vertex in V V V . Additionally, we observe from the definition of E B E_B E B that for every bad vertex t ∈ B t \in B t ∈ B , we add at most ( a t + b t ) (a_t+b_t) ( a t + b t ) edges. Therefore, the size of ∣ E B ∣ |E_B| ∣ E B ∣ is bounded by
∣ E B ∣ ≤ ∑ t ∈ B ( a t + b t ) ≤ 2 ∣ E ∣ + ∣ B ∣ + 2 ∣ E ∣ k ∈ O ( ∣ E ∣ k 2 ) . |E_B| \le\sum_{t\in B}(a_t+b_t) \le2|E|+|B|+2|E|k \in O(|E|k^2). ∣ E B ∣ ≤ t ∈ B ∑ ( a t + b t ) ≤ 2∣ E ∣ + ∣ B ∣ + 2∣ E ∣ k ∈ O ( ∣ E ∣ k 2 ) .
Bounding ∣ E C ∣ |E_C| ∣ E C ∣ . Fix any two non-isolated vertices t , v ∈ V t,v \in V t , v ∈ V such that t t t is a good vertex, and either { t , v } ∈ E \{t,v\}\in E { t , v } ∈ E or t = v t=v t = v . By definition of a good vertex, there are at most k 2 k^2 k 2 vertices u u u such that t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) . Therefore, it follows from the definition of E C E_C E C that we only construct at most k 2 k^2 k 2 edges { c ( u ) , c ( v ) } \{c(u), c(v)\} { c ( u ) , c ( v )} with edge weight d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v ) ) d_G(c(u), u) + d_G(u, t) + \omega_G(t, v) + d_G(v, c(v)) d G ( c ( u ) , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , c ( v )) . Since there are at most O ( ∣ E ∣ ) O(|E|) O ( ∣ E ∣ ) possible choices for the vertices t t t and v v v , we can therefore conclude that there are at most O ( ∣ E ∣ k 2 ) O(|E|k^2) O ( ∣ E ∣ k 2 ) edges in E C E_C E C .
We now argue on the value of the edge weights of the edge set E S E_S E S .
Claim 7.4. Suppose that the edge weights ω G \omega_G ω G are bounded above by the function f ( n ) f(n) f ( n ) . Then the edge weights ω G S \omega_{G_S} ω G S are bounded above by the function g ( n ) = 3 k ⋅ f ( n ) g(n) = 3k \cdot f(n) g ( n ) = 3 k ⋅ f ( n ) .
Proof. Before bounding the edge weights, we first make a preliminary but important observation: For any pair of vertices u , v ∈ V u, v \in V u , v ∈ V such that v ∈ N k ( u ) v \in N_k(u) v ∈ N k ( u ) , we must have that d G ( u , v ) ≤ ( k − 1 ) f ( n ) d_G(u, v) \le(k - 1)f(n) d G ( u , v ) ≤ ( k − 1 ) f ( n ) . To see this, note that the shortest path from u u u to v v v in G G G necessarily has at most ( k − 1 ) (k - 1) ( k − 1 ) edges; otherwise the first k k k vertices along this path, including u u u and excluding v v v , form a better k k k -nearest neighbourhood for u u u .
We now recall the definitions of the edge weights for E C E_C E C and E B E_B E B .
For any edge { s a , s b } ∈ E C \{s_a, s_b\} \in E_C { s a , s b } ∈ E C , recall that the edge weight
ω E C ( s a , s b ) = d G ( s a , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , s b ) , \omega_{E_C}(s_a, s_b) = d_G(s_a, u) + d_G(u, t) + \omega_G(t, v) + d_G(v, s_b), ω E C ( s a , s b ) = d G ( s a , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , s b ) ,
such that t , s a ∈ N k ( u ) t, s_a \in N_k(u) t , s a ∈ N k ( u ) and s b ∈ N k ( v ) s_b \in N_k(v) s b ∈ N k ( v ) . By the earlier observation, we have that d G ( s a , u ) + d G ( u , t ) + d G ( v , s b ) ≤ ( 3 k − 3 ) f ( n ) d_G(s_a, u) + d_G(u, t) + d_G(v, s_b) \le(3k - 3)f(n) d G ( s a , u ) + d G ( u , t ) + d G ( v , s b ) ≤ ( 3 k − 3 ) f ( n ) . Including the weight ω G ( t , v ) \omega_G(t, v) ω G ( t , v ) , we find that ω E C ( s a , s b ) ≤ ( 3 k − 2 ) ⋅ f ( n ) ≤ 3 k ⋅ f ( n ) \omega_{E_C}(s_a, s_b) \le(3k - 2) \cdot f(n) \le3k \cdot f(n) ω E C ( s a , s b ) ≤ ( 3 k − 2 ) ⋅ f ( n ) ≤ 3 k ⋅ f ( n ) .
For any edge { s , t } \{s, t\} { s , t } in E B E_B E B where t ∈ B t \in B t ∈ B , recall that there exists some vertex x ∈ V x \in V x ∈ V such that c ( x ) = s c(x) = s c ( x ) = s , and the edge weight ω E B ( s , t ) \omega_{E_B}(s, t) ω E B ( s , t ) is either one of the following:
ω E B ( s , t ) = d G ( s , x ) + d G ( x , t ) \omega_{E_B}(s, t) = d_G(s, x) + d_G(x, t) ω E B ( s , t ) = d G ( s , x ) + d G ( x , t ) such that t ∈ N k ( x ) t \in N_k(x) t ∈ N k ( x ) ; or
ω E B ( s , t ) = d G ( s , x ) + ω G ( x , t ) \omega_{E_B}(s, t) = d_G(s, x) + \omega_G(x, t) ω E B ( s , t ) = d G ( s , x ) + ω G ( x , t ) such that { x , t } ∈ E \{x, t\} \in E { x , t } ∈ E (or t = x t = x t = x ).
In the former case, the weight is bounded by ( 2 k − 2 ) ⋅ f ( n ) ≤ 2 k ⋅ f ( n ) (2k - 2) \cdot f(n) \le2k \cdot f(n) ( 2 k − 2 ) ⋅ f ( n ) ≤ 2 k ⋅ f ( n ) , while in the latter case, the weight is bounded by k ⋅ f ( n ) k \cdot f(n) k ⋅ f ( n ) . Therefore, we find that ω E B ( s , t ) ≤ max [ 2 k , k ] ⋅ f ( n ) = 2 k ⋅ f ( n ) \omega_{E_B}(s, t) \le\max[2k, k] \cdot f(n) = 2k \cdot f(n) ω E B ( s , t ) ≤ max [ 2 k , k ] ⋅ f ( n ) = 2 k ⋅ f ( n ) .
Overall, we find that for all edges { x , y } ∈ E S \{x, y\} \in E_S { x , y } ∈ E S , we must have that ω G S ( x , y ) ≤ max [ 3 k , 2 k ] ⋅ f ( n ) = 3 k ⋅ f ( n ) \omega_{G_S}(x, y) \le\max[3k, 2k] \cdot f(n) = 3k \cdot f(n) ω G S ( x , y ) ≤ max [ 3 k , 2 k ] ⋅ f ( n ) = 3 k ⋅ f ( n ) .
The following claim is a lower bound on the distances in G S G_S G S . Namely, for any pair of vertices in G G G , we show that their distances do not shrink in G S G_S G S .
Claim 7.5. For any pair of vertices u , v ∈ V S u, v \in V_S u , v ∈ V S , we have d G ( u , v ) ≤ d G S ( u , v ) d_G(u, v) \le d_{G_S}(u, v) d G ( u , v ) ≤ d G S ( u , v ) .
Proof. We recall the definitions of the edge weights for E C E_C E C and E B E_B E B .
Recalling the definition of E C E_C E C , observe that for any edge { x , y } ∈ E C \{x, y\} \in E_C { x , y } ∈ E C , the edge weight ω E C ( x , y ) \omega_{E_C}(x, y) ω E C ( x , y ) is equivalent to the length of the path x ⇝ u ⇝ t → v ⇝ y x \leadsto u \leadsto t \to v \leadsto y x ⇝ u ⇝ t → v ⇝ y in G G G (for some vertices u , v , t u, v, t u , v , t as per the definition of E C E_C E C ). Namely, the length of this path is necessarily at least d G ( x , y ) d_G(x, y) d G ( x , y ) .
Similarly, recalling the definition of E B E_B E B , observe that for any edge { s , t } ∈ E B \{s,t\}\in E_B { s , t } ∈ E B and fixing t t t to be the bad vertex, the edge weight ω E B ( s , t ) \omega_{E_B}(s,t) ω E B ( s , t ) is equivalent to the length of the path s ⇝ u ⇝ t s\leadsto u\leadsto t s ⇝ u ⇝ t or s ⇝ v → t s\leadsto v\to t s ⇝ v → t (for some vertices u , v u,v u , v as per the definition of E B E_B E B ). Namely, the length of this path is necessarily at least d G ( s , t ) d_G(s,t) d G ( s , t ) .
Therefore, for any edge { x , y } ∈ E S \{x,y\}\in E_S { x , y } ∈ E S , we necessarily have that ω E S ( x , y ) ≥ d G ( x , y ) \omega_{E_S}(x,y)\ge d_G(x,y) ω E S ( x , y ) ≥ d G ( x , y ) . By extension, for any vertices u , v ∈ V S u,v\in V_S u , v ∈ V S , the length of any path from u u u to v v v contained in E S E_S E S is at least d G ( u , v ) d_G(u,v) d G ( u , v ) . From this observation, the claim directly follows.
We now show the most important claim: Between any pair of vertices in G G G that are not in the k k k -nearest neighbourhood of each other, there exists a path in E k ∪ E S E_k\cup E_S E k ∪ E S with the properties (P1) and (P2) described in Definition 3.1. Before proving this claim, it helps to prove the following result which gives us a way to transform a path in the original construction G S ∗ G_S^* G S ∗ to a path in the modified construction G S G_S G S of at most the same path distance.
Claim 7.6. For any edge { x , y } ∈ E S ∗ \{x,y\}\in E_S^* { x , y } ∈ E S ∗ in the original construction G S ∗ G_S^* G S ∗ , the shortest path from x x x to y y y in the modified construction G S G_S G S is at most the edge weight in G S ∗ G_S^* G S ∗ , i.e., d G S ( x , y ) ≤ ω G S ∗ ( x , y ) d_{G_S}(x,y)\le\omega_{G_S^*}(x,y) d G S ( x , y ) ≤ ω G S ∗ ( x , y ) .
Proof. Recall the original construction G S ∗ G_S^* G S ∗ : For any edge { x , y } ∈ E S ∗ \{x,y\}\in E_S^* { x , y } ∈ E S ∗ , the edge weight is given by ω G S ∗ ( x , y ) = d G ( x , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , y ) \omega_{G_S^*}(x,y)=d_G(x,u)+d_G(u,t)+\omega_G(t,v)+d_G(v,y) ω G S ∗ ( x , y ) = d G ( x , u ) + d G ( u , t ) + ω G ( t , v ) + d G ( v , y ) for some vertices t , u , v ∈ V t,u,v\in V t , u , v ∈ V such that c ( u ) = x c(u)=x c ( u ) = x and c ( v ) = y c(v)=y c ( v ) = y . Now consider these same vertices but in the modified construction G S G_S G S . There are two possible cases:
Case 1: t t t is a good vertex. Recalling the construction for E C E_C E C , we must have that the edge { x , y } \{x,y\} { x , y } is also added into E C E_C E C . Since we always take the minimum weight of parallel edges, we have that the edge weight ω E C ( x , y ) ≤ ω G S ∗ ( x , y ) \omega_{E_C}(x,y)\le\omega_{G_S^*}(x,y) ω E C ( x , y ) ≤ ω G S ∗ ( x , y ) .
Case 2: t t t is a bad vertex. Recalling the construction for E B E_B E B , we must have that the edges { x , t } \{x,t\} { x , t } and { t , y } \{t,y\} { t , y } are added into E B E_B E B . Similarly, since we always take the minimum weight of parallel edges, we have that the weights ω E B ( x , t ) ≤ d G ( x , u ) + d G ( u , t ) \omega_{E_B}(x,t)\le d_G(x,u)+d_G(u,t) ω E B ( x , t ) ≤ d G ( x , u ) + d G ( u , t ) and ω E B ( t , y ) ≤ ω G ( t , v ) + d G ( v , y ) \omega_{E_B}(t,y)\le\omega_G(t,v)+d_G(v,y) ω E B ( t , y ) ≤ ω G ( t , v ) + d G ( v , y ) . Namely, this implies that ω E B ( x , t ) + ω E B ( t , y ) ≤ ω G S ∗ ( x , y ) \omega_{E_B}(x,t)+\omega_{E_B}(t,y)\le\omega_{G_S^*}(x,y) ω E B ( x , t ) + ω E B ( t , y ) ≤ ω G S ∗ ( x , y ) .
We now adapt the earlier proof of Claim 7.1 and apply Claim 7.6 to prove the following claim.
Claim 7.7. For any pair of vertices u , v ∈ V u,v\in V u , v ∈ V such that u ∉ N k ( v ) u\notin N_k(v) u ∈ / N k ( v ) and v ∉ N k ( u ) v\notin N_k(u) v ∈ / N k ( u ) , there exists a path P P P in E S ∪ E k E_S\cup E_k E S ∪ E k that satisfies the properties (P1) and (P2) given in Definition 3.1.
Proof. First recall the proof of Claim 7.1 : For the vertices u , v u,v u , v as specified in the hypothesis, there exist edges e 1 = { u , c ( u ) } e_1=\{u,c(u)\} e 1 = { u , c ( u )} , e 2 = { c ( v ) , v } e_2=\{c(v),v\} e 2 = { c ( v ) , v } in E k E_k E k and a path Q Q Q from c ( u ) c(u) c ( u ) to c ( v ) c(v) c ( v ) in G S ∗ G_S^* G S ∗ such that the path from u u u to v v v formed by e 1 e_1 e 1 , e 2 e_2 e 2 and Q Q Q has distance at most 7 ⋅ d G ( u , v ) 7\cdot d_G(u,v) 7 ⋅ d G ( u , v ) .
By applying Claim 7.6 , we construct the path Q ′ Q' Q ′ from c ( u ) c(u) c ( u ) to c ( v ) c(v) c ( v ) in G S G_S G S such that ω ( Q ′ ) ≤ ω ( Q ) \omega(Q')\le\omega(Q) ω ( Q ′ ) ≤ ω ( Q ) . We now define the path P P P in E k ∪ E S E_k\cup E_S E k ∪ E S as follows: u → c ( u ) u\to c(u) u → c ( u ) using the edge e 1 e_1 e 1 , c ( u ) ⇝ c ( v ) c(u)\leadsto c(v) c ( u ) ⇝ c ( v ) using Q ′ Q' Q ′ , and c ( v ) → v c(v)\to v c ( v ) → v using the edge e 2 e_2 e 2 . We now show that P P P obeys properties (P1) and (P2) as defined in Definition 3.1.
Proof of (P1). We have that the length of P P P is at most 7 ⋅ d G ( u , v ) 7\cdot d_G(u,v) 7 ⋅ d G ( u , v ) by the proof of Claim 7.1 . By Claim 7.5 , we also have that the length of P P P is at least d G ( u , v ) d_G(u,v) d G ( u , v ) . Therefore, the length of P P P is indeed a 7-approximation of the distance d G ( u , v ) d_G(u,v) d G ( u , v ) . Proof of (P2). By construction, the first and last edges u → c ( u ) u \to c(u) u → c ( u ) and c ( v ) → v c(v) \to v c ( v ) → v are contained in E k E_k E k , while the remaining edges in Q ′ Q' Q ′ are contained entirely in E S E_S E S .
Lastly, connectivity is now straightforward to show.
Claim 7.8. If G G G is connected, then G S G_S G S is also connected.
Proof. We first show that the vertices in C C C are in the same connected component in G S G_S G S . Suppose not, i.e., there exist vertices x , y ∈ C ⊆ V x,y \in C \subseteq V x , y ∈ C ⊆ V such that x x x and y y y are not in the same connected component in G S G_S G S . In particular, observe that x = c ( x ) x = c(x) x = c ( x ) and y = c ( y ) y = c(y) y = c ( y ) necessarily. There are two possible cases:
Case 1: x ∉ N k ( y ) x \notin N_k(y) x ∈ / N k ( y ) and y ∉ N k ( x ) y \notin N_k(x) y ∈ / N k ( x ) . Since G G G is connected, we find that x x x and y y y are connected by a path, i.e., d G ( x , y ) ≠ ∞ d_G(x,y) \ne\infty d G ( x , y ) = ∞ . By the proof of Claim 7.7 , we find that there is necessarily a path from c ( x ) c(x) c ( x ) to c ( y ) c(y) c ( y ) in G S G_S G S .
Case 2: x ∈ N k ( y ) x \in N_k(y) x ∈ N k ( y ) or y ∈ N k ( x ) y \in N_k(x) y ∈ N k ( x ) . Suppose that x ∈ N k ( y ) x \in N_k(y) x ∈ N k ( y ) ; the other case is similar. Notice that this necessarily satisfies the condition for an edge to be constructed between c ( x ) c(x) c ( x ) and c ( y ) c(y) c ( y ) . Namely, if x x x is a good vertex, then { c ( x ) , c ( y ) } ∈ E C \{c(x),c(y)\} \in E_C { c ( x ) , c ( y )} ∈ E C ; else, { x , c ( y ) } ∈ E B \{x,c(y)\} \in E_B { x , c ( y )} ∈ E B .
In either case, we get a contradiction. Considering now any vertex t ∈ V S ∖ C t \in V_S \setminus C t ∈ V S ∖ C , note that t t t is necessarily a bad vertex. In other words, we have that the edge { t , c ( t ) } ∈ E B \{t,c(t)\} \in E_B { t , c ( t )} ∈ E B by definition. This suffices to show the claim.
To summarise the above results, we present this final claim on correctness.
Claim 7.9. The graph G S = ( V S , E S ) G_S = (V_S,E_S) G S = ( V S , E S ) is a skeleton graph for G G G as defined in Definition 3.1. Additionally, we have ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) |E_S| \in O(|E|k^2) ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) .
Proof. By Claims 7.2 , 7.4 , 7.5 , 7.7 and 7.8 , it follows directly that G S G_S G S is a skeleton graph for G G G according to Definition 3.1. Additionally by Claim 7.3 , we have ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) |E_S| \in O(|E|k^2) ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) as desired.
Algorithm Description
The most critical part of the algorithm description is constructing the edge sets E C E_C E C and E B E_B E B (as defined in the modified construction). The high-level idea is for every vertex u ∈ V u \in V u ∈ V to communicate the following values:
( c ( u ) , d G ( u , c ( u ) ) + d G ( u , t ) ) (c(u),d_G(u,c(u)) + d_G(u,t)) ( c ( u ) , d G ( u , c ( u )) + d G ( u , t )) to every vertex t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) .
( c ( u ) , d G ( u , c ( u ) ) + ω G ( u , t ) ) (c(u),d_G(u,c(u)) + \omega_G(u,t)) ( c ( u ) , d G ( u , c ( u )) + ω G ( u , t )) to every vertex t t t adjacent to u u u in G G G .
We then delegate the construction of E C E_C E C to the good vertices, and the construction of E B E_B E B to the bad vertices. More concretely, every t ∉ B t \notin B t ∈ / B constructs the edges { c ( u ) , c ( v ) } \{c(u),c(v)\} { c ( u ) , c ( v )} for every u , v ∈ V u,v \in V u , v ∈ V such that t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) and { t , v } ∈ E \{t,v\} \in E { t , v } ∈ E (or t = v t = v t = v ), which follows the familiar duplication–labelling procedure (as described previously in the algorithms for Lemma 3.3 and Lemma 3.4). For every vertex t ∈ B t \in B t ∈ B , it constructs the edges { c ( u ) , t } \{c(u),t\} { c ( u ) , t } for every u u u such that t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) , and the edges { c ( v ) , t } \{c(v),t\} { c ( v ) , t } for every incident edge { v , t } ∈ E \{v,t\} \in E { v , t } ∈ E (or t = v t = v t = v ). Overall, we show that this requires O ( 1 ) O(1) O ( 1 ) rounds with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory. Similar to the previous algorithm descriptions, we use the term packets to describe discrete units of information.
Step 0: Initialisation. We may assume that for every edge { u , v } ∈ E \{u,v\} \in E { u , v } ∈ E , there exist two copies of this edge across the machines in the form ( E a d j , u , { u , v } , ω G ( u , v ) ) (\mathcal{E}_{\mathrm{adj}},u,\{u,v\},\omega_G(u,v)) ( E adj , u , { u , v } , ω G ( u , v )) and ( E a d j , v , { u , v } , ω G ( u , v ) ) (\mathcal{E}_{\mathrm{adj}},v,\{u,v\},\omega_G(u,v)) ( E adj , v , { u , v } , ω G ( u , v )) . Likewise for every edge { u , w } ∈ E k \{u,w\} \in E_k { u , w } ∈ E k , there exist two copies of this edge in the form ( E k -near , u , { u , w } , d G ( u , w ) ) (\mathcal{E}_{k\text{-near}},u,\{u,w\},d_G(u,w)) ( E k -near , u , { u , w } , d G ( u , w )) and ( E k -near , w , { u , w } , d G ( u , w ) ) (\mathcal{E}_{k\text{-near}},w,\{u,w\},d_G(u,w)) ( E k -near , w , { u , w } , d G ( u , w )) .
As a preliminary step, we first sort the edges using Lemma 2.5 such that for every vertex u ∈ V u \in V u ∈ V , we have the packets
{ ( E a d j , u , { u , v } , ω G ( u , v ) ) : { u , v } ∈ E } and { ( E k -near , u , { u , w } , d G ( u , w ) ) : w ∈ N k ( u ) } \{(\mathcal{E}_{\mathrm{adj}},u,\{u,v\},\omega_G(u,v)):\{u,v\}\in E\}\quad\text{and}\quad\{(\mathcal{E}_{k\text{-near}},u,\{u,w\},d_G(u,w)):w\in N_k(u)\} {( E adj , u , { u , v } , ω G ( u , v )) : { u , v } ∈ E } and {( E k -near , u , { u , w } , d G ( u , w )) : w ∈ N k ( u )}
stored on a contiguous set of machines M ( u ) M(u) M ( u ) with leader M ^ ( u ) \widehat{M}(u) M ( u ) . With another O ( 1 ) O(1) O ( 1 ) rounds, we allow every leader M ^ ( u ) \widehat{M}(u) M ( u ) to know the set N k ( u ) N_k(u) N k ( u ) (recall that k ∈ O ( n γ ) k \in O(n^\gamma) k ∈ O ( n γ ) by assumption).
Step 1: Constructing the Hitting Set C C C . The objective in this step is to construct the packets ( u , c ( u ) ) (u,c(u)) ( u , c ( u )) for all vertices u ∈ V u \in V u ∈ V . We first describe how to construct the hitting set C C C , which we execute via a random sampling process. The high-level idea is as follows:
We start with C = ∅ C=\varnothing C = ∅ . Each vertex selects itself into C C C with probability ( ln k ) / k (\ln k)/k ( ln k ) / k .
For every vertex u ∈ V u \in V u ∈ V such that N k ( u ) ∩ C = ∅ N_k(u) \cap C=\varnothing N k ( u ) ∩ C = ∅ , we add u u u to C C C .
By construction, C C C must be a hitting set for the neighbourhoods { N k ( u ) : u ∈ V } \{N_k(u):u\in V\} { N k ( u ) : u ∈ V } . It can be shown that by repeating this procedure Θ ( log n ) \Theta(\log n) Θ ( log n ) times, we will have at least one execution where ∣ C ∣ ∈ Θ ( ( n log k ) / k ) |C|\in\Theta((n\log k)/k) ∣ C ∣ ∈ Θ (( n log k ) / k ) w.h.p., see [11 Lemma 6.1, arXiv2405.02695v2] or [DFK+21, Lemma 4.1].
We now translate this idea into the language of the MPC model.
For every vertex u ∈ V u \in V u ∈ V , the leader M ^ ( u ) \widehat{M}(u) M ( u ) locally selects u u u into C C C with probability ( ln k ) / k (\ln k)/k ( ln k ) / k . Denoting
i u = { 1 if u is added in C 0 otherwise, i_u =
\begin{cases}
1 & \text{if }u\text{ is added in }C\\
0 & \text{otherwise,}
\end{cases} i u = { 1 0 if u is added in C otherwise,
we relabel every k k k -nearest edge packet into the form ( E k -near , v , { u , v } , d G ( u , v ) , i u , i v ) (\mathcal{E}_{k\text{-near}},v,\{u,v\},d_G(u,v),i_u,i_v) ( E k -near , v , { u , v } , d G ( u , v ) , i u , i v ) which can be done in O ( 1 ) O(1) O ( 1 ) rounds via the MPC tools in Lemma 2.5 .
Every leader M ^ ( u ) \widehat{M}(u) M ( u ) locally determines whether N k ( u ) ∩ C = ∅ N_k(u)\cap C=\varnothing N k ( u ) ∩ C = ∅ ; if this is true, it adds u u u to C C C .
The edge packets are re-labelled with the updated values for i u i_u i u (for each vertex u ∈ V u \in V u ∈ V ) in O ( 1 ) O(1) O ( 1 ) rounds. Subsequently, each leader M ^ ( u ) \widehat{M}(u) M ( u ) chooses c ( u ) c(u) c ( u ) as the vertex in C ∩ N k ( u ) C\cap N_k(u) C ∩ N k ( u ) that is closest to u u u .
We execute the above procedure Θ ( log n ) \Theta(\log n) Θ ( log n ) times in parallel . We then choose an execution where ∣ C ∣ ∈ O ( ( n log k ) / k ) |C|\in O((n\log k)/k) ∣ C ∣ ∈ O (( n log k ) / k ) – such an execution occurs w.h.p. – and construct the packets ( u , c ( u ) ) (u,c(u)) ( u , c ( u )) corresponding to that particular execution, for all vertices u ∈ V u\in V u ∈ V . Overall, this step requires O ( 1 ) O(1) O ( 1 ) rounds in total.
Step 2: Communicating Preliminary Information. Before constructing the edge sets E C E_C E C and E B E_B E B , we first require the communication of some preliminary information. Namely, the objective of this step is to construct the values { ( c ( u ) , d G ( c ( u ) , u ) + d G ( u , t ) ) : t ∈ N k ( u ) } \{(c(u),d_G(c(u),u)+d_G(u,t)):t\in N_k(u)\} {( c ( u ) , d G ( c ( u ) , u ) + d G ( u , t )) : t ∈ N k ( u )} and { ( c ( u ) , d G ( c ( u ) , u ) + ω G ( u , t ) ) : { u , t } ∈ E } \{(c(u),d_G(c(u),u)+\omega_G(u,t)):\{u,t\}\in E\} {( c ( u ) , d G ( c ( u ) , u ) + ω G ( u , t )) : { u , t } ∈ E } for all vertices u ∈ V u\in V u ∈ V , and to communicate these values to the respective vertices.
We do so in the following way: Following from Step 0, for every vertex u ∈ V u\in V u ∈ V , there exists a contiguous segment of machines M ( u ) M(u) M ( u ) that contains the edges incident to u u u in E ∪ E k E\cup E_k E ∪ E k . In particular, the leader machine M ^ ( u ) \widehat{M}(u) M ( u ) knows the k k k -nearest neighbourhood N k ( u ) N_k(u) N k ( u ) and the value ( u , c ( u ) , d G ( u , c ( u ) ) ) (u,c(u),d_G(u,c(u))) ( u , c ( u ) , d G ( u , c ( u ))) .
M ^ ( u ) \widehat{M}(u) M ( u ) broadcasts the value ( u , c ( u ) , d G ( u , c ( u ) ) ) (u,c(u),d_G(u,c(u))) ( u , c ( u ) , d G ( u , c ( u ))) to the machines in M ( u ) M(u) M ( u ) (using Lemma 2.5 ).
For every vertex t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , we construct the request packet
( R k - n e a r , t , c ( u ) , d G ( u , c ( u ) ) + d G ( u , t ) ) , (\mathcal{R}_{\mathrm{k\text{-}near}},t,c(u),d_G(u,c(u))+d_G(u,t)), ( R k - near , t , c ( u ) , d G ( u , c ( u )) + d G ( u , t )) ,
which is done locally on the machines M ( u ) M(u) M ( u ) .
For every edge { u , t } ∈ E \{u,t\}\in E { u , t } ∈ E (and for u = t u=t u = t ), we construct the request packet
( R a d j , t , c ( u ) , d G ( u , c ( u ) ) + ω G ( u , t ) ) , (\mathcal{R}_{\mathrm{adj}},t,c(u),d_G(u,c(u))+\omega_G(u,t)), ( R adj , t , c ( u ) , d G ( u , c ( u )) + ω G ( u , t )) ,
which is also done locally on the machines M ( u ) M(u) M ( u ) .
By applying a sorting procedure (Lemma 2.5 ), every vertex t ∈ V t\in V t ∈ V now has the packets
( R k - n e a r , t , c ( u ) , d G ( u , c ( u ) ) + d G ( u , t ) ) (\mathcal{R}_{\mathrm{k\text{-}near}},t,c(u),d_G(u,c(u))+d_G(u,t)) ( R k - near , t , c ( u ) , d G ( u , c ( u )) + d G ( u , t )) for every vertex u ∈ V u\in V u ∈ V such that t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , and
( R a d j , t , c ( v ) , d G ( v , c ( v ) ) + ω G ( v , t ) ) (\mathcal{R}_{\mathrm{adj}},t,c(v),d_G(v,c(v))+\omega_G(v,t)) ( R adj , t , c ( v ) , d G ( v , c ( v )) + ω G ( v , t )) for every vertex v v v such that { v , t } ∈ E \{v,t\}\in E { v , t } ∈ E (or v = t v=t v = t ).
stored on a (possibly different) contiguous segment of machines M ( t ) M(t) M ( t ) with leader M ^ ( t ) \widehat{M}(t) M ( t ) . This entire step runs in O ( 1 ) O(1) O ( 1 ) rounds.
Step 3: Identifying Bad Vertices B B B . Recalling the definition of a bad vertex, it suffices for each vertex t ∈ V t\in V t ∈ V to count the number of packets of the form ( R k - n e a r , t , … ) (\mathcal{R}_{\mathrm{k\text{-}near}},t,\ldots) ( R k - near , t , … ) , which we execute by performing the prefix sum and sorting sub-routines in Lemma 2.5 . At the end of this procedure, the leader M ^ ( t ) \widehat{M}(t) M ( t ) knows the number of packets ( R k - n e a r , t , … ) (\mathcal{R}_{\mathrm{k\text{-}near}},t,\ldots) ( R k - near , t , … ) . More concretely, defining
b t = { 1 if ∣ { ( R k - n e a r , t , … ) } ∣ > k 2 0 otherwise, b_t =
\begin{cases}
1 & \text{if } \left|\{(\mathcal{R}_{\mathrm{k\text{-}near}},t,\ldots)\}\right|>k^2\\
0 & \text{otherwise,}
\end{cases} b t = { 1 0 if ∣ {( R k - near , t , … )} ∣ > k 2 otherwise,
M ^ ( t ) \widehat{M}(t) M ( t ) determines the value ( t , b t ) (t,b_t) ( t , b t ) and distributes this value to the other machines in M ( t ) M(t) M ( t ) (using Lemma 2.5 ). Overall, this entire step runs in O ( 1 ) O(1) O ( 1 ) rounds.
Step 4: Building Edges in E C E_C E C . For every vertex t ∉ B t\notin B t ∈ / B , our objective is the following: For every pair of request packets ( R k - n e a r , t , s a , w a ) (\mathcal{R}_{\mathrm{k\text{-}near}},t,s_a,w_a) ( R k - near , t , s a , w a ) and ( R a d j , t , s b , w b ) (\mathcal{R}_{\mathrm{adj}},t,s_b,w_b) ( R adj , t , s b , w b ) , create a new edge { s a , s b } \{s_a,s_b\} { s a , s b } with the edge weight ( w a + w b ) (w_a+w_b) ( w a + w b ) . For ease of notation, denote
K t = { ( c ( u ) , d G ( u , c ( u ) ) + d G ( u , t ) ) : t ∈ N k ( u ) } , K_t=\{(c(u),d_G(u,c(u))+d_G(u,t)):t\in N_k(u)\}, K t = {( c ( u ) , d G ( u , c ( u )) + d G ( u , t )) : t ∈ N k ( u )} ,
A t = { ( c ( v ) , d G ( v , c ( v ) ) + ω G ( v , t ) ) : { t , v } ∈ E ∨ t = v } , A_t=\{(c(v),d_G(v,c(v))+\omega_G(v,t)):\{t,v\}\in E\vee t=v\}, A t = {( c ( v ) , d G ( v , c ( v )) + ω G ( v , t )) : { t , v } ∈ E ∨ t = v } ,
with a t = ∣ A t ∣ a_t=|A_t| a t = ∣ A t ∣ . Our plan is to create a t a_t a t duplicates of the set K t K_t K t , and “label” each duplicate with a value from A t A_t A t . Therefore, we perform the following:
We first apply Lemma A.1 to create a t a_t a t duplicates of K t K_t K t in the form ( K t , 1 ) , ( K t , 2 ) , … , ( K t , a t ) (K_t,1),(K_t,2),\ldots,(K_t,a_t) ( K t , 1 ) , ( K t , 2 ) , … , ( K t , a t ) .
We next apply Lemma A.2 to relabel each duplicate with a value in A t A_t A t . In other words, denoting A t = { ( s 1 , w 1 ) , ( s 2 , w 2 ) , … , ( s a t , w a t ) } A_t=\{(s_1,w_1),(s_2,w_2),\ldots,(s_{a_t},w_{a_t})\} A t = {( s 1 , w 1 ) , ( s 2 , w 2 ) , … , ( s a t , w a t )} , we now have the duplicates in the form of ( K t , ( s 1 , w 1 ) ) , ( K t , ( s 2 , w 2 ) ) , … , ( K t , ( s a t , w a t ) ) (K_t,(s_1,w_1)),(K_t,(s_2,w_2)),\ldots,(K_t,(s_{a_t},w_{a_t})) ( K t , ( s 1 , w 1 )) , ( K t , ( s 2 , w 2 )) , … , ( K t , ( s a t , w a t )) .
Lastly, for each duplicate ( K t , ( s j , w j ) ) (K_t,(s_j,w_j)) ( K t , ( s j , w j )) , we re-construct each packet in K t K_t K t from ( R k - n e a r , t , s , w ) (R_{\mathrm{k\text{-}near}},t,s,w) ( R k - near , t , s , w ) into the edge ( { s , s j } , w + w j ) (\{s,s_j\},w+w_j) ({ s , s j } , w + w j ) .
Since t ∉ B t\notin B t ∈ / B , we have that ∣ K t ∣ ≤ k 2 |K_t|\leq k^2 ∣ K t ∣ ≤ k 2 . Additionally, we also observe that ∑ t ∉ B a t ∈ O ( ∣ E ∣ ) \sum_{t\notin B}a_t\in O(|E|) ∑ t ∈ / B a t ∈ O ( ∣ E ∣ ) . Lastly recalling that k 2 ∈ O ( n γ ) k^2\in O(n^\gamma) k 2 ∈ O ( n γ ) by assumption, we find that the above procedure can be executed in O ( 1 ) O(1) O ( 1 ) rounds with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) additional memory. This completes the construction of the edge set E C E_C E C .
Step 5: Building Edges in E B E_B E B . For every vertex t ∈ B t\in B t ∈ B , we perform a simple procedure across the machines in M ( t ) M(t) M ( t ) (from Step 3) to construct edges of E B E_B E B :
For every request packet ( R k - n e a r , t , s a , w a ) (R_{\mathrm{k\text{-}near}},t,s_a,w_a) ( R k - near , t , s a , w a ) received, construct the value ( { t , s a } , w a ) (\{t,s_a\},w_a) ({ t , s a } , w a ) .
For every request packet ( R a d j , t , s b , w b ) (R_{\mathrm{adj}},t,s_b,w_b) ( R adj , t , s b , w b ) received, construct the value ( { t , s b } , w b ) (\{t,s_b\},w_b) ({ t , s b } , w b ) .
This can be done entirely locally, and completes the construction of the edge set E B E_B E B .
Claim 7.10. There exists a randomised algorithm to construct the graph G S G_S G S (as defined in the earlier modified construction) w.h.p. in the sublinear MPC model in O ( 1 ) O(1) O ( 1 ) rounds with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory.
Proof. We apply the algorithm as described above to construct the edge sets E C E_C E C (in Step 4) and E B E_B E B (in Step 5), which completes the construction of G S G_S G S . By the description of the algorithm, we observe each step only requires O ( 1 ) O(1) O ( 1 ) rounds, and therefore the entire algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds as well. Moreover, only Step 4 requires O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) additional memory, with the remaining steps only needing O ~ ( ∣ E ∣ + n k ) \widetilde{O}(|E|+nk) O ( ∣ E ∣ + nk ) total memory (with the extra O ( n k ) O(nk) O ( nk ) memory needed to store the edge set E k E_k E k ). Therefore, it suffices to have O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory overall. □ \square □
The Final Proof. We summarise this section on the skeleton graph with the proof for Lemma 3.2.
Proof of Lemma 3.2. By Claim 7.10, we construct the graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) for G G G as defined in the modified construction in O ( 1 ) O(1) O ( 1 ) rounds and O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory. By Claim 7.9 , we find that G S G_S G S is indeed a skeleton graph for G G G , with the added property that ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) |E_S|\in O(|E|k^2) ∣ E S ∣ ∈ O ( ∣ E ∣ k 2 ) as claimed. □ \square □
MPC Tools
We describe two tools, the duplication lemma and the labelling lemma, that together enable efficient communication of information between vertices. As a motivating example, suppose each vertex holds k k k edges that need to be delivered to d d d other vertices. To facilitate this, we first create d d d duplicates of each of the k k k edges and then label each copy with its intended recipient. The labelled messages can then be routed through a sorting procedure. We show that this entire process can be implemented in a constant number of rounds.
Lemma A.1 (Duplication). Suppose we have n n n sets S 1 , S 2 , … , S n S_1,S_2,\ldots,S_n S 1 , S 2 , … , S n of items such that each set S i S_i S i occupies at most O ( k ) O(k) O ( k ) space for some integer k > 0 k>0 k > 0 . For every set S i S_i S i , the task is to create d i ≥ 1 d_i \ge1 d i ≥ 1 duplicates of the set in the form ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) (S_i,1),(S_i,2),\ldots,(S_i,d_i) ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) .
Given that k ∈ O ( n γ ) k \in O(n^\gamma) k ∈ O ( n γ ) , in the sublinear MPC model with O ( n k + ∑ i = 1 n k d i ) O\left(nk+\sum_{i=1}^{n}kd_i\right) O ( nk + ∑ i = 1 n k d i ) total memory, there exists a deterministic algorithm to accomplish this task for all sets S i S_i S i . This algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds.
Proof. For all i ∈ { 1 , 2 , … , n } i \in\{1,2,\ldots,n\} i ∈ { 1 , 2 , … , n } , we may assume that S i S_i S i and d i d_i d i are appropriately labelled such that there exists a single machine M ^ ( i ) \widehat{M}(i) M ( i ) that completely stores the tuple ( S i , d i ) (S_i,d_i) ( S i , d i ) .
To facilitate the duplication procedure, our goal is to first create “gaps” of memory between the machines; we then fill in the gaps by duplicating the sets. For simplicity, we may assume that each machine has exactly enough local memory to store a single tuple of the form ( S , d ) (S,d) ( S , d ) , where S S S is a set of k k k items and d d d is an integer; the procedure can be generalised for the case of larger local memory.
Define the integers p 0 , p 1 , p 2 , … , p n p_0,p_1,p_2,\ldots,p_n p 0 , p 1 , p 2 , … , p n as follows:
p 0 = 0 , p i = d i + p i − 1 . \begin{aligned}
p_0 &= 0,\\
p_i &= d_i+p_{i-1}.
\end{aligned} p 0 p i = 0 , = d i + p i − 1 .
Using the prefix sum sub-routine in Lemma 2.5 , these integers { p i } \{p_i\} { p i } can be determined in O ( 1 ) O(1) O ( 1 ) rounds. We then sort the values such that each machine M ^ ( i ) \widehat{M}(i) M ( i ) knows the value p i − 1 p_{i-1} p i − 1 .
The machine M ^ ( i ) \widehat{M}(i) M ( i ) sends the tuple ( S i , d i ) (S_i,d_i) ( S i , d i ) to the machine with ID ( p i − 1 + 1 ) (p_{i-1}+1) ( p i − 1 + 1 ) . By our total memory constraints (and our simplifying assumption on the local memory), we have sufficiently many machines to perform this communication.
Denote M ( i ) M(i) M ( i ) as the contiguous set of machines with IDs ( p i − 1 + 1 ) , ( p i − 1 + 2 ) , … , ( p i − 1 + d i ) (p_{i-1}+1),(p_{i-1}+2),\ldots,(p_{i-1}+d_i) ( p i − 1 + 1 ) , ( p i − 1 + 2 ) , … , ( p i − 1 + d i ) , and M ^ ( i ) \widehat{M}(i) M ( i ) as the machine in M ( i ) M(i) M ( i ) with the smallest ID. After the communication procedure in Step 2, M ^ ( i ) \widehat{M}(i) M ( i ) knows the value ( S i , d i ) (S_i,d_i) ( S i , d i ) while the remaining machines in M ( i ) M(i) M ( i ) are empty. Subsequently, M ^ ( i ) \widehat{M}(i) M ( i ) broadcasts the value ( S i , p i − 1 ) (S_i,p_{i-1}) ( S i , p i − 1 ) to the machines in M ( i ) M(i) M ( i ) in O ( 1 ) O(1) O ( 1 ) rounds (Lemma 2.5 ). This enables us to create the duplicates ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) (S_i,1),(S_i,2),\ldots,(S_i,d_i) ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) locally across the machines in M ( i ) M(i) M ( i ) , and we are done.
Overall, this requires O ( 1 ) O(1) O ( 1 ) rounds as claimed.
Lemma A.2 (Labelling). Suppose we have n n n sets S 1 , S 2 , … , S n S_1,S_2,\ldots,S_n S 1 , S 2 , … , S n of items such that each set S i S_i S i occupies at most O ( k ) O(k) O ( k ) space for some integer k > 0 k>0 k > 0 . For every set S i S_i S i , there also exist d i ≥ 1 d_i \ge1 d i ≥ 1 duplicates of S i S_i S i in the form ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) (S_i,1),(S_i,2),\ldots,(S_i,d_i) ( S i , 1 ) , ( S i , 2 ) , … , ( S i , d i ) . Our task is to label each duplicate ( S i , j ) (S_i,j) ( S i , j ) with a label u i , j u_{i,j} u i , j , where each label u i , j u_{i,j} u i , j occupies O ( 1 ) O(1) O ( 1 ) space.
Given that k ∈ O ( n γ ) k \in O(n^\gamma) k ∈ O ( n γ ) , in the sublinear MPC model with O ( n k + ∑ i = 1 n k d i ) O\left(nk+\sum_{i=1}^{n}kd_i\right) O ( nk + ∑ i = 1 n k d i ) total memory, there exists a deterministic algorithm to accomplish this task for all sets S i S_i S i . This algorithm runs in O ( 1 ) O(1) O ( 1 ) rounds.
Proof. We assume that the labels u i , j u_{i,j} u i , j and the sets ( S i , j ) (S_i,j) ( S i , j ) are appropriately labelled such that by performing a sorting procedure (Lemma 2.5 ), there exists a single machine M ( i , j ) M(i,j) M ( i , j ) that completely stores the tuple ( S i , j , u i , j ) (S_i,j,u_{i,j}) ( S i , j , u i , j ) . Subsequently, by means of local computation, we can then relabel ( S i , j ) (S_i,j) ( S i , j ) into ( S i , u i , j ) (S_i,u_{i,j}) ( S i , u i , j ) , and we are done.
Reporting the Path
In this section, our task is the following: Given a weighted undirected graph G = ( V , E ) G=(V,E) G = ( V , E ) , construct a distance oracle that receives a pair of vertices ( u , v ) (u,v) ( u , v ) as query and returns in constant rounds a path P P P in G G G from u u u to v v v such that ω ( P ) \omega(P) ω ( P ) is a constant approximation of d G ( u , v ) d_G(u,v) d G ( u , v ) . We call this a path-reporting distance oracle . We show that this can be accomplished by modifications to our distance oracle algorithms. Namely, our aim is to show the following lemma, which can be seen as a modification of Lemma 4.2 . We remark that when applying this lemma, the connectivity assumption can be relaxed using Lemma 2.6 as before (noting that the technique of Lemma 2.6 almost immediately applies to path-reporting oracles as well).
Lemma B.1. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let c > 0 c>0 c > 0 be a constant such that ∣ E ∣ ∈ O ~ ( n 1 + c / 2 ) |E| \in\widetilde{O}(n^{1+c/2}) ∣ E ∣ ∈ O ( n 1 + c /2 ) . Suppose that for every vertex u ∈ V u \in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u,t):t \in\widetilde{N}_k(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an α \alpha α -approximate k k k -nearest neighbourhood of u u u with k = n c / 4 k=n^{c/4} k = n c /4 .
Given that c ≤ γ c \le\gamma c ≤ γ , in the heterogeneous MPC model with O ~ ( n 1 + c ) \widetilde{O}(n^{1+c}) O ( n 1 + c ) total memory, there exists a randomised algorithm that w.h.p. constructs an O ( 1 / c ) O(1/c) O ( 1/ c ) -approximate path-reporting distance oracle in O ( log a + log log n ) O(\log a+\log\log n) O ( log a + log log n ) rounds. Every subsequent query can then be answered in O ( 1 ) O(1) O ( 1 ) rounds.
The algorithms in this section are presented primarily as modifications to algorithms discussed previously in the main body of this work, and will be nearly identical in proof to those stated in the main body. Therefore for the sake of clarity and presentation, we only sketch these modifications while providing sufficient exposition to motivate them.
We begin by recalling the distance oracle construction of Lemma 4.2 , which consists of the following two components; here, k k k is some small polynomial of n n n determined by the input parameters.
The k k k -nearest edge set E k E_k E k of G G G .
A constant-stretch spanner F = ( V S , E F ) F=(V_S,E_F) F = ( V S , E F ) of the skeleton graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) .
A distance query ( u , v ) (u,v) ( u , v ) is answered as follows. If u ∈ N k ( v ) u\in N_k(v) u ∈ N k ( v ) or v ∈ N k ( u ) v\in N_k(u) v ∈ N k ( u ) , then return the edge weight ω E k ( u , v ) \omega_{E_k}(u,v) ω E k ( u , v ) . Otherwise, we return
δ ( u , v ) : = min x , y ∈ V S ( ω E k ( u , x ) + d F ( x , y ) + ω E k ( y , v ) ) . \delta(u,v):=\min_{x,y\in V_S}\left(\omega_{E_k}(u,x)+d_F(x,y)+\omega_{E_k}(y,v)\right). δ ( u , v ) := x , y ∈ V S min ( ω E k ( u , x ) + d F ( x , y ) + ω E k ( y , v ) ) .
We had previously shown that this can be computed in O ( 1 ) O(1) O ( 1 ) rounds and yields a constant approximation of d G ( u , v ) d_G(u,v) d G ( u , v ) . Our aim is to output a path in the original graph that has length at most δ ( u , v ) \delta(u,v) δ ( u , v ) . Specifically, there are two components to this task:
For each edge { u , v } ∈ E k \{u,v\}\in E_k { u , v } ∈ E k , we should have knowledge of, or be able to compute, some shortest path P P P from u u u to v v v .
Likewise for each edge { x , y } ∈ E F ⊆ E S \{x,y\}\in E_F\subseteq E_S { x , y } ∈ E F ⊆ E S , we should have knowledge of, or be able to compute, a path P P P from x x x to y y y such that ω ( P ) ≤ ω E S ( x , y ) \omega(P)\leq\omega_{E_S}(x,y) ω ( P ) ≤ ω E S ( x , y ) .
We discuss each component separately before combining them to form the proof of Lemma B.1 .
Recovering paths in E k E_k E k . The most immediate attempt would be to modify the building block algorithms Lemma 3.3 and Lemma 3.4 such that each time we shortcut a path (i.e., construct a new edge from a path in the original graph), we also maintain the full path that was shortcut. While this works, we will consider a slightly more space-efficient method that uses a property of k k k -nearest neighbourhoods. Specifically, let ( u , t ) (u,t) ( u , t ) be any vertex pair with t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , and let P P P be any shortest path from u u u to t t t . Observe that for any vertex v v v along P P P , we necessarily have that v ∈ N k ( u ) v\in N_k(u) v ∈ N k ( u ) as well, i.e., all the vertices in P P P are in the k k k -nearest neighbourhood of u u u . Therefore for each edge { u , t } ∈ E k \{u,t\}\in E_k { u , t } ∈ E k , instead of storing the entire shortest path from u u u to t t t , we just store the last edge along this path.
Concretely, alongside the k k k -nearest edge set E k E_k E k , we also desire some set L k ⊆ V 3 L_k\subseteq V^3 L k ⊆ V 3 that satisfies the following properties:
(Size-bounded) ∣ L k ∣ ≤ n k |L_k|\leq nk ∣ L k ∣ ≤ nk .
(Soundness) ( u , z , t ) ∈ L k (u,z,t)\in L_k ( u , z , t ) ∈ L k only if t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) and either (1) the edge { t , z } \{t,z\} { t , z } is on some shortest path from u u u to t t t or (2) t = z = u t=z=u t = z = u .
(Completeness) For all pairs u , t ∈ V u,t\in V u , t ∈ V with t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , there exists some vertex z ∈ V z\in V z ∈ V such that ( u , z , t ) ∈ L k (u,z,t)\in L_k ( u , z , t ) ∈ L k .
Note that for a fixed graph G G G and integer k k k , there may be multiple candidate choices for L k L_k L k . We first show for any pair of vertices u , t ∈ V u,t\in V u , t ∈ V such that t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , the set L k L_k L k is sufficient to recover some shortest path from u u u to t t t .
Lemma B.2. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let integer k > 0 k>0 k > 0 be a parameter. Consider any set L k L_k L k with the properties specified above. For any pair of vertices u , t ∈ V u,t\in V u , t ∈ V such that t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , there exists a path u = v 1 − v 2 − v 3 − ⋯ − v m = t u=v_1-v_2-v_3-\cdots-v_m=t u = v 1 − v 2 − v 3 − ⋯ − v m = t in G G G with m ≤ k m\le k m ≤ k such that (1) the length of this path is d G ( u , t ) d_G(u,t) d G ( u , t ) and (2) for all integers 1 ≤ i ≤ m − 1 1\le i\le m-1 1 ≤ i ≤ m − 1 we have ( u , v i , v i + 1 ) ∈ L k (u,v_i,v_{i+1})\in L_k ( u , v i , v i + 1 ) ∈ L k .
Proof. We first note that any shortest path from u u u to t t t necessarily has at most k k k distinct vertices (including u u u and t t t ); otherwise, the first k k k vertices along the path, counting from u u u , have strictly shorter distances to u u u than that of t t t , hence contradicting t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) (recall that we consider only positive edge weights). Consequently, for any shortest path from u u u to t t t , all vertices along the path are necessarily in N k ( u ) N_k(u) N k ( u ) as well.
We will prove the claim by induction on d G ( u , t ) d_G(u,t) d G ( u , t ) . In the base case, we have d G ( u , t ) = 0 d_G(u,t)=0 d G ( u , t ) = 0 and t = u t=u t = u necessarily; the claim immediately follows by the properties of L k L_k L k .
In the inductive case, suppose the claim holds for all distances at most ℓ \ell ℓ and that d G ( u , t ) = ℓ + 1 d_G(u,t)=\ell+1 d G ( u , t ) = ℓ + 1 . By the properties of L k L_k L k , observe that there exists some vertex z ∈ N k ( u ) z\in N_k(u) z ∈ N k ( u ) such that ( u , z , t ) ∈ L k (u,z,t)\in L_k ( u , z , t ) ∈ L k . In particular, notice that d G ( u , z ) < d G ( u , t ) d_G(u,z)<d_G(u,t) d G ( u , z ) < d G ( u , t ) – this follows from the observation that the edge { z , t } \{z,t\} { z , t } is on some shortest path from u u u to t t t , and hence d G ( u , t ) = d G ( u , z ) + ω G ( z , t ) d_G(u,t)=d_G(u,z)+\omega_G(z,t) d G ( u , t ) = d G ( u , z ) + ω G ( z , t ) . Therefore, applying the induction hypothesis on ( u , z ) (u,z) ( u , z ) , there exists a path u = v 1 − v 2 − ⋯ − v m = z u=v_1-v_2-\cdots-v_m=z u = v 1 − v 2 − ⋯ − v m = z of length d G ( u , z ) d_G(u,z) d G ( u , z ) such that ( u , v i , v i + 1 ) ∈ L k (u,v_i,v_{i+1})\in L_k ( u , v i , v i + 1 ) ∈ L k for all integers $1\le i\le m-1. The claim now follows by directly appending the edge { z , t } \{z,t\} { z , t } to the end of this path and noticing that the new path indeed has length exactly d G ( u , t ) d_G(u,t) d G ( u , t ) ; by an earlier observation, we find that the new path has at most k k k distinct vertices as well.
We now show that given approximate k k k -nearest neighbourhoods for all vertices, we can efficiently construct a set L k L_k L k satisfying the above properties alongside constructing the k k k -nearest set E k E_k E k . In particular, it suffices for us to introduce small modifications to the algorithm of Lemma 4.1 .
Lemma B.3. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let integer k > 0 k>0 k > 0 be a parameter. Suppose that for every vertex u ∈ V u\in V u ∈ V , we are given the set { ( u , t ) : t ∈ N ~ k ( u ) } \{(u,t):t\in\widetilde{N}_k(u)\} {( u , t ) : t ∈ N k ( u )} , where N ~ k ( u ) \widetilde{N}_k(u) N k ( u ) is an a a a -approximate k k k -nearest neighbourhood of u u u .
Given that k 2 ∈ O ( n γ ) k^2\in O(n^\gamma) k 2 ∈ O ( n γ ) , in the sublinear MPC model with O ~ ( ∣ E ∣ + n k 2 ) \widetilde{O}(|E|+nk^2) O ( ∣ E ∣ + n k 2 ) total memory, there exists a deterministic algorithm for constructing the k k k -nearest edge set E k E_k E k and some set L k L_k L k (satisfying the above properties) for G G G in O ( log log d + log a ) O(\log\log d+\log a) O ( log log d + log a ) rounds, where d d d is the weighted diameter of G G G .
Proof Sketch. Recall that the original algorithm of Lemma 4.1 was simply a direct combination of two previous algorithms: Lemma 3.3 and Lemma 3.4, the algorithms for constructing a k k k -nearest hopset and extracting exact k k k -nearest neighbourhoods respectively. Separately, we show how to modify these algorithms to yield the desired output.
Modifying Lemma 3.3. Recall that each hopset edge represents some path in the original graph G G G . We modify the output of the algorithm such that for each edge e e e in the hopset H H H , we also include the first and last edges of the path represented by e e e .
Modifying Lemma 3.4. We modify the algorithm such that in each iteration i i i of the graph exponentiation, we update both E k E_k E k and L k L_k L k corresponding to the new “local” view of the k k k -nearest neighbourhoods for each vertex. Crucially for L k L_k L k , we want to maintain paths in the original graph G G G instead of the graph G ∪ H G\cup H G ∪ H – this is enabled by the above modification to Lemma 3.3 . After sufficient iterations, the algorithm outputs both E k E_k E k and L k L_k L k corresponding to the true k k k -nearest neighbourhoods.
Recovering paths in G S G_S G S . Again, the most obvious attempt seems to be modifying the algorithm of Lemma 3.2 such that each time we shortcut a path in G G G to form an edge in G S G_S G S , we also maintain the original path in G G G . However, we will utilise our specific implementation of the skeleton graph algorithm to suggest a more space-efficient procedure.
Consider a skeleton graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) constructed using Lemma 3.2 from a graph G = ( V , E ) G=(V,E) G = ( V , E ) and parameter k k k . We recall the algorithm description for Lemma 3.2. Namely, each edge { x , y } ∈ E S \{x,y\}\in E_S { x , y } ∈ E S (oriented appropriately) satisfies one of the following cases.
Case 1. There exists a vertex u ∈ V u\in V u ∈ V such that ω E S ( x , y ) = d G ( x , u ) + d G ( u , y ) \omega_{E_S}(x,y)=d_G(x,u)+d_G(u,y) ω E S ( x , y ) = d G ( x , u ) + d G ( u , y ) satisfying that x , y ∈ N k ( u ) x,y\in N_k(u) x , y ∈ N k ( u ) .
Case 2. There exists a vertex v ∈ V v\in V v ∈ V such that ω E S ( x , y ) = ω G ( x , v ) + d G ( v , y ) \omega_{E_S}(x,y)=\omega_G(x,v)+d_G(v,y) ω E S ( x , y ) = ω G ( x , v ) + d G ( v , y ) satisfying that y ∈ N k ( v ) y\in N_k(v) y ∈ N k ( v ) , and { x , v } ∈ E \{x,v\}\in E { x , v } ∈ E or x = v x=v x = v .
Case 3. There exist vertices u , t , v ∈ V u,t,v\in V u , t , v ∈ V such that all of the following hold:
x ∈ N k ( u ) x\in N_k(u) x ∈ N k ( u ) and y ∈ N k ( v ) y\in N_k(v) y ∈ N k ( v ) .
t ∈ N k ( u ) t\in N_k(u) t ∈ N k ( u ) , and either { t , v } ∈ E \{t,v\}\in E { t , v } ∈ E or t = v t=v t = v .
ω E S ( x , y ) = d G ( x , u ) + d G ( u , t ) + ω ( t , v ) + d G ( v , y ) \omega_{E_S}(x,y)=d_G(x,u)+d_G(u,t)+\omega(t,v)+d_G(v,y) ω E S ( x , y ) = d G ( x , u ) + d G ( u , t ) + ω ( t , v ) + d G ( v , y ) .
Specifically, the edges in the edge set E B E_B E B fall under Cases 1 and 2 while the edges in the edge set E C E_C E C fall under Case 3 (recalling the definition of E B E_B E B and E C E_C E C from § 8 ). This motivates us to modify the algorithm for Lemma 3.2 in the following way: When we construct any edge { x , y } ∈ E S \{x,y\}\in E_S { x , y } ∈ E S , we maintain which of the three cases this edge falls under as well as the vertices in G G G that were used to construct this edge.
Concretely, alongside the skeleton graph G S = ( V S , E S ) G_S=(V_S,E_S) G S = ( V S , E S ) , we also desire some set L S ⊆ E S × ( V 3 ⊔ V 5 ) × { 1 , 2 , 3 } L_S\subseteq E_S\times(V^3\sqcup V^5)\times\{1,2,3\} L S ⊆ E S × ( V 3 ⊔ V 5 ) × { 1 , 2 , 3 } satisfying the following properties.
(Size-bounded) ∣ L S ∣ = ∣ E S ∣ |L_S|=|E_S| ∣ L S ∣ = ∣ E S ∣ .
(Soundness) For any ( { x , y } , τ , i ) ∈ L S (\{x,y\},\tau,i)\in L_S ({ x , y } , τ , i ) ∈ L S , we have the following; assume that { x , y } \{x,y\} { x , y } is oriented appropriately such that it satisfies at least one of the above cases.
If { x , y } \{x,y\} { x , y } satisfies Case 1, then i = 1 i=1 i = 1 and τ = ( x , u , y ) \tau=(x,u,y) τ = ( x , u , y ) for some vertex u ∈ V u\in V u ∈ V such that ω E S ( x , y ) = d G ( x , u ) + d G ( u , y ) \omega_{E_S}(x,y)=d_G(x,u)+d_G(u,y) ω E S ( x , y ) = d G ( x , u ) + d G ( u , y ) and x , y ∈ N k ( u ) x,y\in N_k(u) x , y ∈ N k ( u ) .
If { x , y } \{x,y\} { x , y } satisfies Case 2, then i = 2 i=2 i = 2 and τ = ( x , v , y ) \tau=(x,v,y) τ = ( x , v , y ) for some vertex v ∈ V v\in V v ∈ V such that ω E S ( x , y ) = ω G ( x , v ) + d G ( v , y ) \omega_{E_S}(x,y)=\omega_G(x,v)+d_G(v,y) ω E S ( x , y ) = ω G ( x , v ) + d G ( v , y ) , y ∈ N k ( v ) y\in N_k(v) y ∈ N k ( v ) , and either { x , v } ∈ E \{x,v\}\in E { x , v } ∈ E or x = v x=v x = v .
If { x , y } \{x,y\} { x , y } satisfies Case 3, then i = 3 i=3 i = 3 and τ = ( x , u , t , v , y ) ∈ V 5 \tau=(x,u,t,v,y)\in V^5 τ = ( x , u , t , v , y ) ∈ V 5 , where u , t , v ∈ V u,t,v\in V u , t , v ∈ V are vertices that satisfy the definition of Case 3.
If { x , y } \{x,y\} { x , y } satisfies multiple cases, then τ \tau τ and i i i may be assigned any value that matches at least one of these specifications.
(Completeness) For any { x , y } ∈ E S \{x,y\}\in E_S { x , y } ∈ E S , we have that ( { x , y } , τ , i ) ∈ L S (\{x,y\},\tau,i)\in L_S ({ x , y } , τ , i ) ∈ L S for some τ ∈ V 3 ⊔ V 5 \tau\in V^3\sqcup V^5 τ ∈ V 3 ⊔ V 5 and i ∈ { 1 , 2 , 3 } i\in\{1,2,3\} i ∈ { 1 , 2 , 3 } .
As before, we remark that for a fixed skeleton graph G S G_S G S , there may be multiple candidate choices for L S L_S L S . It is not difficult to see that given any path P P P of the form $x=v_1-v_2-v_3-\cdots-v_m=y in G S G_S G S , one can use L S L_S L S to “sketch” a walk in the original graph G G G of length at most ω ( P ) \omega(P) ω ( P ) ; we refer to the proof sketch of Lemma B.1 for the details.
In the following lemma, we show that the skeleton graph algorithm of Lemma 3.2 can be slightly modified to also output L S L_S L S alongside G S G_S G S .
Lemma B.4. Let G = ( V , E ) G = (V, E) G = ( V , E ) be a connected, weighted graph with n n n vertices, and let k > 1 k > 1 k > 1 be an integer. Suppose the k k k -nearest edge set E k E_k E k for G G G is given. If k 2 ∈ O ( n γ ) k^2 \in O(n^\gamma) k 2 ∈ O ( n γ ) , then in the sublinear MPC model with O ~ ( ∣ E ∣ k 2 ) \widetilde{O}(|E|k^2) O ( ∣ E ∣ k 2 ) total memory, there exists a randomised algorithm that w.h.p. constructs a skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) and some set L S L_S L S (satisfying the above properties) in O ( 1 ) O(1) O ( 1 ) rounds.
Proof Sketch. We make a simple modification to the algorithm description of Lemma 3.2. Namely in Step 2, for each vertex u ∈ V u \in V u ∈ V we modify the request packets to also include the vertex ID of u u u before communicating these packets to the respective vertices. This provides the vertices t ∈ V t \in V t ∈ V in Steps 4 and 5 with sufficient information to compute L S L_S L S alongside the edges E S E_S E S . Notice that the total space needed to store L S L_S L S is at most O ( ∣ E S ∣ ) ⊆ O ( ∣ E ∣ k 2 ) O(|E_S|) \subseteq O(|E|k^2) O ( ∣ E S ∣ ) ⊆ O ( ∣ E ∣ k 2 ) , and therefore we have sufficient total memory.
The path-reporting distance oracle. We now combine Lemma B.3 and Lemma B.4 in a nearly identical fashion to how we combined Lemma 4.1 and Lemma 3.2 to form the algorithm of Lemma 4.2 .
Proof Sketch of Lemma B.1 . We apply the same preprocessing algorithm technique as the proof of Lemma 4.2 , but replace Lemma 4.1 with Lemma B.3 and Lemma 3.2 with Lemma B.4. At the end of this procedure, we have constructed the following:
The k k k -nearest edge set E k E_k E k .
The constant-stretch spanner F = ( V S , E F ) F = (V_S, E_F) F = ( V S , E F ) of the skeleton graph G S = ( V S , E S ) G_S = (V_S, E_S) G S = ( V S , E S ) , stored on the single near-linear machine M ∗ M^* M ∗ .
Sets L k L_k L k and L S L_S L S with the properties as specified previously.
We may also assume that for each vertex u ∈ V u \in V u ∈ V , the edge set { { u , t } : t ∈ N k ( u ) } \{\{u,t\}: t \in N_k(u)\} {{ u , t } : t ∈ N k ( u )} and the set { ( u , z , t ) ∈ L k : t , z ∈ V } \{(u,z,t) \in L_k: t,z \in V\} {( u , z , t ) ∈ L k : t , z ∈ V } are stored locally on a single machine M ( u ) M(u) M ( u ) . We now perform two last additional preprocessing steps:
We filter out L S L_S L S to only contain information about the edges in F F F . Specifically, we construct the set L F : = ( E F × ( V 3 ⊔ V 5 ) × { 1 , 2 , 3 } ) ∩ L S L_F := (E_F \times(V^3 \sqcup V^5) \times\{1,2,3\}) \cap L_S L F := ( E F × ( V 3 ⊔ V 5 ) × { 1 , 2 , 3 }) ∩ L S ; we proceed to collect L F L_F L F , which is now near-linear-sized, onto the machine M ∗ M^* M ∗ . This can be done in O ( 1 ) O(1) O ( 1 ) rounds.
For each vertex u ∈ V u \in V u ∈ V , the machine M ( u ) M(u) M ( u ) locally computes some shortest path from u u u to each vertex t ∈ N k ( u ) t \in N_k(u) t ∈ N k ( u ) (Lemma B.2 ). Notice that this requires at most O ( k 2 ) = O ( n γ / 2 ) ⊆ O ( n γ ) O(k^2) = O(n^{\gamma/2}) \subseteq O(n^\gamma) O ( k 2 ) = O ( n γ /2 ) ⊆ O ( n γ ) space per vertex u u u , and thus we have sufficient local memory. This requires no communication rounds.
We now describe the procedure for answering path-reporting queries. For each query ( u , v ) (u,v) ( u , v ) , the case where u ∈ N k ( v ) u \in N_k(v) u ∈ N k ( v ) or v ∈ N k ( u ) v \in N_k(u) v ∈ N k ( u ) is handled by simply returning the path constructed by the local machine M ( v ) M(v) M ( v ) or M ( u ) M(u) M ( u ) respectively. For the remainder of the proof sketch, we focus on the case when u ∉ N k ( v ) u \notin N_k(v) u ∈ / N k ( v ) and v ∉ N k ( u ) v \notin N_k(u) v ∈ / N k ( u ) .
Following the same answering-query procedure of Lemma 4.2 , we first determine the vertices x , y ∈ V S x,y \in V_S x , y ∈ V S that minimise the distance estimate δ ( u , v ) \delta(u,v) δ ( u , v ) . The vertices ( u , v , x , y ) (u,v,x,y) ( u , v , x , y ) are then communicated to the near-linear machine M ∗ M^* M ∗ . Using F F F and L F L_F L F , M ∗ M^* M ∗ now locally computes a sequence of vertex pairs ( u , w 2 ) = ( w 1 , w 2 ) , ( w 2 , w 3 ) , … , ( w ℓ − 1 , w ℓ ) = ( w ℓ − 1 , v ) ∈ V 2 (u,w_2)=(w_1,w_2),(w_2,w_3),\ldots,(w_{\ell-1},w_\ell)=(w_{\ell-1},v)\in V^2 ( u , w 2 ) = ( w 1 , w 2 ) , ( w 2 , w 3 ) , … , ( w ℓ − 1 , w ℓ ) = ( w ℓ − 1 , v ) ∈ V 2 and a sequence b 1 , b 2 , … , b ℓ − 1 ∈ { 1 , 2 } b_1,b_2,\ldots,b_{\ell-1}\in\{1,2\} b 1 , b 2 , … , b ℓ − 1 ∈ { 1 , 2 } with the following properties:
(Pairs are k k k -nearest apart or share an edge) For each pair ( w i , w i + 1 ) (w_i,w_{i+1}) ( w i , w i + 1 ) , we have that (1) if b i = 1 b_i=1 b i = 1 then either w i ∈ N k ( w i + 1 ) w_i \in N_k(w_{i+1}) w i ∈ N k ( w i + 1 ) or w i + 1 ∈ N k ( w i ) w_{i+1} \in N_k(w_i) w i + 1 ∈ N k ( w i ) ; (2) if b i = 2 b_i=2 b i = 2 then { w i , w i + 1 } ∈ E \{w_i,w_{i+1}\}\in E { w i , w i + 1 } ∈ E .
Δ i : = { ω E k ( w i , w i + 1 ) if b i = 1 ω G ( w i , w i + 1 ) if b i = 2 , \Delta_i := \begin{cases}
\omega_{E_k}(w_i,w_{i+1}) & \text{if } b_i=1\\
\omega_G(w_i,w_{i+1}) & \text{if } b_i=2,
\end{cases} Δ i := { ω E k ( w i , w i + 1 ) ω G ( w i , w i + 1 ) if b i = 1 if b i = 2 ,
and let Δ : = ∑ i = 1 ℓ − 1 Δ i \Delta:= \sum_{i=1}^{\ell-1}\Delta_i Δ := ∑ i = 1 ℓ − 1 Δ i . We have that Δ \Delta Δ is at most δ ( u , v ) \delta(u,v) δ ( u , v ) .
It can be quickly verified that such a sequence of vertex pairs indeed exists and can be computed entirely using F F F and L F L_F L F .
Using the paths computed in the last preprocessing step, we use O ( 1 ) O(1) O ( 1 ) rounds to construct a walk between u u u and v v v in G G G of length at most Δ \Delta Δ and with at most O ( k ⋅ ℓ ) ⊆ O ( n log k ) ⊆ O ~ ( n ) O(k\cdot\ell)\subseteq O(n\log k)\subseteq\widetilde{O}(n) O ( k ⋅ ℓ ) ⊆ O ( n log k ) ⊆ O ( n ) edges; notice that the lack of repeat vertices in the above sequence allows this walk construction to be executed without any added complications. With one last O ( 1 ) O(1) O ( 1 ) rounds, the entire walk can be collected onto the near-linear machine M ∗ M^* M ∗ . Local computation on M ∗ M^* M ∗ simplifies this walk into a path between u u u and v v v of length at most Δ \Delta Δ by removing cycles.