Funding Yael Kirkpatrick: Supported by NSF Grant No. 2141064; Jakob Nogler: Supported by the Akamai Presidential Fellowship and by a fellowship from the Siebel Scholars Foundation; Virginia Vassilevska Williams: Supported by NSF Grant CCF-2330048, BSF Grant 2024233 and a Simons Investigator Award.
Introduction
Dynamic graph algorithms aim to compute and maintain various graph quantities under arbitrarily many changes to the input graph, typically insertions and deletions of vertices or edges. However, in many practical scenarios, changes to the input are naturally confined to small batches and fully dynamic algorithms are often subject to strong lower bounds under standard fine-grained assumptions. This has spurred interest in the sensitivity setting, in which one prepares for a bounded number of changes to the original input data. When the allowed changes are only deletions, the setting is often referred to as “fault tolerant” or “emergency”, as deletions of edges from the input graph can represent failures or faults in the network.
Formally, a data structure with sensitivity for problem P P P preprocesses an instance p p p of size n n n in time P ( n ) P(n) P ( n ) . Upon receiving a batch of at most d d d changes to p p p , it must output the solution for the modified instance in query time Q ( n ) Q(n) Q ( n ) . Crucially, these updates are independent and do not compound; while many distinct queries can be performed on the original instance p p p , each update applies only to the initial preprocessed state. Many key problems in graph algorithms have been studied under the sensitivity setting in the past, including connectivity [DP20, DP10, PT07, HN16], reachability [BLM12, BCR15, BCR16, Cho16], single source shortest paths (SSSP) [KB10, Par15, BGLP16a, BGLP16b, GV12, HKIM24, Ber10, CZ24], all-pairs shortest paths (APSP) [KB10, BK09b, BGLP14, CCFK17, GV12, PP18] and graph spanners [BCP12, BGG+15].
This paper focuses on sensitivity algorithms for vertex eccentricities ecc G ( v ) \operatorname{ecc}_G(v) ecc G ( v ) (the maximum distance from v v v to any node u u u ), the diameter diam ( G ) \operatorname{diam}(G) diam ( G ) (the maximum eccentricity), and the radius radius ( G ) \operatorname{radius}(G) radius ( G ) (the minimum eccentricity). These parameters measure how fast information spreads, informing decisions such as network controller placement. As exact computation is hard under fine-grained assumptions [RV13, AVW16], significant work has focused on approximations in static [ACIM99, BRS+18, CLR+14] and dynamic [AHR+19] settings. Henzinger et al. Henzinger et al. [HLNV17] initiated the sensitivity study with fine-grained lower bounds, followed by several works [BCC+26, BCC+22, BCFS21] focused on upper bounds.
Some Wishful Thinking: Our ideal objective for the sensitivity versions of diameter, eccentricities, and radius (in both exact and approximate settings) is to achieve a preprocessing time P P P matching the static problem’s complexity and a query time Q = O ( 1 ) Q = O(1) Q = O ( 1 ) . This could be realized through a tight reduction or by developing a new oracle with equivalent preprocessing costs. In the exact setting, since no better algorithm for the problems of interest is currently known than computing APSP, if P P P already matches the runtime of computing APSP on the specific graph, this would be similarly significant.
Naturally, achieving the same bounds in the sensitivity setting as in the static version is a very ambitious goal, as the sensitivity setting often introduces additional hardness. For instance, in weighted graphs, decremental diameter is hard under the APSP hypothesis [HLNV17], while its static relationship to APSP remains an open question. A starker contrast is seen regarding SSSP: while static SSSP (in graphs with nonnegative weights) can be solved in O ( m + n log n ) O(m + n \log n) O ( m + n log n ) time via Dijkstra’s algorithm, under the APSP hypothesis, computing decremental SSSP (even single source single destination) for a single edge failure either requires n 3 − o ( 1 ) n^{3-o(1)} n 3 − o ( 1 ) preprocessing time, or n 2 − o ( 1 ) n^{2-o(1)} n 2 − o ( 1 ) query time [HLNV17]. This gives a substantial gap between the static and sensitivity complexities.
There are, however, also some positive results that support our objective, most notably for APSP itself. In the incremental setting, this is nearly self-evident: upon the insertion of an edge e = ( u , v ) e = (u,v) e = ( u , v ) , the new distance d G ∪ e ( x , y ) d_{G\cup e}(x,y) d G ∪ e ( x , y ) is given by min ( d G ( x , y ) , d G ( x , u ) + w ( u , v ) + d G ( v , y ) ) \min(d_G(x,y), d_G(x,u) + w(u,v) + d_G(v,y)) min ( d G ( x , y ) , d G ( x , u ) + w ( u , v ) + d G ( v , y )) . Thus, any static APSP algorithm trivially serves as an incremental sensitivity oracle with Q = O ( 1 ) Q = O(1) Q = O ( 1 ) . The decremental setting is more complex, yet also yields positive results. In weighted graphs, it is conjectured that no algorithm for
The Cost of Changing Edges for Diameter Computation and More
APSP exists which is substantially faster than the O ~ ( n m ) \widetilde{O}(nm) O ( nm ) time required for running Dijkstra’s algorithm from all nodes. Bernstein and Karger [BK09b] demonstrated that for 1 edge failure decremental APSP one can indeed achieve1 P = O ~ ( n m + n 2 ) P=\widetilde{O}(nm+n^2) P = O ( nm + n 2 ) and Q = O ( 1 ) Q=O(1) Q = O ( 1 ) , giving a preprocessing time that is the same as the best known for APSP.
We provide a brief summary of the results for decremental/incremental diameter and eccentricities that are already known, and compare them with our ideal objective. We focus primarily on the case of single edge sensitivity.
Previous Results for the Decremental Setting: Previous decremental algorithms reduce these problems to Distance Sensitivity Oracles (DSO) or single-source DSOs (with a fixed source s s s ). A DSO is an oracle for decremental APSP. Formally, after preprocessing, we need to answer queries of the form d G ∖ e ( x , y ) d_{G\setminus e}(x,y) d G ∖ e ( x , y ) for some x , y , e x,y,e x , y , e . From the previous discussion, we note that establishing such a reduction (at least to the former) is nearly as desirable as reducing to APSP itself. We briefly summarize these existing results.
Given a graph G G G , a DSO for G G G with preprocessing P P P and O ( 1 ) O(1) O ( 1 ) query time implies2 :
Unweighted Diameter [BCFS21]: a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate algorithm for decremental diameter with P + O ( n 2 / ε ) P+O(n^2/\varepsilon) P + O ( n 2 / ε ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time for unweighted graphs.
Moreover, an α \alpha α -approximate single-source DSO with preprocessing P P P and O ( 1 ) O(1) O ( 1 ) query time implies:
Eccentricities [BCC+26]: a 2 ( 1 + α ) 2(1+\alpha) 2 ( 1 + α ) -approximate algorithm for decremental (all-node) eccentricities with P P P preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Combining these reductions with existing DSOs yields various trade-offs for decremental diameter and eccentricities. While Reduction (2) is advantageous because it can be extended to multiple failures, both Reductions (1) and (2) are unsatisfactory for single failures. Specifically, they incur approximation losses even with exact DSOs (i.e., when α = 1 \alpha=1 α = 1 ), and only Reduction (1) maintains a factor below 2—yet it only applies to unweighted graphs.
Previous Results for the Incremental Setting: The incremental setting of the sensitivity problem has received significantly less attention than its decremental counterpart. Henzinger et al. [HLNV17] established the only known lower bound for this setting, which applies specifically to cases where at least ω ( log n ) \omega(\log n) ω ( log n ) edges are inserted. Prior to this work, neither algorithms nor lower bounds were known for the incremental single-sensitivity setting concerning diameter, radius, and eccentricities.
Our Results for the Decremental Setting
As a first result, we significantly improve upon the decremental diameter algorithm obtained via Reduction (1) through an improved reduction. The reduction is to DSOs, together with an algorithm capable of computing canonical shortest paths on G G G ; that is, an algorithm that, for each pair of nodes u , v u,v u , v , selects a shortest path π G ( u , v ) \pi_G(u,v) π G ( u , v ) such that any subpath of a canonical path is itself a canonical path.
Main Theorem 1. Let G G G be a graph (directed or undirected, weighted or unweighted) with n n n nodes. Suppose it takes time P P P to construct a DSO for G G G with query time O ( 1 ) O(1) O ( 1 ) , and it takes time T T T to compute a set of canonical shortest paths on G G G . Then, we can solve the following problems on G G G :
(i) decremental diameter with P + T + O ~ ( n 2 ) P+T+\widetilde{O}(n^2) P + T + O ( n 2 ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time;
(ii) ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate all-node decremental eccentricities with P + T + O ~ ε ( n 2 log M ) P+T+\widetilde{O}_{\varepsilon}(n^2\log M) P + T + O ε ( n 2 log M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time, assuming the graph has edge weights in [ 1.. M ] [1..M] [ 1.. M ] .
Table 1. Comparison between the previously best known decremental diameter algorithms (that only work for the unweighted case) obtained through Reduction (1) of [BCFS21] and the better algorithms obtained through our reduction in Theorem 1(i) (the latter highlighted in yellow). By introducing a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) approximation factor, the algorithm from Theorem 1(i) can be extended to all-nodes decremental eccentricities using Theorem 1(ii). For exact eccentricities, an additional O ( n 2.88 ) O(n^{2.88}) O ( n 2.88 ) overhead is incurred via Theorem 1(iii). All listed algorithms have O ( 1 ) O(1) O ( 1 ) query time.
(iii) all-node decremental eccentricities in P + T + O ~ ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) \mathrm{P}+\mathrm{T}+\widetilde{O}\left(n^{2+(7-\omega)/(10-2\omega)}\right)=\mathrm{P}+\mathrm{T}+O(n^{2.88}) P + T + O ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time. Here ω < 2.3714 \omega<2.3714 ω < 2.3714 is the exponent of square matrix multiplication [ADV+25].3
Theorem 1(i) gives a tight reduction from (exact) decremental diameter to the construction of a DSO. This represents a significant improvement over Reduction (1): it eliminates the ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation overhead and generalizes to any possible graph beyond unweighted ones!
We observe that the reductions in Main Theorem 1 are of the strongest possible form: the DSO only needs to work on G itself, without requiring the algorithm to support a broader class (all graphs on the same weight set, for instance). We also remark that the newly added dependence on an algorithm computing canonical shortest paths is not a major drawback, as one can generally expect to compute them in the same time as APSP (see [GR21] for instance) and constructing DSOs is harder than APSP. This dependence in Main Theorem 1 is only because it seems unclear how to frame a general reduction (one that works for any graph) from an algorithm that computes canonical paths to one that merely computes APSP. This remains an interesting question in its own right.
In Theorem 1(ii), we extend this reduction to (all-node) eccentricities with an additional ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation. We discuss in Section 2 why a loss in the approximation factor for Theorem 1(ii) is unavoidable; thus, at least we are able to minimize this loss. Finally, Theorem 1(iii) demonstrates that even when pursuing an exact reduction, it is possible to maintain a subcubic runtime. In Table 1 we summarize the runtimes that one achieves by combining Main Theorem 1 with existing DSOs, and compare those achieved through Theorem 1(i) and Reduction (1).
We also achieve our target bounds for decremental diameter in the regime of larger approximation ratios and sparse graphs. The first component enabling these results is a near-linear time algorithm for ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximating the decremental eccentricity of a single vertex. We develop this algorithm by combining monotonicity-related observations (which we also rely on in Main Theorem 1 in some sense) with the decremental single-source shortest distance oracle of Harada et al. [HKIM24].
Lemma 5.5 (Adapted from [HKIM24]). For any ε > 0 \varepsilon>0 ε > 0 , there is an algorithm for decremental ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate eccentricities of a single node in a (directed or undirected) graph with weights in [ 1 … M ] [1\ldots M] [ 1 … M ] with O ~ ε ( m polylog M ) \widetilde{O}_{\varepsilon}(m\operatorname{polylog}M) O ε ( m polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Since a 2-approximation of the diameter can be obtained by doubling the eccentricity of an arbitrary vertex (i.e., by routing through it), our result implies that a ( 2 + ε ) (2+\varepsilon) ( 2 + ε ) -approximation of the decremental diameter can be maintained in near-linear time.
Corollary 1.1. For decremental diameter on weighted (directed or undirected) graphs with edge weights in [ 1 … M ] [1 \ldots M] [ 1 … M ] , there is a ( 2 + ε ) (2+\varepsilon) ( 2 + ε ) -approximate algorithm with O ~ ε ( m polylog M ) \widetilde{O}_{\varepsilon}(m\operatorname{polylog} M) O ε ( m polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Corollary 1.1 improves upon all decremental all-node eccentricity algorithms derived from Reduction (2) (there the derived approximation ratio is always at least 2). In terms of complexity, Corollary 1.1 nearly matches the static approximation achieved by computing shortest paths from a single node using Dijkstra’s algorithm and routing all distances through it.
The final approximation range to address lies between 1 + ε 1+\varepsilon 1 + ε and 2. For static (and thus also decremental) algorithms, a known barrier exists at the 3 / 2 3/2 3/2 threshold: under SETH, any approximation better than 3 / 2 3/2 3/2 requires at least O ( m 2 − o ( 1 ) ) O(m^{2-o(1)}) O ( m 2 − o ( 1 ) ) time [RV13]. Consequently, significant effort has been directed toward developing faster algorithms specifically for this 3 / 2 3/2 3/2 ratio. In the static setting, these approximation algorithms typically follow a specific framework [RV13, CGR16, ACIM99]: they identify a set S ⊆ V S \subseteq V S ⊆ V with a certain ”nice” property, which we define as an ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample4 , run Dijkstra from every s ∈ S s \in S s ∈ S , and return the maximum distance found. Furthermore, these methods may introduce a small additive error5 . For undirected graphs, we demonstrate that algorithms following this framework can be translated to the decremental setting, provided we have an algorithm for maintaining the decremental eccentricity of a single node.
Main Theorem 2. Let G = ( V , E ) G=(V,E) G = ( V , E ) be an undirected graph with non-negative edge weights. Further, suppose there is an algorithm to find an ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample from V V V in time T T T and an algorithm for single-node ( α ′ , β ′ ) (\alpha',\beta') ( α ′ , β ′ ) -approximate decremental eccentricity in G G G with P P P preprocessing and Q Q Q query time. Then, there is a ( α α ′ , α β ′ + β ) (\alpha\alpha',\alpha\beta'+\beta) ( α α ′ , α β ′ + β ) -approximate algorithm for decremental diameter in G G G with O ( T + P + k m Q ) O(T+P+kmQ) O ( T + P + k m Q ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Since Lemma 5.5 provides an efficient decremental single-node eccentricity algorithm, we are able to achieve once again our primary objective of translating static diameter algorithms in this regime to the decremental setting. By doing so, the approximation factor grows only by a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) factor.
Corollary 1.2. Combining Main Theorem 2 with existing algorithms computing a ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample and Lemma 5.5, yields the following algorithms for decremental diameter on undirected graphs with weights in [ 1 … M ] [1\ldots M] [ 1 … M ] :
(i) a ( 3 / 2 + ε , M / 2 ) (3/2+\varepsilon,M/2) ( 3/2 + ε , M /2 ) -approximation with O ~ ε ( m n 1 / 2 polylog M ) \widetilde{O}_{\varepsilon}(mn^{1/2}\operatorname{polylog} M) O ε ( m n 1/2 polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query (using [RV13]);
(ii) an ( 3 / 2 + ε ) (3/2+\varepsilon) ( 3/2 + ε ) -approximation with O ~ ε ( m 3 / 2 polylog M ) \widetilde{O}_{\varepsilon}(m^{3/2}\operatorname{polylog} M) O ε ( m 3/2 polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query (using [CLR+14]);
(iii) for any k ≥ 1 k\geq1 k ≥ 1 , an ( 2 − 1 / 2 k + ε , ( 1 − 1 / 2 k ) M ) (2-1/2^k+\varepsilon,(1-1/2^k)M) ( 2 − 1/ 2 k + ε , ( 1 − 1/ 2 k ) M ) -approximation with O ~ ε ( m n 1 / ( k + 1 ) polylog M ) \widetilde{O}_{\varepsilon}(mn^{1/(k+1)}\operatorname{polylog} M) O ε ( m n 1/ ( k + 1 ) polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query (using [CGR16]).
As a final contribution to the decremental setting, we provide improved lower bounds.
Lemma 9.1. We can encode a boolean matrix product in a single instance of decremental diameter and decremental all-nodes eccentricities in unweighted (undirected or directed) graphs such that any ( 3 / 2 − ε ) (3/2-\varepsilon) ( 3/2 − ε ) -approximate algorithm for these problems allows us to read off the solution to the boolean matrix product from O ( n 2 ) O(n^2) O ( n 2 ) queries.
Thus, for ( 3 / 2 − ε ) (3/2-\varepsilon) ( 3/2 − ε ) -approximations, we obtain a general n ω − o ( 1 ) n^{\omega-o(1)} n ω − o ( 1 ) lower bound and an n 3 − o ( 1 ) n^{3-o(1)} n 3 − o ( 1 ) lower bound for combinatorial algorithms6 , given the Boolean Matrix Multiplication hypothesis which stipulates that it is impossible to solve boolean matrix multiplication in truly subcubic time using a combinatorial algorithm. In the latter case, we improve on the lower bound of [HLNV17], which established a 5 / 4 5/4 5/4 -approximation factor as the barrier for subcubic combinatorial algorithms.
Our Results for the Incremental Setting
Interestingly, the incremental setting tells quite a different story, quickly putting an end to our wishful thinking. Indeed, while we achieved our ideal outcome in the decremental setting by matching the runtime of the static algorithm for both approximate and exact cases, it turns out this is (conditionally) impossible for the incremental setting.
Lower Bounds. Because of this, to properly contextualize our results, we must first introduce our lower bounds, as they establish a new baseline that we aim to match. Our lower bounds are based on the Orthogonal Vectors (OV) Hypothesis, which is implied by the Strong Exponential Time Hypothesis (SETH)[Wil05]. It claims that determining whether a set of n n n boolean vectors of dimension ω ( log n ) \omega(\log n) ω ( log n ) contains an orthogonal pair cannot be done in runtime n 2 − ε n^{2-\varepsilon} n 2 − ε for any constant ε > 0 \varepsilon> 0 ε > 0 .
Lemma 9.2. Assuming the OV hypothesis, for ε , δ > 0 \varepsilon,\delta> 0 ε , δ > 0 , there is no data structure which has both O ( m 2 − δ ) O(m^{2-\delta}) O ( m 2 − δ ) preprocessing time and O ( m 1 − δ ) O(m^{1-\delta}) O ( m 1 − δ ) query time for the following incremental problems:
(i) ( 5 / 3 − ε ) (5/3-\varepsilon) ( 5/3 − ε ) -approximate eccentricity of a single node in an unweighted and undirected graph;
(ii) ( 5 / 3 − ε ) (5/3-\varepsilon) ( 5/3 − ε ) -approximate diameter or radius in an unweighted and undirected graph;
(iii) ( 2 − ε ) (2-\varepsilon) ( 2 − ε ) -approximate eccentricity of a single node or radius of an unweighted and directed graph; and
(iv) ( 2 − ε ) (2-\varepsilon) ( 2 − ε ) -approximate diameter in an unweighted and directed graph;
The lower bounds (i),(ii) hold even when the input graph is guaranteed to be disconnected.
We next detail four stark contrasts highlighted by Lemma 9.2, making it far more interesting than a simple baseline to match:
(a) The first contrast lies between the incremental and static settings. While any ( 3 / 2 − ε ) (3/2-\varepsilon) ( 3/2 − ε ) -approximation requires m 2 − o ( 1 ) m^{2-o(1)} m 2 − o ( 1 ) time in the static setting, this lower-bound threshold increases from 3 / 2 3/2 3/2 to 5 / 3 5/3 5/3 for undirected graphs, and to 2 2 2 for directed graphs in the incremental setting.
(b) As mentioned earlier, because we match the decremental setting to the static setting in this paper, the previous point immediately yields a contrast between the incremental and decremental settings, showing that the latter is easier. This asymmetry is somewhat unexpected; as noted for APSP, obtaining an incremental oracle is significantly easier than a decremental one. (For instance, developing a DSO with a preprocessing time that directly matches Williams’ APSP time [Wil14], or simply achieving an o ( n 3 ) o(n^3) o ( n 3 ) runtime, remains an interesting open problem, whereas this is easily achievable in the incremental setting.)
(c) Our next contrast relies on the fact that we obtain different lower bounds for directed and undirected graphs. Together with our upper bound, these results show a provable separation between such graph classes. We highlight that such a separation is still a big open problem in the static setting. Indeed there, a lower bound tradeoff for directed graphs has been extended to undirected graphs with substantially more work [DW21, DLV25]. However, from the upper bound side our best algorithm for directed graphs [ADLV23] is quite far from the undirected case [CGR16].
This table summarizes our results for the (single-edge) incremental settings. Approximations with a star (⋆ \star ⋆ ) have an additive error, and tight results under our lower bounds are highlighted in yellow. The last column directs to the theorem where each result is stated. The bounds for n γ n^\gamma n γ -node eccentricities assume m = Ω ( n ) m = \Omega(n) m = Ω ( n ) .
Table 2. This table summarizes our results for the (single-edge) incremental settings. Approximations with a star (⋆ \star ⋆ ) have an additive error, and tight results under our lower bounds are highlighted in yellow. The last column directs to the theorem where each result is stated. The bounds for n γ n^\gamma n γ -node eccentricities assume m = Ω ( n ) m = \Omega(n) m = Ω ( n ) .
(d) Lastly, our lower bounds reveal a contrast between connected and disconnected graphs. Our lower bound for undirected diameter begins with a disconnected graph, incrementing it each time with an edge connecting the two parts. This is common practice in dynamic lower-bounds, as it forces the new shortest paths to go through the inserted edge. However, for this disconnected setting we can construct a simple algorithm matching the lower bound. This demonstrates that breaking the 5/3-approximation barrier will require a fundamentally new approach to lower-bound construction.
Upper Bounds While lower bounds for the incremental sensitivity setting have been studied in the past, no prior work has attempted to develop algorithms. To this end, our main contribution is developing new techniques to allow constructing algorithms to approximate fundamental graph parameters in the incremental setting.
We develop two main techniques, on which we elaborate in the technical overview. In the remainder of this section, we highlight the results we are able to obtain by each technique on its own, as well as by combining the two in different ways, in some cases obtaining tight algorithms matching our lower bounds. The incremental algorithmic results are summarized in Table 2, where tight algorithms are highlighted in yellow.
First, we show how to adapt a static all-nodes-eccentricity approximation algorithm to a single incremental eccentricity approximation algorithm. While in the decremental setting we lost a factor of ε \varepsilon ε in the approximation, here we are able to maintain the exact same approximation, while providing an algorithm with preprocessing time equal to the runtime of the static algorithm and logarithmic query time. We extend this result to faster approximation of the eccentricity of a set of nodes using fast matrix multiplication at the expense of the return of an ε \varepsilon ε loss in the approximation factor. This technique allows us to obtain the following eccentricity approximation results. For both the directed and undirected cases we are able to obtain an optimal approximation algorithm for the eccentricity of a single node, matching the respective lower bounds.
Main Theorem 3. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted directed or undirected graph with nonnegative integer edge weights bounded by poly ( n ) \operatorname{poly}(n) poly ( n ) . There exists a randomized algorithm running in O ~ ( m ) \widetilde{O}(m) O ( m ) preprocessing time and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time that outputs a 2-approximation of the 1-incremental eccentricity of a single vertex w.h.p.
Main Theorem 4. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted and undirected graph with nonnegative integer edge weights bounded by M M M . Consider the problem of computing a 5 / 3 5/3 5/3 -approximation to the incremental eccentricities of a set P P P . Then:
(i) If ∣ P ∣ = 1 |P|=1 ∣ P ∣ = 1 we can obtain a ( 5 / 3 , 2 M / 3 ) (5/3,2M/3) ( 5/3 , 2 M /3 ) -approximation with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time.
(ii) If ∣ P ∣ = n γ |P|=n^\gamma ∣ P ∣ = n γ and m = Ω ( n ) m=\Omega(n) m = Ω ( n ) , we can obtain ( 5 / 3 + ε , 2 M / 3 + ε ) (5/3+\varepsilon,2M/3+\varepsilon) ( 5/3 + ε , 2 M /3 + ε ) -approximation with O ~ ( m n 1 + γ 2 + m ⋅ n 1 + ω + 1 4 γ m ω − 1 ω + 1 ) \widetilde{O}(mn^{\frac{1+\gamma}{2}}+\sqrt{m}\cdot n^{1+\frac{\omega+1}{4}\gamma}m^{\frac{\omega-1}{\omega+1}}) O ( m n 2 1 + γ + m ⋅ n 1 + 4 ω + 1 γ m ω + 1 ω − 1 ) preprocessing and O ( n γ ) O(n^\gamma) O ( n γ ) query time.
As a second key technique, we observe a simple property regarding distances between triples of vertices and demonstrate ways to exploit this property algorithmically. This allows us to approximate the diameter and radius in the incremental setting faster than performing O ( n ) O(n) O ( n ) queries to an APSP oracle. This technique gives us an elegantly simple 3-approximation algorithm for the 1-incremental sensitivity setting Lemma 8.1 .
Theorem 8.3. There exists a 3-approximation for 1-incremental undirected diameter running in O ( m + n log n ) O(m+n\log n) O ( m + n log n ) pre-processing time and O ( 1 ) O(1) O ( 1 ) query time.
Finally, we combine the two techniques to develop numerous algorithms with better approximation guarantees, trading off tighter approximations with higher running times. We achieve a near 2-approximation with subquadratic preprocessing time and a near 3/2-approximation (better than 5/3) with APSP preprocessing, along with an intermediate ( 5 / 3 + ε ) (5/3+\varepsilon) ( 5/3 + ε ) -approximation and a faster, combinatorial, 2.5-approximation.
Main Theorem 5. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted and undirected graph with edge weights in [ 1 … M ] [1\ldots M] [ 1 … M ] . Then, we can devise the following algorithms for incremental diameter:
(i) a ( 3 / 2 + ε , M / 2 ) (3/2+\varepsilon,M/2) ( 3/2 + ε , M /2 ) -approximation with O ~ ( m n + n ( ω + 7 ) / 4 + min ( M n ω , m n ) ) ≤ O ~ ( m n + n 2.343 + min ( M n ω , m n ) ) \widetilde{O}(m\sqrt{n}+n^{(\omega+7)/4}+\min(Mn^\omega,mn))\le\widetilde{O}(m\sqrt{n}+n^{2.343}+\min(Mn^\omega,mn)) O ( m n + n ( ω + 7 ) /4 + min ( M n ω , mn )) ≤ O ( m n + n 2.343 + min ( M n ω , mn )) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time;
(ii) a ( 3 / 2 + ε , M / 2 ) (3/2+\varepsilon,M/2) ( 3/2 + ε , M /2 ) -approximation with O ~ ( n 2.5 + min ( M n ω , m n ) ) \widetilde{O}(n^{2.5}+\min(Mn^\omega,mn)) O ( n 2.5 + min ( M n ω , mn )) preprocessing time and O ( 1 ) O(1) O ( 1 ) query time;
(iii) a ( 5 / 3 + ε , 2 M / 3 ) (5/3+\varepsilon,2M/3) ( 5/3 + ε , 2 M /3 ) -approximation with O ~ ( m n 2 ω 2 ω + 1 + n 2 + 6 ω + 1 4 ω + min { m n , M n ω } ) ≤ O ~ ( m n 0.711 + n 2.198 + min { m n , M n ω } ) \widetilde{O}(mn^{\frac{2\omega}{2\omega+1}}+n^{\frac{2+6\omega+1}{4\omega}}+\min\{mn,Mn^\omega\})\le\widetilde{O}(mn^{0.711}+n^{2.198}+\min\{mn,Mn^\omega\}) O ( m n 2 ω + 1 2 ω + n 4 ω 2 + 6 ω + 1 + min { mn , M n ω }) ≤ O ( m n 0.711 + n 2.198 + min { mn , M n ω }) preprocessing and O ~ ( n ( ω + 1 ) / ( 2 ω ) ) ≤ O ( n 0.711 ) \widetilde{O}(n^{(\omega+1)/(2\omega)})\le O(n^{0.711}) O ( n ( ω + 1 ) / ( 2 ω ) ) ≤ O ( n 0.711 ) query time.
(iv) a ( 2 + ε , M ) (2+\varepsilon,M) ( 2 + ε , M ) -approximation with O ~ ( m n + n ( ω + 5 ) / 4 ) ≤ O ~ ( m n + n 1.843 ) \widetilde{O}(m\sqrt{n}+n^{(\omega+5)/4})\le\widetilde{O}(m\sqrt{n}+n^{1.843}) O ( m n + n ( ω + 5 ) /4 ) ≤ O ( m n + n 1.843 ) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time.
(v) a ( 5 / 2 , M / 2 ) (5/2,M/2) ( 5/2 , M /2 ) -approximation with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time.
For the sake of completeness, we formally present the upper bound for disconnected graphs mentioned earlier.
Lemma 8.7. There exists a 5 / 3 5/3 5/3 -approximation for the incremental diameter of a disconnected undirected graph, with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing time and O ( 1 ) O(1) O ( 1 ) query time.
Finally, to demonstrate the strength of our second central technique, we show that it extends to the setting of incremental radius. Using a combination of similar and new, radius-specific techniques, we also establish the first constant approximation of the radius in the incremental setting.
Theorem 8.6. For weighted undirected graphs with nonnegative edge weights bounded by M M M , there exists a ( 3 , M ) (3,M) ( 3 , M ) -approximation for incremental radius with expected O ~ ( ( m + n ) n ) \widetilde{O}((m+n)\sqrt{n}) O (( m + n ) n ) preprocessing time and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time.
A Note on Randomness
Throughout the paper we use randomized language to describe our algorithms, such as ”sample a hitting set”. However, using the deterministic hitting-set constructions of Roditty, Thorup, and Zwick [RTZ05], the randomized sampling steps in our algorithms can be derandomized without asymptotically increasing their running times, up to polylogarithmic factors. Consequently, all our incremental algorithms can be made deterministic except for Main Theorem 3 and its applications to Main Theorem 5(v) and Theorem 8.6. Our decremental reductions can also be implemented deterministically (for the decremental exact reduction see [BK09a]; and for the decremental approximate reduction see [KRQVW26]), provided the underlying distance sensitivity oracles and algorithms for constructing canonical shortest paths are deterministic. Thus, apart from randomness potentially inherited from these subroutines, the only remaining source of randomness in our upper bounds is the pseudo-center construction of Choudhary and Gold [CG20] used in Main Theorem 3.
Technical Overview
In this section, we present the techniques behind two of our results. First, in § 5.1 , we give an overview of Theorem 1 (i). Then in § 5.2 we provide a broader overview for the tools we develop to prove our incremental diameter results (Main Theorem 5, Lemma 8.1 ), namely, approximating incremental eccentricity and an observation we call the triangle lemma.
Decremental Exact Diameter
Fix an arbitrary graph G = ( V , E ) G=(V,E) G = ( V , E ) . We want to compute for each edge e e e the diameter of G G G with e e e removed, that is, the value diam ( G ∖ e ) \operatorname{diam}(G \setminus e) diam ( G ∖ e ) . For this task we are given help, via access to a DSO on G G G that allows us to query for any input vertices v , u v,u v , u and edge e e e the distance d G ∖ e ( v , u ) d_{G\setminus e}(v,u) d G ∖ e ( v , u ) . For sake of simplicity, we also assume that we have at our disposal the values d G ( u , v ) d_G(u,v) d G ( u , v ) for all u , v ∈ V u,v \in V u , v ∈ V and that the shortest paths in G G G are unique.
A naive first approach: For each edge e e e that we remove, we are only interested in the distances that change—that is, the pairs of nodes u , v u,v u , v such that e e e lies on the shortest path π G ( u , v ) \pi_G(u,v) π G ( u , v ) . Indeed, for each e e e it suffices for diam ( G ∖ e ) \operatorname{diam}(G \setminus e) diam ( G ∖ e ) to output the value
max { diam ( G ) , max u , v : e ∈ π G ( u , v ) d G ∖ e ( u , v ) } (1) \max\left\{\operatorname{diam}(G),\max_{u,v:e\in\pi_G(u,v)}d_{G\setminus e}(u,v)\right\} \tag*{(1)} max { diam ( G ) , u , v : e ∈ π G ( u , v ) max d G ∖ e ( u , v ) } (1)
This is because either diam ( G ∖ e ) = diam ( G ) \operatorname{diam}(G \setminus e)=\operatorname{diam}(G) diam ( G ∖ e ) = diam ( G ) , or there must have been an increase caused by a distance that is now larger in G ∖ e G \setminus e G ∖ e .
So, how many of such values d G ∖ e ( u , v ) d_{G\setminus e}(u,v) d G ∖ e ( u , v ) do we need to query? For each vertex u u u and each edge e e e in the shortest path tree rooted at u u u , we need to query d G ∖ e ( u , v ) d_{G\setminus e}(u,v) d G ∖ e ( u , v ) for every v v v in the subtree below e e e , because these are exactly the nodes such that e ∈ π G ( u , v ) e\in\pi_G(u,v) e ∈ π G ( u , v ) . Overall, this gives O ( n 3 ) O(n^3) O ( n 3 ) queries: too many!
Aggregating operations: In (1) , instead of computing each distance d G ∖ e ( u , v ) d_{G\setminus e}(u,v) d G ∖ e ( u , v ) within the term max u , v : e ∈ π G ( u , v ) d G ∖ e ( u , v ) \max_{u,v:e\in\pi_G(u,v)}d_{G\setminus e}(u,v) max u , v : e ∈ π G ( u , v ) d G ∖ e ( u , v ) individually, we must be more strategic and partition the maximum into fewer terms.
To this end, suppose we sample a set S ⊆ V S\subseteq V S ⊆ V of size Θ ( n log n ) \Theta(\sqrt{n}\log n) Θ ( n log n ) . For any two nodes a , b ∈ S a,b\in S a , b ∈ S such that no other sampled node c ∈ S c\in S c ∈ S lies on the path π G ( a , b ) \pi_G(a,b) π G ( a , b ) , we define the set P ( a , b ) P(a,b) P ( a , b ) to contain all pairs ( u , v ) ∈ V × V (u,v)\in V\times V ( u , v ) ∈ V × V such that π G ( u , v ) \pi_G(u,v) π G ( u , v ) contains π G ( a , b ) \pi_G(a,b) π G ( a , b ) as a subpath. Our goal for every such pair ( a , b ) (a,b) ( a , b ) is to compute, for each edge e ∈ π G ( a , b ) e\in\pi_G(a,b) e ∈ π G ( a , b ) , the value max ( x , y ) ∈ P ( a , b ) d G ∖ e ( x , y ) \max_{(x,y)\in P(a,b)}d_{G\setminus e}(x,y) max ( x , y ) ∈ P ( a , b ) d G ∖ e ( x , y ) .
It is not difficult to see that this approach allows us access to all distances d G ∖ e ( u , v ) d_{G\setminus e}(u,v) d G ∖ e ( u , v ) in Equation (1) where e e e is not among the first or last Ω ( n ) \Omega(\sqrt{n}) Ω ( n ) edges of π G ( u , v ) \pi_G(u,v) π G ( u , v ) , as after (resp. before) the first (resp. last) Ω ( n ) \Omega(\sqrt{n}) Ω ( n ) edges we expect to find a sampled node7 . Fortunately, the first and last O ( n ) O(\sqrt{n}) O ( n ) edges of each path π G ( u , v ) \pi_G(u,v) π G ( u , v ) are easy to handle, as querying d G ∖ e ( x , y ) d_{G\setminus e}(x,y) d G ∖ e ( x , y ) for them requires only O ( n 2 n ) O(n^2\sqrt{n}) O ( n 2 n ) queries in total.
A new subproblem: Now, let us fix such a pair ( a , b ) (a,b) ( a , b ) . For brevity, we define P : = P ( a , b ) P := P(a,b) P := P ( a , b ) , X : = { x : ( x , y ) ∈ P } X := \{x : (x,y) \in P\} X := { x : ( x , y ) ∈ P } , and Y : = { y : ( x , y ) ∈ P } Y := \{y : (x,y) \in P\} Y := { y : ( x , y ) ∈ P } . We order the edges along the path π G ( a , b ) \pi_G(a,b) π G ( a , b ) as e 1 , … , e h e_1,\ldots,e_h e 1 , … , e h . We let the endpoints of the i i i th edge be e i = { u i , v i } e_i = \{u_i,v_i\} e i = { u i , v i } , where u i u_i u i is closer to a a a than v i v_i v i . As previously noted, our goal is to compute for each i ∈ [ 1.. h ] i \in[1..h] i ∈ [ 1.. h ] the value max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P} d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) .
To improve on the naive approach of querying all h ⋅ ∣ P ∣ h\cdot|P| h ⋅ ∣ P ∣ values in max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P} d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) and do it instead with O ~ ( ∣ P ∣ + h ∣ X ∣ + h ∣ Y ∣ ) \widetilde{O}(|P|+h|X|+h|Y|) O ( ∣ P ∣ + h ∣ X ∣ + h ∣ Y ∣ ) queries and time, we will exploit that the values d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) are related for different indices i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] . To see why these values are related, we need to rewrite for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] the values d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) as:
d G ∖ e i ( x , y ) = min { d G ∖ π G ( a , b ) ( x , y ) (2a) d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) (2b) d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) (2c) d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) (2d) (2) d_{G\setminus e_i}(x,y)=\min\left\{\begin{aligned}
&d_{G\setminus\pi_G(a,b)}(x,y) &&\text{(2a)}\\
&d_{G\setminus\pi_G(a,v_i)}(x,b)+d_G(b,y) &&\text{(2b)}\\
&d_G(x,a)+d_{G\setminus\pi_G(u_i,b)}(a,y) &&\text{(2c)}\\
&d_G(x,a)+d_{G\setminus e_i}(a,b)+d_G(b,y) &&\text{(2d)}
\end{aligned}\right. \tag*{(2)} d G ∖ e i ( x , y ) = min ⎩ ⎨ ⎧ d G ∖ π G ( a , b ) ( x , y ) d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) (2a) (2b) (2c) (2d) (2)
Here, with the notation G ∖ π G ( ⋅ , ⋅ ) G\setminus\pi_G(\cdot,\cdot) G ∖ π G ( ⋅ , ⋅ ) , we indicate the removal from G G G of all edges on π G ( ⋅ , ⋅ ) \pi_G(\cdot,\cdot) π G ( ⋅ , ⋅ ) . To see why Equation (2) is correct, we need to perform a case distinction depending on how π G ∖ e i ( x , y ) \pi_{G\setminus e_i}(x,y) π G ∖ e i ( x , y ) behaves:
Term (2a): it shares no edge with π G ( a , b ) \pi_G(a,b) π G ( a , b ) at all;
Term (2b): it shares edges with π G ( a , b ) \pi_G(a,b) π G ( a , b ) only after e i e_i e i , in which case it goes through b b b , because as soon as π G ∖ e i ( x , y ) \pi_{G\setminus e_i}(x,y) π G ∖ e i ( x , y ) visits the first vertex on π G ( a , b ) \pi_G(a,b) π G ( a , b ) after e i e_i e i it follows the shortest path in G G G to y y y ;
Term (2c): it shares edges with π G ( a , b ) \pi_G(a,b) π G ( a , b ) only before e i e_i e i , in which case it goes through a a a ;
Term (2d): it shares edges with π G ( a , b ) \pi_G(a,b) π G ( a , b ) before and after e i e_i e i , in which case it goes through a a a and b b b ;
Assume for now, that all values listed in Terms (2a), (2b), (2c) and (2d) are available to us.
Exploiting the monotonicity: The property that we are seeking to exploit in Terms (2b) and (2c) is the monotonicity of d G ∖ π G ( a , v i ) ( x , b ) d_{G\setminus\pi_G(a,v_i)}(x,b) d G ∖ π G ( a , v i ) ( x , b ) and d G ∖ π G ( u i , b ) ( a , y ) d_{G\setminus\pi_G(u_i,b)}(a,y) d G ∖ π G ( u i , b ) ( a , y ) . Indeed, for any i ≤ j i\le j i ≤ j we have d G ∖ π G ( a , v i ) ( x , b ) ≤ d G ∖ π G ( a , v j ) ( x , b ) d_{G\setminus\pi_G(a,v_i)}(x,b)\le d_{G\setminus\pi_G(a,v_j)}(x,b) d G ∖ π G ( a , v i ) ( x , b ) ≤ d G ∖ π G ( a , v j ) ( x , b ) (resp. d G ∖ π G ( u i , b ) ( a , y ) ≥ d G ∖ π G ( u j , b ) ( a , y ) ) . d_{G\setminus\pi_G(u_i,b)}(a,y)\ge d_{G\setminus\pi_G(u_j,b)}(a,y)). d G ∖ π G ( u i , b ) ( a , y ) ≥ d G ∖ π G ( u j , b ) ( a , y )) . This is because, when i i i increases, we progressively prohibit π G ∖ π G ( a , v i ) ( x , b ) \pi_{G\setminus\pi_G(a,v_i)}(x,b) π G ∖ π G ( a , v i ) ( x , b ) (resp. allow π G ∖ π G ( u i , b ) ( a , y ) \pi_{G\setminus\pi_G(u_i,b)}(a,y) π G ∖ π G ( u i , b ) ( a , y ) ) to go through another edge of π G ( a , b ) \pi_G(a,b) π G ( a , b ) , so we have fewer and fewer (resp. more and more) possibilities to go from x x x to b b b (resp. a a a to y y y ).
Therefore, for fixed ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P in Equation (2) , as i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] increases, Term (2b) increases, Term (2c) decreases, and Term (2a) remains fixed. This means that, for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P , there are indices ℓ ( x , y ) , r ( x , y ) ∈ [ 1.. h ] \ell(x,y),r(x,y)\in[1..h] ℓ ( x , y ) , r ( x , y ) ∈ [ 1.. h ] such that:
min { d G ∖ π G ( a , b ) ( x , y ) d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) } = { d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) i ∈ [ 1.. ℓ ( x , y ) ) , d G ∖ π G ( a , b ) ( x , y ) i ∈ [ ℓ ( x , y ) . . r ( x , y ) ] , d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) i ∈ ( r ( x , y ) . . h ] . (3) \min\left\{\begin{aligned}
&d_{G\setminus\pi_G(a,b)}(x,y)\\
&d_{G\setminus\pi_G(a,v_i)}(x,b)+d_G(b,y)\\
&d_G(x,a)+d_{G\setminus\pi_G(u_i,b)}(a,y)
\end{aligned}\right\}
=
\left\{\begin{aligned}
&d_{G\setminus\pi_G(a,v_i)}(x,b)+d_G(b,y) && i\in[1..\ell(x,y)),\\
&d_{G\setminus\pi_G(a,b)}(x,y) && i\in[\ell(x,y)..r(x,y)],\\
&d_G(x,a)+d_{G\setminus\pi_G(u_i,b)}(a,y) && i\in(r(x,y)..h].
\end{aligned}\right. \tag*{(3)} min ⎩ ⎨ ⎧ d G ∖ π G ( a , b ) ( x , y ) d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ d G ∖ π G ( a , v i ) ( x , b ) + d G ( b , y ) d G ∖ π G ( a , b ) ( x , y ) d G ( x , a ) + d G ∖ π G ( u i , b ) ( a , y ) i ∈ [ 1.. ℓ ( x , y )) , i ∈ [ ℓ ( x , y ) .. r ( x , y )] , i ∈ ( r ( x , y ) .. h ] . (3)
(Here, note that for each ( x , y ) (x,y) ( x , y ) , we can get ℓ ( x , y ) , r ( x , y ) \ell(x,y),r(x,y) ℓ ( x , y ) , r ( x , y ) in time O ( log n ) O(\log n) O ( log n ) , e.g., via binary searches.)
In particular, for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P , we have
d G ∖ e i ( x , y ) = { min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + d G ( b , y ) i ∈ [ 1.. ℓ ( x , y ) ) , min { d G ∖ π G ( a , b ) ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) } i ∈ [ ℓ ( x , y ) . . r ( x , y ) ] , d G ( x , a ) + min { d G ∖ π G ( u i , b ) ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y ) } i ∈ ( r ( x , y ) . . h ] . (4) d_{G\setminus e_i}(x,y)=
\left\{\begin{aligned}
&\min\{d_{G\setminus\pi_G(a,v_i)}(x,b),\,d_G(x,a)+d_{G\setminus e_i}(a,b)\}+d_G(b,y) && i\in[1..\ell(x,y)),\\
&\min\{d_{G\setminus\pi_G(a,b)}(x,y),\,d_G(x,a)+d_{G\setminus e_i}(a,b)+d_G(b,y)\} && i\in[\ell(x,y)..r(x,y)],\\
&d_G(x,a)+\min\{d_{G\setminus\pi_G(u_i,b)}(a,y),\,d_{G\setminus e_i}(a,b)+d_G(b,y)\} && i\in(r(x,y)..h].
\end{aligned}\right. \tag*{(4)} d G ∖ e i ( x , y ) = ⎩ ⎨ ⎧ min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b )} + d G ( b , y ) min { d G ∖ π G ( a , b ) ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y )} d G ( x , a ) + min { d G ∖ π G ( u i , b ) ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y )} i ∈ [ 1.. ℓ ( x , y )) , i ∈ [ ℓ ( x , y ) .. r ( x , y )] , i ∈ ( r ( x , y ) .. h ] . (4)
Getting back to our subproblem: All this allows us to rewrite max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P} d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) as
max ( x , y ) ∈ P d G ∖ e i ( x , y ) = max { max x ∈ X max y ∈ L x , i d G ∖ e i ( x , y ) , max x ∈ X max y ∈ C x , i d G ∖ e i ( x , y ) , max y ∈ Y max x ∈ R y , i d G ∖ e i ( x , y ) } , (5) \max_{(x,y)\in P} d_{G\setminus e_i}(x,y)=\max\left\{\max_{x\in X}\max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y),\ \max_{x\in X}\max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y),\ \max_{y\in Y}\max_{x\in R_{y,i}}d_{G\setminus e_i}(x,y)\right\}, \tag*{(5)} ( x , y ) ∈ P max d G ∖ e i ( x , y ) = max { x ∈ X max y ∈ L x , i max d G ∖ e i ( x , y ) , x ∈ X max y ∈ C x , i max d G ∖ e i ( x , y ) , y ∈ Y max x ∈ R y , i max d G ∖ e i ( x , y ) } , (5)
where L x , i : = { y : ( x , y ) ∈ P , i ∈ [ 1 … ℓ ( x , y ) ) } L_{x,i}:=\{y:(x,y)\in P,\ i\in[1\ldots\ell(x,y))\} L x , i := { y : ( x , y ) ∈ P , i ∈ [ 1 … ℓ ( x , y ))} , C x , i : = { y : ( x , y ) ∈ P , i ∈ [ ℓ ( x , y ) … r ( x , y ) ] } C_{x,i}:=\{y:(x,y)\in P,\ i\in[\ell(x,y)\ldots r(x,y)]\} C x , i := { y : ( x , y ) ∈ P , i ∈ [ ℓ ( x , y ) … r ( x , y )]} and R y , i : = { x : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ] } R_{y,i}:=\{x:(x,y)\in P,\ i\in(r(x,y)\ldots h]\} R y , i := { x : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ]} .
We note that in Equation (5) in the terms max y ∈ L x , i d G ∖ e i ( x , y ) \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ L x , i d G ∖ e i ( x , y ) and max x ∈ R y , i d G ∖ e i ( x , y ) \max_{x\in R_{y,i}}d_{G\setminus e_i}(x,y) max x ∈ R y , i d G ∖ e i ( x , y ) are somehow symmetric. Indeed, if we reverse the direction of all edges in G G G and swap a , b a,b a , b as well as the two components of the pairs in P P P , then the roles of X , Y X,Y X , Y and ℓ ( x , y ) , r ( x , y ) \ell(x,y),r(x,y) ℓ ( x , y ) , r ( x , y ) would switch accordingly8 . The order of the edges e 1 , … , e h e_1,\ldots,e_h e 1 , … , e h would be reversed, and the terms max y ∈ L x , i d G ∖ e i ( x , y ) \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ L x , i d G ∖ e i ( x , y ) and max x ∈ R y , i d G ∖ e i ( x , y ) \max_{x\in R_{y,i}}d_{G\setminus e_i}(x,y) max x ∈ R y , i d G ∖ e i ( x , y ) would be also the same up to a bijection. Therefore, we can limits ourselves to only describe how the first two terms in Equation (5) can be computed, and we may assume that third one can be obtained symmetrically to the first.
Computing Equation (5): For computing the first and second terms of Equation (5) , we exploit that for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , we have by Equation (4) that d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) can be written as a minimum of only two values if y ∈ L x , i y\in L_{x,i} y ∈ L x , i or y ∈ C x , i y\in C_{x,i} y ∈ C x , i . Not only are there only two, but the two terms in the minimum have limited dependency on x , y , i x,y,i x , y , i . To see this clearly, let us focus only on computing the first term, max y ∈ L x , i d G ∖ e i ( x , y ) \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ L x , i d G ∖ e i ( x , y ) (the second, which is slightly more involved, is postponed to the full proof).
By Equation (4) , for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] :
max y ∈ L x , i d G ∖ e i ( x , y ) = max y ∈ L x , i { min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + d G ( b , y ) } = min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + max y ∈ L x , i d G ( b , y ) , \begin{aligned}
\max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y)=\max_{y\in L_{x,i}}\left\{\min\left\{d_{G\setminus\pi_G(a,v_i)}(x,b),d_G(x,a)+d_{G\setminus e_i}(a,b)\right\}+d_G(b,y)\right\} \\
&=\min\left\{d_{G\setminus\pi_G(a,v_i)}(x,b),d_G(x,a)+d_{G\setminus e_i}(a,b)\right\}+\max_{y\in L_{x,i}}d_G(b,y),
\end{aligned} y ∈ L x , i max d G ∖ e i ( x , y ) = y ∈ L x , i max { min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + d G ( b , y ) } = min { d G ∖ π G ( a , v i ) ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + y ∈ L x , i max d G ( b , y ) ,
were we crucially use that no term in the minimum depends on y y y . This allows us to proceed as follows.
We proceed in h h h rounds. In the i i i th round, we maintain for each x ∈ X x\in X x ∈ X the set L x , i L_{x,i} L x , i as a binary balanced search tree ordered by d G ( b , y ) d_G(b,y) d G ( b , y ) . To get the desired value for a certain x x x in the i i i th round, it suffices to query the element y ∈ L x , i y\in L_{x,i} y ∈ L x , i with maximum d G ( b , y ) d_G(b,y) d G ( b , y ) . When we go from round i i i to i + 1 i+1 i + 1 , we observe that we can get L x , i + 1 L_{x,i+1} L x , i + 1 from L x , i L_{x,i} L x , i , by removing all elements y y y such that ℓ ( x , y ) = i + 1 \ell(x,y)=i+1 ℓ ( x , y ) = i + 1 .
Lastly, let us do some runtime analysis. In each round, for each x ∈ X x\in X x ∈ X , we perform at most O ( 1 ) O(1) O ( 1 ) operations on balanced binary search trees. Moreover, each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P is deleted at most once from L i , x L_{i,x} L i , x . We conclude that in time O ( h ∣ X ∣ log n + ∣ P ∣ log n ) O(h|X|\log n+|P|\log n) O ( h ∣ X ∣ log n + ∣ P ∣ log n ) , we can compute max y ∈ L x , i d G ∖ e i ( x , y ) \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ L x , i d G ∖ e i ( x , y ) for each x ∈ X x\in X x ∈ X . Overall, it will turn out that we can compute all three terms (and thus also max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P}d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) for each i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] ) in time O ( h ∣ Y ∣ log n + h ∣ X ∣ log n + ∣ P ∣ log n ) O(h|Y|\log n+h|X|\log n+|P|\log n) O ( h ∣ Y ∣ log n + h ∣ X ∣ log n + ∣ P ∣ log n ) .
Getting back to our original problem: Reintroducing the dependency of P , X , Y P,X,Y P , X , Y , and h h h on the nodes a , b a,b a , b , we see that (up to polylogarithmic factors) the total complexity across all a , b ∈ S a,b\in S a , b ∈ S is:
∑ a , b ∈ S ( h ( a , b ) ∣ X ( a , b ) ∣ + h ( a , b ) ∣ Y ( a , b ) ∣ + ∣ P ( a , b ) ∣ ) + n 2.5 = O ~ ( n 2.5 ) , \sum_{a,b\in S}\left(h(a,b)|X(a,b)|+h(a,b)|Y(a,b)|+|P(a,b)|\right)+n^{2.5}=\widetilde{O}(n^{2.5}), a , b ∈ S ∑ ( h ( a , b ) ∣ X ( a , b ) ∣ + h ( a , b ) ∣ Y ( a , b ) ∣ + ∣ P ( a , b ) ∣ ) + n 2.5 = O ( n 2.5 ) ,
staying well below the O ( n 3 ) O(n^3) O ( n 3 ) threshold. In this last expression, we bound ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ≤ n |X(a,b)|,|Y(a,b)|\le n ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ≤ n , ∣ S ∣ ≤ O ~ ( n ) |S|\le\widetilde{O}(\sqrt{n}) ∣ S ∣ ≤ O ( n ) and ∑ a , b ∣ P ( a , b ) ∣ = O ~ ( n 2.5 ) \sum_{a,b}|P(a,b)|=\widetilde{O}(n^{2.5}) ∑ a , b ∣ P ( a , b ) ∣ = O ( n 2.5 ) because each pair ( a , b ) (a,b) ( a , b ) appear in at most O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) sets P ( a , b ) P(a,b) P ( a , b ) . We also use the fact that for each pair ( a , b ) (a,b) ( a , b ) , either the path length satisfies h ( a , b ) = O ( n ) h(a,b)=O(\sqrt{n}) h ( a , b ) = O ( n ) , or there must exist another distinct node from S S S on the path π G ( a , b ) \pi_G(a,b) π G ( a , b ) . In the latter case, P ( a , b ) , X ( a , b ) P(a,b),X(a,b) P ( a , b ) , X ( a , b ) , and Y ( a , b ) Y(a,b) Y ( a , b ) are empty by construction.
A more careful analysis reveals that ∑ b ∈ S ∣ X ( a , b ) ∣ ≤ n \sum_{b\in S}|X(a,b)|\le n ∑ b ∈ S ∣ X ( a , b ) ∣ ≤ n for each b ∈ V b\in V b ∈ V and ∑ b ∈ S ∣ Y ( a , b ) ∣ ≤ n \sum_{b\in S}|Y(a,b)|\le n ∑ b ∈ S ∣ Y ( a , b ) ∣ ≤ n for each a ∈ S a\in S a ∈ S (details deferred to the full proof). This will allow us to employ O ( log n ) O(\log n) O ( log n ) distinct sampling rates to reduce the overall complexity from O ~ ( n 2.5 ) \widetilde{O}(n^{2.5}) O ( n 2.5 ) down to O ~ ( n 2 ) \widetilde{O}(n^2) O ( n 2 ) (similar to [BK08, BK09b]).
Getting all terms of Equation (2) from a DSO: While the progress so far is promising, we have made an assumption that could be problematic: it is not immediately clear how a DSO can provide the values d G ∖ π G ( a , b ) ( x , y ) d_{G\setminus\pi_{G(a,b)}}(x,y) d G ∖ π G ( a , b ) ( x , y ) , d G ∖ π G ( a , v i ) ( x , b ) d_{G\setminus\pi_{G(a,v_i)}}(x,b) d G ∖ π G ( a , v i ) ( x , b ) , and d G ∖ π G ( u i , b ) ( a , y ) d_{G\setminus\pi_{G(u_i,b)}}(a,y) d G ∖ π G ( u i , b ) ( a , y ) required by Terms (2a), (2b), and (2c). The solution is to use proxy terms. These are designed to be equal to the original term when Equation (2) is minimized by that respective term; otherwise, they are larger, leaving the final minimum unaffected.
A word on computing exact decremental eccentricities instead: We can approach the computation of the decremental eccentricity of a vertex in a similar manner. By sampling the hitting set S S S and defining the quantities P P P , X X X , Y Y Y , and h h h for a fixed pair ( a , b ) (a,b) ( a , b ) as before, we focus on evaluating the quantity max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] . This can be rewritten as:
max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) = max { max y ∈ L x , i d G ∖ e i ( x , y ) , max y ∈ C x , i d G ∖ e i ( x , y ) , max y ∈ R x , i d G ∖ e i ( x , y ) } (6) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y)=\max\left\{\max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y),\max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y),\max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y)\right\} \tag*{(6)} y : ( x , y ) ∈ P max d G ∖ e i ( x , y ) = max { y ∈ L x , i max d G ∖ e i ( x , y ) , y ∈ C x , i max d G ∖ e i ( x , y ) , y ∈ R x , i max d G ∖ e i ( x , y ) } (6)
where L x , i L_{x,i} L x , i and C x , i C_{x,i} C x , i are defined as in Equation (5) and R x , i : = { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ] R_{x,i}:=\{y:(x,y)\in P,\ i\in(r(x,y)\ldots h] R x , i := { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ] . So up to the last term max y ∈ R x , i d G ∖ e i ( x , y ) \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ R x , i d G ∖ e i ( x , y ) , these are all familiar terms from Equation (5) ! Unfortunately, the final term introduces a significant bottleneck, as its computation currently relies on specialized matrix products (specifically, the max-min product) whose complexity interpolates between O ( n ω ) O(n^\omega) O ( n ω ) and O ( n 3 ) O(n^3) O ( n 3 ) . This complexity, combined with the fact that these products only yield a speed-up when ∣ P ∣ ≈ ∣ X ∣ ∣ Y ∣ |P|\approx|X||Y| ∣ P ∣ ≈ ∣ X ∣∣ Y ∣ and h ≈ ∣ X ∣ ≈ ∣ Y ∣ h\approx|X|\approx|Y| h ≈ ∣ X ∣ ≈ ∣ Y ∣ , ensures that we remain far from the quadratic bar when aiming for exact eccentricities9 . However, as mentioned earlier, if one is willing to take into incur a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) approximation error, then it is possible to get a reduction as tight as for diameter.
Incremental Approximate Diameter
We now change our focus to the incremental setting - fixing an n n n node, m m m edge graph G = ( V , E ) G=(V,E) G = ( V , E ) , for any pair of vertices x , y ∈ V x,y\in V x , y ∈ V we want to compute the diameter of G G G after adding an edge between x x x and y y y , be it directed or undirected, weighted or unweighted. We note that unlike in the decremental case, there are Ω ( n 2 ) \Omega(n^2) Ω ( n 2 ) possible queries now and not just O ( m ) O(m) O ( m ) . The incremental setting is opposite to the decremental setting in that distances in the graph can only shrink - the new edge ( x , y ) (x,y) ( x , y ) could shortcut a path between the diameter endpoint of G G G , changing the pairs of points that are relatively far apart.
However, if the distance between a pair u , v u,v u , v shrinks then their new shortest path goes through ( x , y ) (x,y) ( x , y ) and so d G ∪ ( x , y ) ( u , v ) = d G ( u , x ) + w ( x , y ) + d G ( y , v ) d_{G\cup(x,y)}(u,v)=d_G(u,x)+w(x,y)+d_G(y,v) d G ∪ ( x , y ) ( u , v ) = d G ( u , x ) + w ( x , y ) + d G ( y , v ) . Thus, the distance between a pair of points in G ∪ ( x , y ) G\cup(x,y) G ∪ ( x , y ) is given by min ( d G ( u , v ) , d G ( u , x ) + w ( x , y ) + d G ( y , v ) ) \min(d_G(u,v),d_G(u,x)+w(x,y)+d_G(y,v)) min ( d G ( u , v ) , d G ( u , x ) + w ( x , y ) + d G ( y , v )) .10
To estimate the incremental diameter of a graph we develop a few new tools. First we attempt to approximate the eccentricity of a vertex p p p under a single edge insertion. We note that if we computed this exactly we would have a 2-approximation to the incremental diameter. Using our previous observation,
ecc G ∪ ( x , y ) ( p ) = max v d G ∪ ( x , y ) ( p , v ) = max v min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v ) ) . \operatorname{ecc}_{G\cup(x,y)}(p)=\max_v d_{G\cup(x,y)}(p,v)=\max_v\min(d_G(p,v),d_G(p,x)+w(x,y)+d_G(y,v)). ecc G ∪ ( x , y ) ( p ) = v max d G ∪ ( x , y ) ( p , v ) = v max min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v )) .
Thus if we fix p p p , we can define δ k ( z ) = max v min ( d G ( p , v ) , d G ( z , v ) + k ) \delta_k(z)=\max_v\min(d_G(p,v),d_G(z,v)+k) δ k ( z ) = max v min ( d G ( p , v ) , d G ( z , v ) + k ) . If we had a way to preprocess these δ \delta δ values for all nodes, then upon query we can take k = d G ( p , x ) + w ( x , y ) k=d_G(p,x)+w(x,y) k = d G ( p , x ) + w ( x , y ) and query δ k ( y ) \delta_k(y) δ k ( y ) to obtain ecc G ∪ ( x , y ) ( p ) \operatorname{ecc}_{G\cup(x,y)}(p) ecc G ∪ ( x , y ) ( p ) . To compute these values notice that computing δ k ( z ) \delta_k(z) δ k ( z ) is very similar to the eccentricity of z z z . If we divide the nodes into A = { v : d G ( p , v ) < d G ( z , v ) + k } A=\{v:d_G(p,v)<d_G(z,v)+k\} A = { v : d G ( p , v ) < d G ( z , v ) + k } and B = V ∖ A B=V\setminus A B = V ∖ A , we have
δ k ( z ) = max ( max v ∈ A d G ( p , v ) , max v ∈ B ( d G ( z , v ) + k ) ) . \delta_k(z)=\max\left(\max_{v\in A}d_G(p,v),\max_{v\in B}(d_G(z,v)+k)\right). δ k ( z ) = max ( v ∈ A max d G ( p , v ) , v ∈ B max ( d G ( z , v ) + k ) ) .
Thus, computing the incremental eccentricity of a single node p p p transforms to the problem of computing all-node δ k ( z ) \delta_k(z) δ k ( z ) , which is conceptually similar to computing all-node eccentricities. We demonstrate in § 10 how to transform all-node-eccentricity algorithms in both directed and undirected graphs into a sort of all-node-δ \delta δ approximation which in turn gives us an approximation of ecc G ∪ ( x , y ) ( p ) \operatorname{ecc}_{G\cup(x,y)}(p) ecc G ∪ ( x , y ) ( p ) , running in the same time as the static algorithm with constant query time.
However, often in diameter approximations we wish to compute the eccentricity of a set of points. We leverage fast matrix multiplication using the max-min product to obtain a non-trivial speedup over approximating the incremental eccentricity of each node individually. This step comes at the expense of the approximation and adds a + ε +\varepsilon + ε to our approximation factor.
We can now use a 5 / 3 5/3 5/3 -approximation to a single-node undirected eccentricity (derived from Chechik et al.’s [CLR+14] static 5 / 3 5/3 5/3 -approximate all-node eccentricities) to get a 10 / 3 10/3 10/3 -approximation to the incremental diameter. However, we note the following simple observation that allows us to get a better 3 3 3 -approximation in linear preprocessing time and constant query time.
Observation 1. If the addition of an edge ( x , y ) (x,y) ( x , y ) shortcuts the distance between u , v u,v u , v then w.l.o.g. u u u is closer to x x x than it is to y y y and v v v is closer to y y y than it is to x x x .
This is because if u u u is closer to x x x than it is to y y y , then the new, shorter, path from u u u to v v v goes u → x → y → v u \to x \to y \to v u → x → y → v . If v v v was also closer to x x x than it was to y y y , we could obtain a shorter path by directly going u → x → v u \to x \to v u → x → v , without using the new edge in the graph. Thus, u , v u,v u , v need to have opposite relationships to x , y x,y x , y in order for their distance to change in G ∪ ( x , y ) G\cup(x,y) G ∪ ( x , y ) . If we instead take 3 points, by the pigeonhole principle at least 2 share the same relationship to x , y x,y x , y and so their distance does not change after adding the new edge.
Lemma 2.1 (Triangle Lemma). Let w 1 , w 2 , w 3 w_1,w_2,w_3 w 1 , w 2 , w 3 be vertices in an undirected graph G = ( V , E ) G=(V,E) G = ( V , E ) . In the graph G + G^+ G + obtained by the addition of a single edge to G G G , at least one of the pairwise distances will remain unchanged, d G + ( w i , w j ) = d G ( w i , w j ) d_{G^+}(w_i,w_j)=d_G(w_i,w_j) d G + ( w i , w j ) = d G ( w i , w j ) .
This lemma allows us to obtain a simple 3 3 3 -approximation to the incremental diameter. In preprocessing, take an arbitrary vertex w 1 w_1 w 1 and run Dijkstra’s from it. Pick w 2 w_2 w 2 to be the furthest away vertex from w 1 w_1 w 1 and run Dijkstra’s from it as well. Finally pick w 3 w_3 w 3 to be the furthest vertex from the set { w 1 , w 2 } \{w_1,w_2\} { w 1 , w 2 } and compute the distances from it. This completes the preprocessing. We claim that for any pair x , y x,y x , y , in the graph G + G^+ G + obtained by adding the edge ( x , y ) (x,y) ( x , y ) , one of the distances d G + ( w 1 , w 2 ) , d G + ( w 2 , w 3 ) , d G + ( w 1 , w 3 ) d_{G^+}(w_1,w_2),d_{G^+}(w_2,w_3),d_{G^+}(w_1,w_3) d G + ( w 1 , w 2 ) , d G + ( w 2 , w 3 ) , d G + ( w 1 , w 3 ) will be greater than diam ( G + ) / 3 \operatorname{diam}(G^+)/3 diam ( G + ) /3 . Since we can compute these 3 distances in constant time using the distances we have computed in G G G , we have constant query time.
Indeed, we show this by case analysis considering the distances from a pair of diameter endpoints d G + ( s , t ) = diam ( G + ) d_{G^+}(s,t)=\operatorname{diam}(G^+) d G + ( s , t ) = diam ( G + ) to the points w 1 , w 2 , w 3 w_1,w_2,w_3 w 1 , w 2 , w 3 . We show that if all such distances are < diam ( G + ) / 3 <\operatorname{diam}(G^+)/3 < diam ( G + ) /3 then all of d G ( w i , w j ) d_G(w_i,w_j) d G ( w i , w j ) must be > diam ( G + ) / 3 >\operatorname{diam}(G^+)/3 > diam ( G + ) /3 in the original G G G , arriving at a contradiction since one of the distance cannot shrink when adding one edge.
Finally, we combine these tools to create the first incremental diameter approximation algorithms, combining sets of points such that some distance is guaranteed to stay large after the insertion of an edge with sets of points for which we maintain their incremental eccentricity.
Preliminaries
Set notation. For integers i , j ∈ Z i,j\in\mathbb{Z} i , j ∈ Z , we write [ i … j ] [i\ldots j] [ i … j ] to represent the set { i , … , j } \{i,\ldots,j\} { i , … , j } , and [ i … j ) [i\ldots j) [ i … j ) to denote the set { i , … , j − 1 } \{i,\ldots,j-1\} { i , … , j − 1 } . We define ( i … j ] (i\ldots j] ( i … j ] and ( i … j ) (i\ldots j) ( i … j ) similarly.
Approximation. We say that x ~ \tilde{x} x ~ is an ( α , β ) (\alpha,\beta) ( α , β ) -approximation of x x x if x ≤ x ~ ≤ α x + β x \le\tilde{x} \le\alpha x+\beta x ≤ x ~ ≤ α x + β . At times, especially in the incremental sections, we use the convention x ~ ≤ x ≤ α x ~ + β \tilde{x} \le x \le\alpha\tilde{x}+\beta x ~ ≤ x ≤ α x ~ + β instead. The intended convention will be clear from context; the two are equivalent up to scaling (and an additive shift when β > 0 \beta>0 β > 0 ). Whenever β = 0 \beta=0 β = 0 , we may simply say that x ~ \tilde{x} x ~ is an α \alpha α -approximation of x x x .
Graph notation. Given a graph G = ( V , E ) \mathbf{G}=(V,E) G = ( V , E ) and an edge e ∈ E e\in E e ∈ E , we denote with G ∖ e \mathbf{G}\setminus e G ∖ e the graph ( V , E ∖ { e } ) (V,E\setminus\{e\}) ( V , E ∖ { e }) . Similarly, for e ∈ V × V e\in V\times V e ∈ V × V , we write G ∪ e \mathbf{G}\cup e G ∪ e for the graph obtained from G \mathbf{G} G by adding e e e . For a graph G = ( V , E ) \mathbf{G}=(V,E) G = ( V , E ) , we denote with d G ( x , y ) d_{\mathbf{G}}(x,y) d G ( x , y ) the shortest distance from x ∈ V x\in V x ∈ V to y ∈ V y\in V y ∈ V in G \mathbf{G} G . Given a vertex x ∈ V x\in V x ∈ V , the eccentricity of x x x in G \mathbf{G} G is defined as ecc G ( x ) : = max y ∈ V d G ( x , y ) \operatorname{ecc}_{\mathbf{G}}(x):=\max_{y\in V}d_{\mathbf{G}}(x,y) ecc G ( x ) := max y ∈ V d G ( x , y ) , the diameter of G \mathbf{G} G as diam ( G ) : = max x ∈ V ecc G ( x ) \operatorname{diam}(\mathbf{G}):=\max_{x\in V}\operatorname{ecc}_{\mathbf{G}}(x) diam ( G ) := max x ∈ V ecc G ( x ) and radius of G \mathbf{G} G as radius ( G ) : = min x ∈ V ecc G ( x ) \operatorname{radius}(\mathbf{G}):=\min_{x\in V}\operatorname{ecc}_{\mathbf{G}}(x) radius ( G ) := min x ∈ V ecc G ( x ) .
Special matrix products. In this paper, we also deal with a matrix product defined differently.
Definition 3.1 (max-min Product). Given two n × m n\times m n × m and m × p m\times p m × p matrices A , B A,B A , B , define their max-min product C = A ◯ ∨ B C=A\mathbin{\bigcirc\!\vee}B C = A ◯ ∨ B as C [ i , j ] : = max k ∈ [ 1.. m ] min { A [ i , k ] , B [ k , j ] } C[i,j]:=\max_{k\in[1..m]}\min\{A[i,k],B[k,j]\} C [ i , j ] := max k ∈ [ 1.. m ] min { A [ i , k ] , B [ k , j ]} for i ∈ [ 1.. n ] i\in[1..n] i ∈ [ 1.. n ] and j ∈ [ 1.. p ] j\in[1..p] j ∈ [ 1.. p ] . We denote with T m a x − m i n ( n , m , p ) T_{\mathrm{max-min}}(n,m,p) T max − min ( n , m , p ) the runtime for computing such product.
The runtime for the max-min product interpolates between normal matrix multiplication and O ( n 3 ) O(n^3) O ( n 3 ) .
Theorem 3.2 ([DP09], Theorem 3.3). We have T m a x − m i n ( n , n , n ) = O ( n ( ω + 3 ) / 2 ) T_{\mathrm{max-min}}(n,n,n)=O(n^{(\omega+3)/2}) T max − min ( n , n , n ) = O ( n ( ω + 3 ) /2 ) .
For any ℓ 1 ≤ ℓ 2 ∈ [ 1.. n ] \ell_1\le\ell_2\in[1..n] ℓ 1 ≤ ℓ 2 ∈ [ 1.. n ] , splitting into O ( n ℓ 2 / ℓ 1 2 ) O(n\ell_2/\ell_1^2) O ( n ℓ 2 / ℓ 1 2 ) square products of dimension ℓ 1 \ell_1 ℓ 1 gives T m a x − m i n ( ℓ 1 , ℓ 2 , n ) ≤ O ( n ℓ 2 / ℓ 1 2 ⋅ ℓ 1 ( ω + 3 ) / 2 ) = O ( n ℓ 2 ℓ 1 ( ω − 1 ) / 2 ) T_{\mathrm{max-min}}(\ell_1,\ell_2,n)\le O(n\ell_2/\ell_1^2\cdot\ell_1^{(\omega+3)/2})=O(n\ell_2\ell_1^{(\omega-1)/2}) T max − min ( ℓ 1 , ℓ 2 , n ) ≤ O ( n ℓ 2 / ℓ 1 2 ⋅ ℓ 1 ( ω + 3 ) /2 ) = O ( n ℓ 2 ℓ 1 ( ω − 1 ) /2 ) .
Exact Decremental Diameter and Eccentricities
In this section, we provide the proof of Main Theorem 1 by addressing the remaining steps from Section 2.1. First, in Section 4.1, we resolve the details concerning the subproblem involving the path sets P P P . Subsequently, in Section 4.2, we present the final derivation of Main Theorem 1.
Filling in the Gaps of the Subproblem Computation
We begin by formalizing the specific setting for our key lemmas. As described in Section 2.1, we consider a collection of shortest paths with endpoints P ⊆ V × V P\subseteq V\times V P ⊆ V × V that all pass through two common nodes, a a a and b b b , in succession.
Definition 4.1. Let G = ( V , E ) \mathbf{G}=(V,E) G = ( V , E ) be a (directed or undirected, weighted or unweighted) graph and let P ⊆ V × V P\subseteq V\times V P ⊆ V × V and a , b ∈ V a,b\in V a , b ∈ V such that for all x , y ∈ P x,y\in P x , y ∈ P we have that π G ( x , y ) \pi_{\mathbf{G}}(x,y) π G ( x , y ) goes first through a a a and then b b b . Based on this, set X : = { x : ( x , y ) ∈ P } X:=\{x:(x,y)\in P\} X := { x : ( x , y ) ∈ P } and Y : = { y : ( x , y ) ∈ P } Y:=\{y:(x,y)\in P\} Y := { y : ( x , y ) ∈ P } , and order the edges e 1 , … , e h e_1,\ldots,e_h e 1 , … , e h on π G ( a , b ) \pi_{\mathbf{G}}(a,b) π G ( a , b ) from the closest to a a a to the furthest from a a a .
We call the following values the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) : (a) d G ∖ e i ( x , b ) d_{\mathbf{G}\setminus e_i}(x,b) d G ∖ e i ( x , b ) for every x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] ; (b) d G ∖ e i ( a , y ) d_{\mathbf{G}\setminus e_i}(a,y) d G ∖ e i ( a , y ) for every y ∈ Y y\in Y y ∈ Y and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] ; (c) q ( x , y ) : = max i ∈ [ 1.. h ] d G ∖ e i ( x , y ) q(x,y):=\max_{i\in[1..h]}d_{\mathbf{G}\setminus e_i}(x,y) q ( x , y ) := max i ∈ [ 1.. h ] d G ∖ e i ( x , y ) for every ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P ; (d) d G ∖ e i ( a , b ) d_{\mathbf{G}\setminus e_i}(a,b) d G ∖ e i ( a , b ) for every i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] ; (e) d G ( x , a ) d_{\mathbf{G}}(x,a) d G ( x , a ) for every x ∈ X x\in X x ∈ X and d G ( b , y ) d_{\mathbf{G}}(b,y) d G ( b , y ) for every y ∈ Y y\in Y y ∈ Y .
It is not difficult to see that the relevant values (a), (b) and (d) can be obtained from a DSO using O ( h ( ∣ X ∣ + ∣ Y ∣ ) + ∣ P ∣ ) O(h(|X|+|Y|)+|P|) O ( h ( ∣ X ∣ + ∣ Y ∣ ) + ∣ P ∣ ) queries. Regarding values (c), we can use the same approach as in [BKO9b], Section 6 to get them using O ( ∣ P ∣ log n ) O(|P|\log n) O ( ∣ P ∣ log n ) queries.
Lastly, for values (e), we observe that we can get them using O ( ∣ X ∣ + ∣ Y ∣ ) O(|X|+|Y|) O ( ∣ X ∣ + ∣ Y ∣ ) queries by taking any three edges e 1 , e 2 , e 3 e_1,e_2,e_3 e 1 , e 2 , e 3 incident to the same vertex v v v 11 and setting d G ( x , a ) = min { d G ∖ e 1 ( x , a ) , d G ∖ e 2 ( x , a ) , d G ∖ e 3 ( x , a ) } d_G(x,a)=\min\{d_{G\setminus e_1}(x,a),d_{G\setminus e_2}(x,a),d_{G\setminus e_3}(x,a)\} d G ( x , a ) = min { d G ∖ e 1 ( x , a ) , d G ∖ e 2 ( x , a ) , d G ∖ e 3 ( x , a )} for each x ∈ X x\in X x ∈ X , as π G ( x , a ) \pi_G(x,a) π G ( x , a ) uses at most two of e 1 , e 2 , e 3 e_1,e_2,e_3 e 1 , e 2 , e 3 . Similar holds for d G ( b , y ) d_G(b,y) d G ( b , y ) .
We proceed to observe that the values (a) and (b) can be made monotone and that the relevant values provide sufficient information to ensure that for any ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] , the distance d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) is computable.
Lemma 4.2. Let P P P , a a a , b b b , X X X , Y Y Y , h h h be as in Definition 4.1 and suppose we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . Then we can do the following two things:
(a) in time O ( h ⋅ ∣ Y ∣ ) O(h\cdot|Y|) O ( h ⋅ ∣ Y ∣ ) compute for each y ∈ Y y\in Y y ∈ Y and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] a value d ~ G ∖ e i ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y) d G ∖ e i ( a , y ) that is monotonically decreasing in i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and satisfies d G ∖ e i ( a , y ) = min ( d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y ) ) d_{G\setminus e_i}(a,y)=\min(\widetilde{d}_{G\setminus e_i}(a,y),d_{G\setminus e_i}(a,b)+d_G(b,y)) d G ∖ e i ( a , y ) = min ( d G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y )) ; and
(b) in time O ( h ⋅ ∣ X ∣ ) O(h\cdot|X|) O ( h ⋅ ∣ X ∣ ) compute for each x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] a value d ~ G ∖ e i ( x , b ) \widetilde{d}_{G\setminus e_i}(x,b) d G ∖ e i ( x , b ) that is monotonically increasing in i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and satisfies d G ∖ e i ( x , b ) = min ( d ~ G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) ) d_{G\setminus e_i}(x,b)=\min(\widetilde{d}_{G\setminus e_i}(x,b),d_G(x,a)+d_{G\setminus e_i}(a,b)) d G ∖ e i ( x , b ) = min ( d G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b )) .
Moreover, for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] these values satisfy:
d G ∖ e i ( x , y ) = min { d ~ G ∖ e i ( x , b ) + d G ( b , y ) , d G ( x , a ) + d ~ G ∖ e i ( a , y ) , q ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) } . d_{G\setminus e_i}(x,y)=\min\left\{\widetilde{d}_{G\setminus e_i}(x,b)+d_G(b,y),d_G(x,a)+\widetilde{d}_{G\setminus e_i}(a,y),q(x,y),d_G(x,a)+d_{G\setminus e_i}(a,b)+d_G(b,y)\right\}. d G ∖ e i ( x , y ) = min { d G ∖ e i ( x , b ) + d G ( b , y ) , d G ( x , a ) + d G ∖ e i ( a , y ) , q ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) } .
Proof. We only give the computation for (a), as for (b) we can use symmetric computations. The computation is simple. We begin with i = 1 i=1 i = 1 , and set
d ~ G ∖ e 1 ( a , y ) = { d G ∖ e 1 ( a , y ) if d G ∖ e 1 ( a , y ) < d G ∖ e 1 ( a , b ) + d G ( b , y ) , + ∞ otherwise. \widetilde{d}_{G\setminus e_1}(a,y)=
\begin{cases}
d_{G\setminus e_1}(a,y) & \text{if }d_{G\setminus e_1}(a,y)<d_{G\setminus e_1}(a,b)+d_G(b,y),\\
+\infty& \text{otherwise.}
\end{cases} d G ∖ e 1 ( a , y ) = { d G ∖ e 1 ( a , y ) + ∞ if d G ∖ e 1 ( a , y ) < d G ∖ e 1 ( a , b ) + d G ( b , y ) , otherwise.
Then, we iterate up from 2 to h h h , and for i ∈ ( 1.. h ] i\in(1..h] i ∈ ( 1.. h ] , we set
d ~ G ∖ e i ( a , y ) = { d G ∖ e i ( a , y ) if d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) , d ~ G ∖ e i − 1 ( a , y ) otherwise. \widetilde{d}_{G\setminus e_i}(a,y)=
\begin{cases}
d_{G\setminus e_i}(a,y) & \text{if }d_{G\setminus e_i}(a,y)<d_{G\setminus e_i}(a,b)+d_G(b,y),\\
\widetilde{d}_{G\setminus e_{i-1}}(a,y) & \text{otherwise.}
\end{cases} d G ∖ e i ( a , y ) = { d G ∖ e i ( a , y ) d G ∖ e i − 1 ( a , y ) if d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) , otherwise.
First, we claim that for every i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] , if d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) d_{G\setminus e_i}(a,y)<d_{G\setminus e_i}(a,b)+d_G(b,y) d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) , then d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) d_{G\setminus e_i}(a,y)\ge d_{G\setminus e_j}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) for every j ∈ [ i . . h ] j\in[i..h] j ∈ [ i .. h ] . To see this, observe that when the condition d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) d_{G\setminus e_i}(a,y)<d_{G\setminus e_i}(a,b)+d_G(b,y) d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) holds, the shortest path π G ∖ e i ( a , y ) \pi_{G\setminus e_i}(a,y) π G ∖ e i ( a , y ) cannot pass through b b b and π G ∖ e i ( a , y ) \pi_{G\setminus e_i}(a,y) π G ∖ e i ( a , y ) must diverge from the shortest path π G ( a , b ) \pi_G(a,b) π G ( a , b ) at some node prior to e i e_i e i . This implies that π G ∖ e i ( a , y ) \pi_{G\setminus e_i}(a,y) π G ∖ e i ( a , y ) does not use any edge e j e_j e j for j ≥ i j\ge i j ≥ i . Therefore, this path remains valid in G ∖ e j G\setminus e_j G ∖ e j , which implies d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) d_{G\setminus e_i}(a,y)\ge d_{G\setminus e_j}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) .
We proceed to prove inductively that for every i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and j ∈ [ i . . h ] j\in[i..h] j ∈ [ i .. h ] , we have d ~ G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)\ge d_{G\setminus e_j}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) . In the base case i = 1 i=1 i = 1 , this follows immediately from the property proved in the previous paragraph. For the inductive step, consider i ∈ ( 1.. h ] i\in(1..h] i ∈ ( 1.. h ] . If d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) d_{G\setminus e_i}(a,y)<d_{G\setminus e_i}(a,b)+d_G(b,y) d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) , the result holds by the same property. Otherwise, by definition d ~ G ∖ e i ( a , y ) = d ~ G ∖ e i − 1 ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)=\widetilde{d}_{G\setminus e_{i-1}}(a,y) d G ∖ e i ( a , y ) = d G ∖ e i − 1 ( a , y ) . By the inductive hypothesis, d ~ G ∖ e i − 1 ( a , y ) ≥ d G ∖ e k ( a , y ) \widetilde{d}_{G\setminus e_{i-1}}(a,y)\ge d_{G\setminus e_k}(a,y) d G ∖ e i − 1 ( a , y ) ≥ d G ∖ e k ( a , y ) for all k ∈ [ i − 1.. h ] k\in[i-1..h] k ∈ [ i − 1.. h ] . Since j ∈ [ i . . h ] j\in[i..h] j ∈ [ i .. h ] implies j ≥ i − 1 j\ge i-1 j ≥ i − 1 , it follows that d ~ G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)\ge d_{G\setminus e_j}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) .
Consequently, d ~ G ∖ e i ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y) d G ∖ e i ( a , y ) satisfies d ~ G ∖ e i ( a , y ) = d G ∖ e i ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)=d_{G\setminus e_i}(a,y) d G ∖ e i ( a , y ) = d G ∖ e i ( a , y ) whenever d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) d_{G\setminus e_i}(a,y)<d_{G\setminus e_i}(a,b)+d_G(b,y) d G ∖ e i ( a , y ) < d G ∖ e i ( a , b ) + d G ( b , y ) , and d ~ G ∖ e i ( a , y ) ≥ d G ∖ e i ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)\ge d_{G\setminus e_i}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e i ( a , y ) otherwise. Combining this with d G ∖ e i ( a , y ) ≤ d G ∖ e i ( a , b ) + d G ( b , y ) d_{G\setminus e_i}(a,y)\le d_{G\setminus e_i}(a,b)+d_G(b,y) d G ∖ e i ( a , y ) ≤ d G ∖ e i ( a , b ) + d G ( b , y ) because π G ∖ e i ( a , b ) ∘ π G ( b , y ) \pi_{G\setminus e_i}(a,b)\circ\pi_G(b,y) π G ∖ e i ( a , b ) ∘ π G ( b , y ) is a valid path from a a a to y y y in G ∖ e i G\setminus e_i G ∖ e i , we get d G ∖ e i ( a , y ) = min ( d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y ) ) d_{G\setminus e_i}(a,y)=\min(\widetilde{d}_{G\setminus e_i}(a,y),d_{G\setminus e_i}(a,b)+d_G(b,y)) d G ∖ e i ( a , y ) = min ( d G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y )) .
It remains to prove monotonicity. To this end, consider i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and observe that for every j ∈ [ i . . h ] j\in[i..h] j ∈ [ i .. h ] , either d ~ G ∖ e j ( a , y ) = d ~ G ∖ e i ( a , y ) \widetilde{d}_{G\setminus e_j}(a,y)=\widetilde{d}_{G\setminus e_i}(a,y) d G ∖ e j ( a , y ) = d G ∖ e i ( a , y ) or d ~ G ∖ e j ( a , y ) = d G ∖ e k ( a , y ) \widetilde{d}_{G\setminus e_j}(a,y)=d_{G\setminus e_k}(a,y) d G ∖ e j ( a , y ) = d G ∖ e k ( a , y ) for some k ∈ [ i . . h ] k\in[i..h] k ∈ [ i .. h ] . Monotonicity follows now directly, as we have just proven that for every i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and j ∈ [ i . . h ] j\in[i..h] j ∈ [ i .. h ] , we have d ~ G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) \widetilde{d}_{G\setminus e_i}(a,y)\ge d_{G\setminus e_j}(a,y) d G ∖ e i ( a , y ) ≥ d G ∖ e j ( a , y ) .
Finally, we prove the final part of the lemma. We observe that the new values (a) and (b) ensure
min { q ( x , y ) d ~ G ∖ e i ( x , b ) + d G ( b , y ) d G ( x , a ) + d ~ G ∖ e i ( a , y ) d G ( x , a ) + d ~ G ∖ e i ( a , b ) + d G ( b , y ) } = min { q ( x , y ) d G ∖ e i ( a , b ) + d G ( b , y ) d G ( x , a ) + d G ∖ e i ( a , y ) } = d G ∖ e i ( x , y ) . \min\left\{
\begin{array}{c}
q(x,y)\\
\tilde d_{G\setminus e_i}(x,b)+d_G(b,y)\\
d_G(x,a)+\tilde d_{G\setminus e_i}(a,y)\\
d_G(x,a)+\tilde d_{G\setminus e_i}(a,b)+d_G(b,y)
\end{array}
\right\}
=
\min\left\{
\begin{array}{c}
q(x,y)\\
d_{G\setminus e_i}(a,b)+d_G(b,y)\\
d_G(x,a)+d_{G\setminus e_i}(a,y)
\end{array}
\right\}
=d_{G\setminus e_i}(x,y). min ⎩ ⎨ ⎧ q ( x , y ) d ~ G ∖ e i ( x , b ) + d G ( b , y ) d G ( x , a ) + d ~ G ∖ e i ( a , y ) d G ( x , a ) + d ~ G ∖ e i ( a , b ) + d G ( b , y ) ⎭ ⎬ ⎫ = min ⎩ ⎨ ⎧ q ( x , y ) d G ∖ e i ( a , b ) + d G ( b , y ) d G ( x , a ) + d G ∖ e i ( a , y ) ⎭ ⎬ ⎫ = d G ∖ e i ( x , y ) .
where in the last step we use the Bottleneck Lemma from [BK08]. That is, π G ∖ e i ( x , y ) \pi_{G\setminus e_i}(x,y) π G ∖ e i ( x , y ) either goes through a a a or b b b or avoids all of π G ∖ π G ( a , b ) ( x , y ) \pi_{G\setminus\pi_{G(a,b)}(x,y)} π G ∖ π G ( a , b ) ( x , y ) . The first two cases are captured by the second and third term. To capture the case where all of π G ∖ π G ( a , b ) ( x , y ) \pi_{G\setminus\pi_{G(a,b)}}(x,y) π G ∖ π G ( a , b ) ( x , y ) is avoided, we would need to have d G ∖ π G ( a , b ) ( x , y ) d_{G\setminus\pi_{G(a,b)}}(x,y) d G ∖ π G ( a , b ) ( x , y ) instead of q ( x , y ) q(x,y) q ( x , y ) . But notice that q ( x , y ) ≥ d G ∖ π G ( a , b ) ( x , y ) q(x,y) \ge d_{G\setminus\pi_{G(a,b)}}(x,y) q ( x , y ) ≥ d G ∖ π G ( a , b ) ( x , y ) and d G ∖ π G ( a , b ) ( x , y ) ≥ q ( x , y ) d_{G\setminus\pi_{G(a,b)}}(x,y) \ge q(x,y) d G ∖ π G ( a , b ) ( x , y ) ≥ q ( x , y ) , so whenever d G ∖ e i ( x , y ) = d G ∖ π G ( a , b ) ( x , y ) d_{G\setminus e_i}(x,y)=d_{G\setminus\pi_{G(a,b)}}(x,y) d G ∖ e i ( x , y ) = d G ∖ π G ( a , b ) ( x , y ) , we have d G ∖ e i ( x , y ) = q ( x , y ) d_{G\setminus e_i}(x,y)=q(x,y) d G ∖ e i ( x , y ) = q ( x , y ) .
The monotonicity of the values d ~ G ∖ e i ( ⋅ , ⋅ ) \tilde d_{G\setminus e_i}(\cdot,\cdot) d ~ G ∖ e i ( ⋅ , ⋅ ) from Lemma 4.2 allows us to rewrite d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) as follows.
Corollary 4.3. Let P P P , a , b a,b a , b , X X X , Y Y Y , h h h be as in Definition 4.1 and let the values d ~ G ∖ e i ( ⋅ , ⋅ ) \tilde d_{G\setminus e_i}(\cdot,\cdot) d ~ G ∖ e i ( ⋅ , ⋅ ) be as in Lemma 4.2 . Then, from the monotonicity of these values, we can choose for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P indices ℓ ( x , y ) , r ( x , y ) ∈ [ 1.. h ] \ell(x,y),r(x,y)\in[1..h] ℓ ( x , y ) , r ( x , y ) ∈ [ 1.. h ] such that
min { d ~ G ∖ e i ( x , b ) + d G ( b , y ) q ( x , y ) d G ( x , a ) + d ~ G ∖ e i ( a , y ) } = { d ~ G ∖ e i ( x , b ) + d G ( b , y ) i ∈ [ 1.. ℓ ( x , y ) ) q ( x , y ) i ∈ [ ℓ ( x , y ) . . r ( x , y ) ] d G ( x , a ) + d ~ G ∖ e i ( a , y ) i ∈ ( r ( x , y ) . . h ] . \min\left\{
\begin{array}{c}
\tilde d_{G\setminus e_i}(x,b)+d_G(b,y)\\
q(x,y)\\
d_G(x,a)+\tilde d_{G\setminus e_i}(a,y)
\end{array}
\right\}
=
\left\{
\begin{array}{ll}
\tilde d_{G\setminus e_i}(x,b)+d_G(b,y) & i\in[1..\ell(x,y))\\
q(x,y) & i\in[\ell(x,y)..r(x,y)]\\
d_G(x,a)+\tilde d_{G\setminus e_i}(a,y) & i\in(r(x,y)..h].
\end{array}
\right. min ⎩ ⎨ ⎧ d ~ G ∖ e i ( x , b ) + d G ( b , y ) q ( x , y ) d G ( x , a ) + d ~ G ∖ e i ( a , y ) ⎭ ⎬ ⎫ = ⎩ ⎨ ⎧ d ~ G ∖ e i ( x , b ) + d G ( b , y ) q ( x , y ) d G ( x , a ) + d ~ G ∖ e i ( a , y ) i ∈ [ 1.. ℓ ( x , y )) i ∈ [ ℓ ( x , y ) .. r ( x , y )] i ∈ ( r ( x , y ) .. h ] . In particular, for each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P we have that d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) equals to:
{ min { d ~ G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + d G ( b , y ) = d G ∖ e i ( x , b ) + d G ( b , y ) i ∈ [ 1.. ℓ ( x , y ) ) min { q ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y ) } i ∈ [ ℓ ( x , y ) . . r ( x , y ) ] d G ( x , a ) + min { d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y ) } = d G ∖ e i ( a , y ) + d G ( x , a ) i ∈ ( r ( x , y ) . . h ] . \left\{
\begin{array}{ll}
\min\{\tilde d_{G\setminus e_i}(x,b),d_G(x,a)+d_{G\setminus e_i}(a,b)\}+d_G(b,y)=d_{G\setminus e_i}(x,b)+d_G(b,y) & i\in[1..\ell(x,y))\\
\min\{q(x,y),d_G(x,a)+d_{G\setminus e_i}(a,b)+d_G(b,y)\} & i\in[\ell(x,y)..r(x,y)]\\
d_G(x,a)+\min\{\tilde d_{G\setminus e_i}(a,y),d_{G\setminus e_i}(a,b)+d_G(b,y)\}=d_{G\setminus e_i}(a,y)+d_G(x,a) & i\in(r(x,y)..h].
\end{array}
\right. ⎩ ⎨ ⎧ min { d ~ G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b )} + d G ( b , y ) = d G ∖ e i ( x , b ) + d G ( b , y ) min { q ( x , y ) , d G ( x , a ) + d G ∖ e i ( a , b ) + d G ( b , y )} d G ( x , a ) + min { d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y )} = d G ∖ e i ( a , y ) + d G ( x , a ) i ∈ [ 1.. ℓ ( x , y )) i ∈ [ ℓ ( x , y ) .. r ( x , y )] i ∈ ( r ( x , y ) .. h ] .
As already anticipated in § 5.1 , we can efficiently compute the eccentricity-related values based on the new way of seeing d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) .
Lemma 4.4. Let P P P , a , b a,b a , b , X X X , Y Y Y , h h h be as in Definition 4.1 and ℓ ( x , y ) , r ( x , y ) \ell(x,y),r(x,y) ℓ ( x , y ) , r ( x , y ) as in Corollary 4.3, and suppose that we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . Then, in time O ( h ⋅ ∣ X ∣ log n + ∣ P ∣ log n ) O(h\cdot|X|\log n+|P|\log n) O ( h ⋅ ∣ X ∣ log n + ∣ P ∣ log n ) we can compute for every i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] and x ∈ X x\in X x ∈ X the values
max y ∈ L x , i d G ∖ e i ( x , y ) and max y ∈ C x , i d G ∖ e i ( x , y ) , \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y)\quad\text{and}\quad\max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y), y ∈ L x , i max d G ∖ e i ( x , y ) and y ∈ C x , i max d G ∖ e i ( x , y ) , where L x , i : = { y : ( x , y ) ∈ P , i ∈ [ 1.. ℓ ( x , y ) ) } L_{x,i}:=\{y:(x,y)\in P,\ i\in[1..\ell(x,y))\} L x , i := { y : ( x , y ) ∈ P , i ∈ [ 1.. ℓ ( x , y ))} and C x , i : = { y : ( x , y ) ∈ P , i ∈ [ ℓ ( x , y ) . . r ( x , y ) ] } C_{x,i}:=\{y:(x,y)\in P,\ i\in[\ell(x,y)..r(x,y)]\} C x , i := { y : ( x , y ) ∈ P , i ∈ [ ℓ ( x , y ) .. r ( x , y )]} .
Proof. For the first value, by Corollary 4.3, for each x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] :
max y ∈ L x , i d G ∖ e i ( x , y ) = min { d ~ G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b ) } + max y ∈ L x , i d G ( b , y ) . \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y)=\min\{\tilde d_{G\setminus e_i}(x,b),d_G(x,a)+d_{G\setminus e_i}(a,b)\}+\max_{y\in L_{x,i}}d_G(b,y). y ∈ L x , i max d G ∖ e i ( x , y ) = min { d ~ G ∖ e i ( x , b ) , d G ( x , a ) + d G ∖ e i ( a , b )} + y ∈ L x , i max d G ( b , y ) .
This allows us to proceed as follows. We proceed in h h h rounds. In the i i i th round, we maintain for each x ∈ X x\in X x ∈ X the set L x , i L_{x,i} L x , i as a binary balanced search tree ordered by d G ( b , y ) d_G(b,y) d G ( b , y ) . To get the desired value for a certain x x x in the i i i th round, it suffices to query the element y ∈ L x , i y\in L_{x,i} y ∈ L x , i with maximum d G ( b , y ) d_G(b,y) d G ( b , y ) . When we go from round i i i to i + 1 i+1 i + 1 , we observe that we can get L x , i + 1 L_{x,i+1} L x , i + 1 from L x , i L_{x,i} L x , i by removing all elements y y y such that ℓ ( x , y ) = i + 1 \ell(x,y)=i+1 ℓ ( x , y ) = i + 1 .
For the second value, for each x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] , partition C x , i C_{x,i} C x , i into C x , i ≤ C^{{\leq}}_{x,i} C x , i ≤ and C x , i > C^{{>}}_{x,i} C x , i > , depending on whether q ( x , y ) − d G ( x , a ) − d G ( b , y ) q(x,y)-d_G(x,a)-d_G(b,y) q ( x , y ) − d G ( x , a ) − d G ( b , y ) for an element ( x , y ) ∈ C x , i (x,y)\in C_{x,i} ( x , y ) ∈ C x , i is less or equal than d G ∖ e i ( a , b ) d_{G\setminus e_i}(a,b) d G ∖ e i ( a , b ) or not. Using Corollary 4.3 again, we see that:
max y ∈ C x , i d G ∖ e i ( x , y ) = max { max y ∈ C x , i ≤ q ( x , y ) , d G ∖ e i ( a , b ) + max y ∈ C x , i > { d G ( x , a ) + d G ( b , y ) } } . \max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y)=\max\left\{\max_{y\in C^{{\leq}}_{x,i}}q(x,y),d_{G\setminus e_i}(a,b)+\max_{y\in C^{{>}}_{x,i}}\{d_G(x,a)+d_G(b,y)\}\right\}. y ∈ C x , i max d G ∖ e i ( x , y ) = max { y ∈ C x , i ≤ max q ( x , y ) , d G ∖ e i ( a , b ) + y ∈ C x , i > max { d G ( x , a ) + d G ( b , y )} } .
This allows us to proceed again in h h h rounds. In the i i i th round, we maintain for each x ∈ X x \in X x ∈ X the set C x , i C_{x,i} C x , i as a binary balanced search tree ordered by q ( x , y ) − d G ( x , a ) − d G ( b , y ) q(x,y)-d_G(x,a)-d_G(b,y) q ( x , y ) − d G ( x , a ) − d G ( b , y ) . This time, we need a tree that supports O ( log n ) O(\log n) O ( log n ) split/merge operations and subtree maxima. To get the desired value for a certain x x x in the i i i th round, we split C x , i C_{x,i} C x , i into C x , i ≤ C_{x,i}^{\leq} C x , i ≤ and C x , i > C_{x,i}^{>} C x , i > using a split operation depending on how q ( x , y ) − d G ( x , a ) − d G ( b , y ) q(x,y)-d_G(x,a)-d_G(b,y) q ( x , y ) − d G ( x , a ) − d G ( b , y ) compares to d G ∖ e i ( a , b ) d_{G\setminus e_i}(a,b) d G ∖ e i ( a , b ) . Then, via subtree maxima, from C x , i ≤ C_{x,i}^{\leq} C x , i ≤ and C x , i > C_{x,i}^{>} C x , i > we query max y ∈ C x , i ≤ q ( x , y ) \max_{y\in C_{x,i}^{\leq}}q(x,y) max y ∈ C x , i ≤ q ( x , y ) and max y ∈ C x , i > { d G ( x , a ) + d G ( b , y ) } \max_{y\in C_{x,i}^{>}}\{d_G(x,a)+d_G(b,y)\} max y ∈ C x , i > { d G ( x , a ) + d G ( b , y )} . Keeping C x , i C_{x,i} C x , i up to date is again easy: When we go from round i i i to i + 1 i+1 i + 1 , we observe we can get C x , i + 1 C_{x,i+1} C x , i + 1 from C x , i C_{x,i} C x , i , by removing from C x i C_x^i C x i all elements y y y such that r ( x , y ) = i r(x,y)=i r ( x , y ) = i and inserting all such that ℓ ( x , y ) = i + 1 \ell(x,y)=i+1 ℓ ( x , y ) = i + 1 .
Runtime: For the running time notice that first we need to compute the values d ~ G ∖ e i ( a , y ) \tilde d_{G\setminus e_i}(a,y) d ~ G ∖ e i ( a , y ) in time O ( h ∣ X ∣ ) O(h|X|) O ( h ∣ X ∣ ) . Then, in each round we perform at most O ( ∣ X ∣ ) O(|X|) O ( ∣ X ∣ ) operations on binary balanced search trees. Moreover, each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P is inserted/deleted at most once from L i , x L_{i,x} L i , x and C i , x C_{i,x} C i , x .
This brings us to the key results behind Main Theorem 1. Here, we consider P , a , b , X , Y , h P,a,b,X,Y,h P , a , b , X , Y , h as we did so far. We want to determine max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P}d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) for every i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , which can be seen as the diameter of G ∖ e i G\setminus e_i G ∖ e i restricted to the path set P P P . A naive approach using a DSO would be to query d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) for every ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , thereby requiring ∣ P ∣ h |P|h ∣ P ∣ h queries. Using Lemma 4.4, following again the discussion of § 5.1 we can improve this, using only O ~ ( ∣ P ∣ + h ( ∣ X ∣ + ∣ Y ∣ ) ) \tilde O(|P|+h(|X|+|Y|)) O ~ ( ∣ P ∣ + h ( ∣ X ∣ + ∣ Y ∣ )) queries and time.
Corollary 4.5. Let P , a , b , X , Y , h P,a,b,X,Y,h P , a , b , X , Y , h be as in Definition 4.1 , and suppose that we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . Then, in time O ( ∣ P ∣ log n + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) O(|P|\log n+h(|X|+|Y|)\log n) O ( ∣ P ∣ log n + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) , we can compute for each i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] the value max ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{(x,y)\in P}d_{G\setminus e_i}(x,y) max ( x , y ) ∈ P d G ∖ e i ( x , y ) .
Finally, we turn to computing for each x ∈ X x\in X x ∈ X in G ∖ e i G\setminus e_i G ∖ e i the value max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) , which can be tough somehow as the eccentricity of x x x in G ∖ e i G\setminus e_i G ∖ e i w.r.t. the set of paths P P P . Within the same running time as Corollary 4.5 (up to a log 1 + ε n M \log^{1+\varepsilon}nM log 1 + ε n M factor), we can compute ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximations of these values.
Lemma 4.6. Let P , a , b , X , Y , h P,a,b,X,Y,h P , a , b , X , Y , h be as in Definition 4.1 , and suppose that we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . If the graph has edge weights in [ 1 … M ] [1\ldots M] [ 1 … M ] , then we can compute in time O ( ∣ P ∣ log n log 1 + ε n M + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) O(|P|\log n\log^{1+\varepsilon}nM+h(|X|+|Y|)\log n) O ( ∣ P ∣ log n log 1 + ε n M + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation of the value max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) .
Proof. Borrowing the notation from Lemma 4.4, we observe that max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) equals to
max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) : = max { max y ∈ L x , i d G ∖ e i ( x , y ) , max y ∈ C x , i d G ∖ e i ( x , y ) , max y ∈ R x , i d G ∖ e i ( x , y ) } . \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y):=\max\left\{\max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y),\max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y),\max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y)\right\}. y : ( x , y ) ∈ P max d G ∖ e i ( x , y ) := max { y ∈ L x , i max d G ∖ e i ( x , y ) , y ∈ C x , i max d G ∖ e i ( x , y ) , y ∈ R x , i max d G ∖ e i ( x , y ) } .
where R x , i : = { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ] } R_{x,i}:=\{y:(x,y)\in P,\ i\in(r(x,y)\ldots h]\} R x , i := { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) … h ]} . The first two terms can be computed (exactly) using Lemma 4.4. It remains to explain how to compute ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximations of the last term, i.e., max y ∈ R x , i d G ∖ e i ( x , y ) \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ R x , i d G ∖ e i ( x , y ) . To this end, by Corollary 4.3, for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] :
max y ∈ R x , i d G ∖ e i ( x , y ) = d G ( x , a ) + max y ∈ R x , i min { d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y ) } . \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y)=d_G(x,a)+\max_{y\in R_{x,i}}\min\{\tilde d_{G\setminus e_i}(a,y),d_{G\setminus e_i}(a,b)+d_G(b,y)\}. y ∈ R x , i max d G ∖ e i ( x , y ) = d G ( x , a ) + y ∈ R x , i max min { d ~ G ∖ e i ( a , y ) , d G ∖ e i ( a , b ) + d G ( b , y )} .
In this last expression, we round d ~ G ∖ e i ( a , y ) \tilde d_{G\setminus e_i}(a,y) d ~ G ∖ e i ( a , y ) to the closest power of ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) obtaining d ^ G ∖ e i ( a , y ) \hat d_{G\setminus e_i}(a,y) d ^ G ∖ e i ( a , y ) . Clearly, using d ^ G ∖ e i ( a , y ) \hat d_{G\setminus e_i}(a,y) d ^ G ∖ e i ( a , y ) instead of d ~ G ∖ e i ( a , y ) \tilde d_{G\setminus e_i}(a,y) d ~ G ∖ e i ( a , y ) , yields a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation.
Now, we proceed in h h h rounds. In the i i i th round, we maintain for each x ∈ X x\in X x ∈ X the set R x , i R_{x,i} R x , i as a binary balanced search tree ordered by d ^ G ∖ e i ( a , y ) − d G ( b , y ) \hat d_{G\setminus e_i}(a,y)-d_G(b,y) d ^ G ∖ e i ( a , y ) − d G ( b , y ) . The tree need to support O ( log n ) O(\log n) O ( log n ) -time split/merge operations and subtree maxima. To get the desired value for a certain x x x in the i i i th round, we split R x , i R_{x,i} R x , i into R x , i ≤ R_{x,i}^{\leq} R x , i ≤ and R x , i > R_{x,i}^{>} R x , i > using a split operation depending on how d ^ G ∖ e i ( a , y ) − d G ( b , y ) \hat d_{G\setminus e_i}(a,y)-d_G(b,y) d ^ G ∖ e i ( a , y ) − d G ( b , y ) compares to d G ∖ e i ( a , b ) d_{G\setminus e_i}(a,b) d G ∖ e i ( a , b ) . Then, via subtree maxima, from R x , i ≤ R_{x,i}^{\leq} R x , i ≤ and R x , i > R_{x,i}^{>} R x , i > we can obtain the desired value by taking the maximum between d G ( x , a ) + max y ∈ R x , i ≤ { d ^ G ∖ e i ( a , y ) } d_G(x,a)+\max_{y\in R_{x,i}^{\leq}}\{\hat d_{G\setminus e_i}(a,y)\} d G ( x , a ) + max y ∈ R x , i ≤ { d ^ G ∖ e i ( a , y )} and d G ( x , a ) + max y ∈ R x , i > { d G ∖ e i ( a , b ) + d G ( b , y ) } d_G(x,a)+\max_{y\in R_{x,i}^{>}}\{d_{G\setminus e_i}(a,b)+d_G(b,y)\} d G ( x , a ) + max y ∈ R x , i > { d G ∖ e i ( a , b ) + d G ( b , y )} .
We keep R x , i R_{x,i} R x , i up to date as follows: When going from round i i i to i + 1 i+1 i + 1 , we get R x , i + 1 R_{x,i+1} R x , i + 1 from R x , i R_{x,i} R x , i , by inserting all elements such that r ( x , y ) = i r(x,y)=i r ( x , y ) = i , and by updating the stored values for all y ∈ R x , i y\in R_{x,i} y ∈ R x , i such that d ^ G ∖ e i ( a , y ) \hat{d}_{G\setminus e_i}(a,y) d ^ G ∖ e i ( a , y ) drops down to the next power of 1 + ε 1+\varepsilon 1 + ε (notice that d ^ G ∖ e i ( a , y ) \hat{d}_{G\setminus e_i}(a,y) d ^ G ∖ e i ( a , y ) can only decrease because so does d ~ G ∖ e i ( a , y ) \tilde{d}_{G\setminus e_i}(a,y) d ~ G ∖ e i ( a , y ) ).
Runtime: We only analyze the complexity related to computing the value max y ∈ R x , i d G ∖ e i ( x , y ) \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ R x , i d G ∖ e i ( x , y ) . In each round, to get these values for each x ∈ X x\in X x ∈ X , we perform at most O ( 1 ) O(1) O ( 1 ) operations on binary balanced search trees. Moreover, for keeping up to date R x , i R_{x,i} R x , i , we note that each ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P is inserted at most once into R i , x R_{i,x} R i , x and updated at most O ( log 1 + ε n M ) O(\log_{1+\varepsilon} nM) O ( log 1 + ε n M ) times.
If instead of an approximation we aim for the exact term, we manage to achieve an improvement over a naive DSO querying strategy when ∣ P ∣ ≈ ∣ X ∣ ∣ Y ∣ |P|\approx|X||Y| ∣ P ∣ ≈ ∣ X ∣∣ Y ∣ and h ≈ ∣ X ∣ ≈ ∣ Y ∣ h\approx|X|\approx|Y| h ≈ ∣ X ∣ ≈ ∣ Y ∣ .
Lemma 4.7. Let P , a , b , X , Y , h P,a,b,X,Y,h P , a , b , X , Y , h be as in Definition 4.1 , and suppose that we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . Let a parameter 0 < Δ ≤ h 0<\Delta\le h 0 < Δ ≤ h be given as well. Then, using O ( Δ ⋅ ∣ P ∣ ) O(\Delta\cdot|P|) O ( Δ ⋅ ∣ P ∣ ) additional values of the form d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) for some ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , we can compute in time O ~ ( h / Δ ⋅ T m a x - m i n ( ∣ X ∣ , ∣ Y ∣ , Δ ) ) \widetilde{O}(h/\Delta\cdot T_{\mathrm{max\text{-}min}}(|X|,|Y|,\Delta)) O ( h /Δ ⋅ T max - min ( ∣ X ∣ , ∣ Y ∣ , Δ )) for each x ∈ X x\in X x ∈ X the value max y : ( x , y ) ∈ P d G ∖ e ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e}(x,y) max y : ( x , y ) ∈ P d G ∖ e ( x , y ) .
Proof. We partition [ 1 … h ] [1\ldots h] [ 1 … h ] into s : = ⌈ h / Δ ⌉ s:=\lceil h/\Delta\rceil s := ⌈ h /Δ ⌉ contiguous subsets I 1 , … , I s I_1,\ldots,I_s I 1 , … , I s each of size Δ \Delta Δ (the last subset might be potentially smaller). For ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P , we let t ( x , y ) t(x,y) t ( x , y ) be equal to the j j j such that r ( x , y ) ∈ I j r(x,y)\in I_j r ( x , y ) ∈ I j .
Next, for each j ∈ [ 1 … s ] j\in[1\ldots s] j ∈ [ 1 … s ] , we construct the ∣ X ∣ × ∣ Y ∣ |X|\times|Y| ∣ X ∣ × ∣ Y ∣ and ∣ Y ∣ × ∣ I j ∣ |Y|\times|I_j| ∣ Y ∣ × ∣ I j ∣ matrices A j A_j A j and B j B_j B j as
A j [ x , y ] : = { + ∞ if ( x , y ) ∈ P and j ∈ ( t ( x , y ) … s ] , − ∞ otherwise; for x ∈ X , y ∈ Y , A_j[x,y]:=
\begin{cases}
+\infty& \text{if }(x,y)\in P\text{ and }j\in(t(x,y)\ldots s],\\
-\infty& \text{otherwise;}
\end{cases}
\qquad\text{for }x\in X,y\in Y, A j [ x , y ] := { + ∞ − ∞ if ( x , y ) ∈ P and j ∈ ( t ( x , y ) … s ] , otherwise; for x ∈ X , y ∈ Y ,
B j [ y , i ] : = d G ∖ e i ( a , y ) for y ∈ Y , i ∈ I j . B_j[y,i]:=d_{G\setminus e_i}(a,y)
\qquad\text{for }y\in Y,i\in I_j. B j [ y , i ] := d G ∖ e i ( a , y ) for y ∈ Y , i ∈ I j .
This allows us, for each j ∈ [ 1 … s ] j\in[1\ldots s] j ∈ [ 1 … s ] , to compute the product M j : = A j ⊚ B j M_j:=A_j\mathbin{\circledcirc} B_j M j := A j ⊚ B j . Moreover, via Lemma 4.4, we compute for each i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] and x ∈ X x\in X x ∈ X the values max y ∈ L x , i d G ∖ e i ( x , y ) \max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ L x , i d G ∖ e i ( x , y ) and max y ∈ C x , i d G ∖ e i ( x , y ) \max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ C x , i d G ∖ e i ( x , y ) .
Finally, for each x ∈ X x\in X x ∈ X and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , we compute the desired value max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) as
max { max y ∈ L x , i d G ∖ e i ( x , y ) , max y ∈ C x , i d G ∖ e i ( x , y ) , max y : ( x , y ) ∈ P i ∈ I t ( x , y ) d G ∖ e i ( x , y ) , max j ∈ [ 1 … Δ ] M j ( i ) [ x , i ] + d G ( x , a ) } , (7) \max\left\{
\max_{y\in L_{x,i}}d_{G\setminus e_i}(x,y),
\max_{y\in C_{x,i}}d_{G\setminus e_i}(x,y),
\max_{\substack{y:(x,y)\in P\\ i\in I_{t(x,y)}}}d_{G\setminus e_i}(x,y),
\max_{j\in[1\ldots\Delta]}M_{j(i)}[x,i]+d_G(x,a)
\right\}, \tag*{(7)} max ⎩ ⎨ ⎧ y ∈ L x , i max d G ∖ e i ( x , y ) , y ∈ C x , i max d G ∖ e i ( x , y ) , y : ( x , y ) ∈ P i ∈ I t ( x , y ) max d G ∖ e i ( x , y ) , j ∈ [ 1 … Δ ] max M j ( i ) [ x , i ] + d G ( x , a ) ⎭ ⎬ ⎫ , (7)
where j ( i ) j(i) j ( i ) is the unique block index satisfying i ∈ I j ( i ) i\in I_{j(i)} i ∈ I j ( i ) . (Note that the third term in Equation (7) are the claimed O ( Δ ⋅ ∣ P ∣ ) O(\Delta\cdot|P|) O ( Δ ⋅ ∣ P ∣ ) additional terms.)
Correctness: We claim that for every x ∈ X x\in X x ∈ X , j ∈ [ 1 … s ] j\in[1\ldots s] j ∈ [ 1 … s ] and i ∈ I j i\in I_j i ∈ I j , we have
M j [ x , i ] + d G ( x , a ) = { − ∞ if { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ] } = ∅ , max y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] d G ∖ e i ( x , y ) otherwise. M_j[x,i]+d_G(x,a)=
\begin{cases}
-\infty& \text{if }\{y:(x,y)\in P,j\in(t(x,y)\ldots s]\}=\varnothing,\\
\max_{\substack{y:(x,y)\in P\\j\in(t(x,y)\ldots s]}}d_{G\setminus e_i}(x,y) & \text{otherwise.}
\end{cases} M j [ x , i ] + d G ( x , a ) = ⎩ ⎨ ⎧ − ∞ max y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] d G ∖ e i ( x , y ) if { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ]} = ∅ , otherwise.
Clearly, this is sufficient because for every y y y such that ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P one of y ∈ L x , i y\in L_{x,i} y ∈ L x , i , y ∈ C x , i y\in C_{x,i} y ∈ C x , i , i ∈ I t ( x , y ) i\in I_{t(x,y)} i ∈ I t ( x , y ) and i ∈ I j i\in I_j i ∈ I j for some j ∈ ( t ( x , y ) … s ] j\in(t(x,y)\ldots s] j ∈ ( t ( x , y ) … s ] always holds.
Let x ∈ X x\in X x ∈ X , j ∈ [ 1 … s ] j\in[1\ldots s] j ∈ [ 1 … s ] and i ∈ I j i\in I_j i ∈ I j . Assuming { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ] } ≠ ∅ \{y:(x,y)\in P,j\in(t(x,y)\ldots s]\}\ne\varnothing { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ]} = ∅ , we observe that
M j [ x , i ] + d G ( x , a ) = max y ∈ Y min { A j [ x , y ] , B j [ y , i ] + d G ( x , a ) } = max y ∈ Y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] B j [ y , i ] + d G ( x , a ) = max y ∈ Y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] d G ∖ e i ( x , y ) , \begin{aligned}
M_j[x,i]+d_G(x,a)
&=\max_{y\in Y}\min\{A_j[x,y],B_j[y,i]+d_G(x,a)\}\\
&=\max_{\substack{y\in Y:(x,y)\in P\\j\in(t(x,y)\ldots s]}}B_j[y,i]+d_G(x,a)\\
&=\max_{\substack{y\in Y:(x,y)\in P\\j\in(t(x,y)\ldots s]}}d_{G\setminus e_i}(x,y),
\end{aligned} M j [ x , i ] + d G ( x , a ) = y ∈ Y max min { A j [ x , y ] , B j [ y , i ] + d G ( x , a )} = y ∈ Y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] max B j [ y , i ] + d G ( x , a ) = y ∈ Y : ( x , y ) ∈ P j ∈ ( t ( x , y ) … s ] max d G ∖ e i ( x , y ) ,
where in the last step we use that, by Corollary 4.3, for all y y y such that i ∈ ( t ( x , y ) … h ] i\in(t(x,y)\ldots h] i ∈ ( t ( x , y ) … h ] (which means i ∈ ( r ( x , y ) … h ] i\in(r(x,y)\ldots h] i ∈ ( r ( x , y ) … h ] ) we have d G ∖ e i ( a , y ) + d G ( x , a ) = d G ∖ e i ( x , y ) d_{G\setminus e_i}(a,y)+d_G(x,a)=d_{G\setminus e_i}(x,y) d G ∖ e i ( a , y ) + d G ( x , a ) = d G ∖ e i ( x , y ) . Otherwise, if { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ] } = ∅ \{y:(x,y)\in P,j\in(t(x,y)\ldots s]\}=\varnothing { y : ( x , y ) ∈ P , j ∈ ( t ( x , y ) … s ]} = ∅ , we take the maximum over only − ∞ -\infty − ∞ in the product.
Runtime: We compute a ∣ X ∣ × ∣ Y ∣ |X| \times|Y| ∣ X ∣ × ∣ Y ∣ by ∣ Y ∣ × O ( Δ ) |Y| \times\mathcal{O}(\Delta) ∣ Y ∣ × O ( Δ ) product exactly s = ⌈ h / Δ ⌉ s = \lceil h/\Delta\rceil s = ⌈ h /Δ ⌉ times. This costs at least the input/output size Ω ( h / Δ ⋅ ( ∣ X ∣ ⋅ ∣ Y ∣ + ∣ Y ∣ ⋅ Δ + ∣ X ∣ ⋅ Δ ) ) \Omega(h/\Delta\cdot(|X| \cdot|Y| + |Y| \cdot\Delta+ |X| \cdot\Delta)) Ω ( h /Δ ⋅ ( ∣ X ∣ ⋅ ∣ Y ∣ + ∣ Y ∣ ⋅ Δ + ∣ X ∣ ⋅ Δ )) . This last expression already dominates (up to logarithmic factors) all other computations that we perform, including Lemma 4.4.
Putting Everything Together
Main Theorem 1. Let G G G be a graph (directed or undirected, weighted or unweighted) with n n n nodes. Suppose it takes time P P P to construct a DSO for G G G with query time O ( 1 ) \mathcal{O}(1) O ( 1 ) , and it takes time T T T to compute a set of canonical shortest paths on G G G . Then, we can solve the following problems on G G G :
(i) decremental diameter with P + T + O ~ ( n 2 ) P + T + \widetilde{\mathcal{O}}(n^2) P + T + O ( n 2 ) preprocessing and O ( 1 ) \mathcal{O}(1) O ( 1 ) query time;
(ii) ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate all-node decremental eccentricities with P + T + O ~ ε ( n 2 log M ) P + T + \widetilde{\mathcal{O}}_{\varepsilon}(n^2 \log M) P + T + O ε ( n 2 log M ) preprocessing and O ( 1 ) \mathcal{O}(1) O ( 1 ) query time, assuming the graph has edge weights in [ 1.. M ] [1..M] [ 1.. M ] ;
(iii) all-node decremental eccentricities in P + T + O ~ ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) P + T + \widetilde{\mathcal{O}}(n^{2+(7-\omega)/(10-2\omega)}) = P + T + \mathcal{O}(n^{2.88}) P + T + O ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) preprocessing and O ( 1 ) \mathcal{O}(1) O ( 1 ) query time. Here ω < 2.3714 \omega< 2.3714 ω < 2.3714 is the exponent of square matrix multiplication [ADV+25].12
Proof. Let V V V and E E E be the vertex and edge sets of G G G , respectively, and assume we have available for each pair of vertices u , v ∈ V u,v \in V u , v ∈ V a canonical shortest path π G ( u , v ) \pi_G(u,v) π G ( u , v ) after running the subroutine on the graph. First, we give the proof of Algorithm (i) and Algorithm (ii) together, as they use the same sampling strategy. Then, we give the proof of Algorithm (iii).
Proof of Algorithm (i) and Algorithm (ii).
We assign priorities as in [BK08, BK09b]. We assign to each vertex v ∈ V v \in V v ∈ V a priority k ∈ [ 1.. p ] k \in[1..p] k ∈ [ 1.. p ] , where p = Θ ( log n ) p = \Theta(\log n) p = Θ ( log n ) . We say that v ∈ V v \in V v ∈ V is a k k k -center if it has priority k k k , and we denote by R k R_k R k the set of all k k k -centers. We require the following two properties:
(1) For every u , v ∈ V u,v \in V u , v ∈ V , if π G ( u , v ) \pi_G(u,v) π G ( u , v ) contains Ω ( 2 k log n ) \Omega(2^k \log n) Ω ( 2 k log n ) vertices, then it also contains a k k k -center;
(2) The set R k R_k R k has size ∣ R k ∣ = O ( n / 2 k ⋅ log n ) |R_k| = \mathcal{O}(n/2^k \cdot\log n) ∣ R k ∣ = O ( n / 2 k ⋅ log n ) for k ∈ ( 1.. p ] k \in(1..p] k ∈ ( 1.. p ] , and R 1 = V R_1 = V R 1 = V .
A simple approach to obtain R k R_k R k is to give each vertex priority k ∈ ( 1.. p ] k \in(1..p] k ∈ ( 1.. p ] with probability proportional to Θ ( 2 − k ) \Theta(2^{-k}) Θ ( 2 − k ) . This ensures that the desired properties hold with high probability.
Next, for every pair of vertices x , y ∈ V x,y \in V x , y ∈ V , we split the path π G ( x , y ) \pi_G(x,y) π G ( x , y ) into segments. To do this, we identify a sequence of centers c 1 , c 2 , … , c ℓ c_1,c_2,\ldots,c_\ell c 1 , c 2 , … , c ℓ with ℓ = O ( log n ) \ell= \mathcal{O}(\log n) ℓ = O ( log n ) based on their priorities. We set c 1 = x c_1 = x c 1 = x , and define c i c_i c i as the first center on the subpath π G ( c i − 1 , y ) \pi_G(c_{i-1},y) π G ( c i − 1 , y ) with a priority strictly higher than that of c i − 1 c_{i-1} c i − 1 . Once the center with the maximal priority on the path is reached, the subsequent centers are selected in ascending order from c ℓ = y c_\ell= y c ℓ = y in reverse order. Finally, we assign the pair ( x , y ) (x,y) ( x , y ) to each pair ( c i , c i + 1 ) (c_i,c_{i+1}) ( c i , c i + 1 ) for i ∈ [ 1.. ℓ ) i \in[1..\ell) i ∈ [ 1.. ℓ ) .
Now, for every pair ( a , b ) ∈ V × V (a,b) \in V \times V ( a , b ) ∈ V × V , we let P ( a , b ) ⊆ V × V P(a,b) \subseteq V \times V P ( a , b ) ⊆ V × V be the set of ( x , y ) (x,y) ( x , y ) pairs assigned to it. Further, we define X ( a , b ) = { x : ( x , y ) ∈ P ( a , b ) } X(a,b) = \{x : (x,y) \in P(a,b)\} X ( a , b ) = { x : ( x , y ) ∈ P ( a , b )} , Y ( a , b ) = { y : ( x , y ) ∈ P ( a , b ) } Y(a,b) = \{y : (x,y) \in P(a,b)\} Y ( a , b ) = { y : ( x , y ) ∈ P ( a , b )} and h ( a , b ) h(a,b) h ( a , b ) as the number of edges on π G ( a , b ) \pi_G(a,b) π G ( a , b ) .
Now, for Algorithm (i), this allows us to apply Corollary 4.5 to every ( a , b ) (a,b) ( a , b ) with P ( a , b ) ≠ ∅ P(a,b) \ne\varnothing P ( a , b ) = ∅ . For each e ∈ E e \in E e ∈ E , return max { diam ( G ) , max ( a , b ) : e ∈ π G ( a , b ) max ( x , y ) ∈ P ( a , b ) d G ∖ { e } ( x , y ) } \max\{\operatorname{diam}(G), \max_{(a,b):e \in\pi_G(a,b)} \max_{(x,y)\in P(a,b)} d_{G\setminus\{e\}}(x,y)\} max { diam ( G ) , max ( a , b ) : e ∈ π G ( a , b ) max ( x , y ) ∈ P ( a , b ) d G ∖ { e } ( x , y )} . Clearly, this is correct, as max { max x , y : e ∈ π G ( x , y ) d G ∖ { e } ( x , y ) , diam ( G ) } \max\{\max_{x,y:e\in\pi_G(x,y)} d_{G\setminus\{e\}}(x,y), \operatorname{diam}(G)\} max { max x , y : e ∈ π G ( x , y ) d G ∖ { e } ( x , y ) , diam ( G )} equals to diam ( G ∖ e ) \operatorname{diam}(G \setminus e) diam ( G ∖ e ) .
On the other hand, for Algorithm (ii), we apply Lemma 4.6 instead and obtain for each e ∈ π G ( a , b ) e \in\pi_G(a,b) e ∈ π G ( a , b ) and x ∈ X ( a , b ) x \in X(a,b) x ∈ X ( a , b ) a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation of max y : ( x , y ) ∈ P ( a , b ) d G ∖ { e } ( x , y ) \max_{y:(x,y)\in P(a,b)} d_{G\setminus\{e\}}(x,y) max y : ( x , y ) ∈ P ( a , b ) d G ∖ { e } ( x , y ) . Then, for each e ∈ E e \in E e ∈ E and x ∈ V x \in V x ∈ V , take the maximum of ecc G ( x ) \operatorname{ecc}_G(x) ecc G ( x ) and all estimates for ( a , b ) (a,b) ( a , b ) with x ∈ X ( a , b ) x \in X(a,b) x ∈ X ( a , b ) and e ∈ π G ( a , b ) e \in\pi_G(a,b) e ∈ π G ( a , b ) . Correctness should be equally clear here.
Runtime: For the runtime analysis, we first consider an arbitrary node a ∈ V a \in V a ∈ V with priority k ∈ [ 1.. p ] k \in[1..p] k ∈ [ 1.. p ] . Observe that for any b ∈ V b \in V b ∈ V such that P ( a , b ) ≠ ∅ P(a,b) \ne\emptyset P ( a , b ) = ∅ , we have h ( a , b ) = O ( 2 k log n ) h(a,b) = O(2^k \log n) h ( a , b ) = O ( 2 k log n ) due to Property (1). Moreover, we claim that for each a ∈ V a \in V a ∈ V , the sets Y ( a , b ) Y(a,b) Y ( a , b ) for distinct b ∈ V b \in V b ∈ V must be disjoint. To see this, assume for the sake of contradiction that there exist b ≠ b ′ b \ne b' b = b ′ and a vertex y ∈ Y ( a , b ) ∩ Y ( a , b ′ ) y \in Y(a,b) \cap Y(a,b') y ∈ Y ( a , b ) ∩ Y ( a , b ′ ) . This implies that the path π G ( a , y ) \pi_G(a,y) π G ( a , y ) includes both b b b and b ′ b' b ′ . However, the criteria for splitting paths ensure that the next center is unique, a contradiction. Thus, ∑ b ∈ V ∣ Y ( a , b ) ∣ ≤ n \sum_{b \in V} |Y(a,b)| \le n ∑ b ∈ V ∣ Y ( a , b ) ∣ ≤ n . Similarly, one can show that for any b ∈ V b \in V b ∈ V with priority k k k and a ∈ V a \in V a ∈ V , we have h ( a , b ) = O ( 2 k log n ) h(a,b) = O(2^k \log n) h ( a , b ) = O ( 2 k log n ) and ∑ a ∈ V ∣ X ( a , b ) ∣ ≤ n \sum_{a \in V} |X(a,b)| \le n ∑ a ∈ V ∣ X ( a , b ) ∣ ≤ n .
For Algorithm (i), we obtain an overall runtime of:
P + T + O ( ∑ ( a , b ) ∈ V × V P ( a , b ) ≠ ∅ ( ∣ P ( a , b ) ∣ log n + h ( a , b ) ⋅ ∣ X ( a , b ) ∣ log n + h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ log n ) ) = P + T + O ( n 2 log 2 n + ∑ k ∈ [ 1.. p ] ( ∑ a ∈ R k ( a , b ) ∈ V × V P ( a , b ) ≠ ∅ h ( a , b ) ⋅ ∣ X ( a , b ) ∣ + ∑ b ∈ R k ( a , b ) ∈ V × V P ( a , b ) ≠ ∅ h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ ) log n ) = P + T + O ( n 2 log 2 n + ∑ k ∈ [ 1.. p ] ( ∣ R k ∣ ⋅ n 2 k log 2 n ) ) = P + T + O ( n 2 log 4 n ) . \begin{aligned}
P + T + O\left(\sum_{\substack{(a,b)\in V\times V\\P(a,b)\ne\emptyset}}\left(|P(a,b)|\log n+h(a,b)\cdot|X(a,b)|\log n+h(a,b)\cdot|Y(a,b)|\log n\right)\right) \\
&= P + T + O\left(n^2\log^2 n+\sum_{k\in[1..p]}\left(\sum_{\substack{a\in R_k\\(a,b)\in V\times V\\P(a,b)\ne\emptyset}}h(a,b)\cdot|X(a,b)|+\sum_{\substack{b\in R_k\\(a,b)\in V\times V\\P(a,b)\ne\emptyset}}h(a,b)\cdot|Y(a,b)|\right)\log n\right) \\
&= P + T + O\left(n^2\log^2 n+\sum_{k\in[1..p]}\left(|R_k|\cdot n2^k\log^2 n\right)\right) \\
&= P + T + O\left(n^2\log^4 n\right).
\end{aligned} P + T + O ( a , b ) ∈ V × V P ( a , b ) = ∅ ∑ ( ∣ P ( a , b ) ∣ log n + h ( a , b ) ⋅ ∣ X ( a , b ) ∣ log n + h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ log n ) = P + T + O n 2 log 2 n + k ∈ [ 1.. p ] ∑ a ∈ R k ( a , b ) ∈ V × V P ( a , b ) = ∅ ∑ h ( a , b ) ⋅ ∣ X ( a , b ) ∣ + b ∈ R k ( a , b ) ∈ V × V P ( a , b ) = ∅ ∑ h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ log n = P + T + O n 2 log 2 n + k ∈ [ 1.. p ] ∑ ( ∣ R k ∣ ⋅ n 2 k log 2 n ) = P + T + O ( n 2 log 4 n ) .
where we use that each ( x , y ) (x,y) ( x , y ) appears in at most O ( log n ) O(\log n) O ( log n ) sets P ( a , b ) P(a,b) P ( a , b ) . For Algorithm (ii), we obtain the same analysis as above, up to a factor of O ~ ( log 1 + ε M ) \widetilde{O}(\log_{1+\varepsilon} M) O ( log 1 + ε M ) .
Proof of Algorithm (iii).
For Algorithm (iii), use a slightly different definition of the sets P ( a , b ) P(a,b) P ( a , b ) . We sample a set S ⊆ V S \subseteq V S ⊆ V of size Θ ( n Δ log n ) \Theta\left(\frac{n}{\Delta}\log n\right) Θ ( Δ n log n ) . With high probability, any shortest path π G ( x , y ) \pi_G(x,y) π G ( x , y ) containing at least Δ \Delta Δ edges intersects S S S . For each such pair ( x , y ) (x,y) ( x , y ) , let a a a and b b b be the first and last nodes from S S S appearing on π G ( x , y ) \pi_G(x,y) π G ( x , y ) , respectively. We assign ( x , y ) (x,y) ( x , y ) to the pair ( a , b ) (a,b) ( a , b ) .
We define P ( a , b ) ⊆ V × V P(a,b)\subseteq V\times V P ( a , b ) ⊆ V × V as the set of pairs ( x , y ) (x,y) ( x , y ) assigned to the pair ( a , b ) ∈ S × S (a,b)\in S\times S ( a , b ) ∈ S × S , and define X ( a , b ) X(a,b) X ( a , b ) , Y ( a , b ) Y(a,b) Y ( a , b ) , and h ( a , b ) h(a,b) h ( a , b ) accordingly. Let α ≤ Δ \alpha\le\Delta α ≤ Δ be a parameter to be determined.
For each x ∈ V x\in V x ∈ V and each edge e e e on the shortest path tree of x x x , we compute the replacement eccentricity ecc G ∖ e ( x ) \operatorname{ecc}_{G\setminus e}(x) ecc G ∖ e ( x ) as the maximum of ecc G ( x ) \operatorname{ecc}_G(x) ecc G ( x ) and the following three terms:
max y : y ∈ P ( a , b ) d G ∖ e ( x , y ) \max_{y:y\in P(a,b)}d_{G\setminus e}(x,y) max y : y ∈ P ( a , b ) d G ∖ e ( x , y ) for all ( a , b ) ∈ S × S (a,b)\in S\times S ( a , b ) ∈ S × S s.t. e ∈ π G ( a , b ) e\in\pi_G(a,b) e ∈ π G ( a , b ) , x ∈ X ( a , b ) x\in X(a,b) x ∈ X ( a , b ) , min ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ) ≤ α \min(|X(a,b)|,|Y(a,b)|)\le\alpha min ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ) ≤ α ;
max y : y ∈ P ( a , b ) d G ∖ e ( x , y ) \max_{y:y\in P(a,b)}d_{G\setminus e}(x,y) max y : y ∈ P ( a , b ) d G ∖ e ( x , y ) for all ( a , b ) ∈ S × S (a,b)\in S\times S ( a , b ) ∈ S × S s.t. e ∈ π G ( a , b ) e\in\pi_G(a,b) e ∈ π G ( a , b ) , x ∈ X ( a , b ) x\in X(a,b) x ∈ X ( a , b ) , ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ > α |X(a,b)|,|Y(a,b)|>\alpha ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ > α ;
the maximum d G ∖ e ( x , y ) d_{G\setminus e}(x,y) d G ∖ e ( x , y ) among all y ∈ V y\in V y ∈ V s.t. e e e lies among the first or last O ( Δ ) O(\Delta) O ( Δ ) edges of π G ( x , y ) \pi_G(x,y) π G ( x , y ) .
Taking the maximum over these cases correctly yields ecc G ∖ e ( x ) \operatorname{ecc}_{G\setminus e}(x) ecc G ∖ e ( x ) , as they exhaustively cover all pairs ( x , y ) (x,y) ( x , y ) for which e e e lies on the original shortest path π G ( x , y ) \pi_G(x,y) π G ( x , y ) .
Runtime: We break down the computation of Terms 1., 2., and 3. as follows. For Term 1., we iterate over all pairs ( a , b ) ∈ S × S (a,b)\in S\times S ( a , b ) ∈ S × S where min ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ) ≤ α \min(|X(a,b)|,|Y(a,b)|)\le\alpha min ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ ) ≤ α . For each pair ( x , y ) ∈ P ( a , b ) (x,y)\in P(a,b) ( x , y ) ∈ P ( a , b ) and each edge e ∈ π G ( x , y ) e\in\pi_G(x,y) e ∈ π G ( x , y ) , we compute d G ∖ e ( x , y ) d_{G\setminus e}(x,y) d G ∖ e ( x , y ) by querying the Distance Sensitivity Oracle (DSO). For a fixed x ∈ X ( a , b ) x\in X(a,b) x ∈ X ( a , b ) , computing max y ∈ P ( a , b ) d G ∖ e ( x , y ) \max_{y\in P(a,b)}d_{G\setminus e}(x,y) max y ∈ P ( a , b ) d G ∖ e ( x , y ) takes O ( ∣ X ( a , b ) ∣ h ( a , b ) ) O(|X(a,b)|h(a,b)) O ( ∣ X ( a , b ) ∣ h ( a , b )) time. Summing over all relevant ( a , b ) ∈ S × S (a,b)\in S\times S ( a , b ) ∈ S × S :
∑ ( a , b ) ∈ S × S ∣ X ( a , b ) ∣ ≤ α h ( a , b ) ∣ P ( a , b ) ∣ ≤ ∑ ( a , b ) ∈ S × S ∣ X ( a , b ) ∣ ≤ α n ∣ X ( a , b ) ∣ ∣ Y ( a , b ) ∣ ≤ ∑ ( a , b ) ∈ S × S ∣ Y ( a , b ) ∣ n α . \sum_{\substack{(a,b)\in S\times S\\|X(a,b)|\le\alpha}}h(a,b)|P(a,b)|
\le
\sum_{\substack{(a,b)\in S\times S\\|X(a,b)|\le\alpha}}n|X(a,b)||Y(a,b)|
\le
\sum_{(a,b)\in S\times S}|Y(a,b)|n\alpha. ( a , b ) ∈ S × S ∣ X ( a , b ) ∣ ≤ α ∑ h ( a , b ) ∣ P ( a , b ) ∣ ≤ ( a , b ) ∈ S × S ∣ X ( a , b ) ∣ ≤ α ∑ n ∣ X ( a , b ) ∣∣ Y ( a , b ) ∣ ≤ ( a , b ) ∈ S × S ∑ ∣ Y ( a , b ) ∣ n α .
Using the property that ∑ ( a , b ) ∈ S × S ∣ Y ( a , b ) ∣ = O ~ ( n 2 / Δ ) \sum_{(a,b)\in S\times S}|Y(a,b)|=\widetilde{O}(n^2/\Delta) ∑ ( a , b ) ∈ S × S ∣ Y ( a , b ) ∣ = O ( n 2 /Δ ) , the total time for this case is O ~ ( n 3 α / Δ ) \widetilde{O}(n^3\alpha/\Delta) O ( n 3 α /Δ ) . A symmetric bound holds for the case where ∣ Y ( a , b ) ∣ ≤ α |Y(a,b)|\le\alpha ∣ Y ( a , b ) ∣ ≤ α . For Term 3., we consider pairs ( x , y ) (x,y) ( x , y ) where e e e lies within the first or last O ( Δ ) O(\Delta) O ( Δ ) edges of π G ( x , y ) \pi_G(x,y) π G ( x , y ) . For each such x ∈ V x \in V x ∈ V , we query the DSO for all O ( Δ ) O(\Delta) O ( Δ ) relevant edges per pair. This requires a total of O ( n 2 Δ ) O(n^2\Delta) O ( n 2 Δ ) queries and time.
For Term 2., we iterate over pairs ( a , b ) (a,b) ( a , b ) where both ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ > α |X(a,b)|,|Y(a,b)| > \alpha ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ > α . We compute max y : ( x , y ) ∈ P d G ∖ e ( x , y ) \max_{y:(x,y)\in P} d_{G\setminus e}(x,y) max y : ( x , y ) ∈ P d G ∖ e ( x , y ) in O ~ ( h Δ ⋅ T m a x - m i n ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ , Δ ) ) \widetilde{O}\left(\frac{h}{\Delta}\cdot T_{\mathrm{max\text{-}min}}(|X(a,b)|,|Y(a,b)|,\Delta)\right) O ( Δ h ⋅ T max - min ( ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ , Δ ) ) time. Since ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ , Δ ≥ α |X(a,b)|,|Y(a,b)|,\Delta\ge\alpha ∣ X ( a , b ) ∣ , ∣ Y ( a , b ) ∣ , Δ ≥ α , we can bound this by partitioning the matrices into α × α \alpha\times\alpha α × α blocks:
O ( n Δ ⋅ ∣ X ( a , b ) ∣ ∣ Y ( a , b ) ∣ Δ α 3 ⋅ T m a x - m i n ( α , α , α ) ) ≤ O ( ∣ X ( a , b ) ∣ ∣ Y ( a , b ) ∣ n ⋅ α ( ω − 3 ) / 2 ) . O\left(\frac{n}{\Delta}\cdot\frac{|X(a,b)||Y(a,b)|\Delta}{\alpha^3}\cdot T_{\mathrm{max\text{-}min}}(\alpha,\alpha,\alpha)\right)\le O\left(|X(a,b)||Y(a,b)|n\cdot\alpha^{(\omega-3)/2}\right). O ( Δ n ⋅ α 3 ∣ X ( a , b ) ∣∣ Y ( a , b ) ∣Δ ⋅ T max - min ( α , α , α ) ) ≤ O ( ∣ X ( a , b ) ∣∣ Y ( a , b ) ∣ n ⋅ α ( ω − 3 ) /2 ) .
By bounding ∣ X ( a , b ) ∣ ≤ n |X(a,b)|\le n ∣ X ( a , b ) ∣ ≤ n and again using the sum over ∣ Y ( a , b ) ∣ |Y(a,b)| ∣ Y ( a , b ) ∣ , the total time for this step is O ~ ( n 4 / Δ ⋅ α ( ω − 3 ) / 2 ) \widetilde{O}(n^4/\Delta\cdot\alpha^{(\omega-3)/2}) O ( n 4 /Δ ⋅ α ( ω − 3 ) /2 ) .
Combining these, the total runtime is:
O ~ ( n 3 α / Δ + n 4 / Δ ⋅ α ( ω − 3 ) / 2 + n 2 Δ ) . \widetilde{O}\left(n^3\alpha/\Delta+n^4/\Delta\cdot\alpha^{(\omega-3)/2}+n^2\Delta\right). O ( n 3 α /Δ + n 4 /Δ ⋅ α ( ω − 3 ) /2 + n 2 Δ ) .
By setting α = n 2 / ( 5 − ω ) \alpha=n^{2/(5-\omega)} α = n 2/ ( 5 − ω ) and Δ = n ( 7 − ω ) / 2 ( 5 − ω ) \Delta=n^{(7-\omega)/2(5-\omega)} Δ = n ( 7 − ω ) /2 ( 5 − ω ) , we balance these terms (ensuring α ≤ Δ \alpha\le\Delta α ≤ Δ ). For ω ≈ 2.37 \omega\approx2.37 ω ≈ 2.37 , this simplifies to approximately O ( n 2.88 ) O(n^{2.88}) O ( n 2.88 ) .
Approximate Decremental Eccentricities
In this section, we adapt the decremental single-source shortest distance oracle by Harada, Kitamura, Izumi and Masuzawa [HKIM24] to obtain the following results.
Lemma 5.5 (Adapted from [HKIM24]). For any ε > 0 \varepsilon>0 ε > 0 , there is an algorithm for decremental ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate eccentricities of a single node in a (directed or undirected) graph with weights in [ 1 … M ] [1\ldots M] [ 1 … M ] with O ~ ε ( m polylog M ) \widetilde{O}_{\varepsilon}(m\operatorname{polylog} M) O ε ( m polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
The algorithm of [HKIM24] is designed for node failures in directed graphs, achieving O ~ ( m log M / ε + n log 2 M / ε 2 ) \widetilde{O}(m\log M/\varepsilon+n\log^2 M/\varepsilon^2) O ( m log M / ε + n log 2 M / ε 2 ) preprocessing and O ~ ε ( 1 ) \widetilde{O}_{\varepsilon}(1) O ε ( 1 ) query time. Our adapted algorithm is also designed for vertex failures in directed graphs. We observe that we can reduce edge failures to node failures. To this end, it suffices to replace each edge of weight w w w by a two-edge path whose two edges both have weight w w w . Distances between original vertices then double, including after deletion of the subdivision vertex; divide oracle answers by two and maximize only over original target vertices. This transformation yields a total running time of O ~ ( m log 2 M / ε 2 ) ≤ O ~ ε ( m polylog M ) \widetilde{O}(m\log^2 M/\varepsilon^2)\le\widetilde{O}_{\varepsilon}(m\operatorname{polylog} M) O ( m log 2 M / ε 2 ) ≤ O ε ( m polylog M ) . Furthermore, the node-failures in directed graphs can also handle edge failures in undirected graphs. After subdividing each edge, we replace each new edge { x , y } \{x,y\} { x , y } with two directed edges ( x , y ) , ( y , x ) (x,y),(y,x) ( x , y ) , ( y , x ) of the same weights. By doing so, the shortest path distances remain the same, and the failure of the auxiliary central node accounts for the deletion of the original undirected edge in both directions.
Brief Summary of [HKIM24]. We begin by summarizing the oracle introduced in [HKIM24]. Throughout this section, let G G G represent a weighted graph with edge weights in [ 1 … M ] [1\ldots M] [ 1 … M ] , and let s ∈ G s\in G s ∈ G denote a designated source vertex. The oracle proposed in [HKIM24] supports queries of the form d G ∖ x ( s , t ) d_{G\setminus x}(s,t) d G ∖ x ( s , t ) for any x , t ∈ G x,t\in G x , t ∈ G .
Let T T T be the shortest path tree of s s s in G G G . Observe that for any x ∈ G x\in G x ∈ G we are interested in the values d G ∖ x ( s , t ) d_{G\setminus x}(s,t) d G ∖ x ( s , t ) for all t t t in the subtree of x x x w.r.t. T T T . For all other t t t , we have d G ∖ x ( s , t ) = d G ( s , t ) d_{G\setminus x}(s,t)=d_G(s,t) d G ∖ x ( s , t ) = d G ( s , t ) .
The oracle of [HKIM24] is based on a recursive centroid decomposition of T T T . More precisely, this decomposition of T T T , which we denote with D \mathcal{D} D , can be thought as a binary tree, whose vertices are connected subtrees of T T T . The root of D \mathcal{D} D is T T T itself. Each non-leaf node H ⊆ T H\subseteq T H ⊆ T of D \mathcal{D} D is split into two subtrees H 1 , H 2 H_1,H_2 H 1 , H 2 of T T T (which are the left and right children of H H H in D \mathcal{D} D , respectively) as follows: a node z H z_H z H , also called centroid, is found such that:
(i) The subtree H 1 H_1 H 1 of H H H includes all nodes that are not strict descendants of z H z_H z H in H H H (so z H z_H z H is included); (ii) the subtree H₂ of H includes all nodes and edges in the subtree of z H z_H z H in H (so z H z_H z H is again included). Refer to Figure 1 for a visualization of the split. The choice of z H z_H z H can be made such that the number of nodes in H₁, H₂ is a 2/3-fraction of the one in H. (Thus, the depth of D \mathcal{D} D is O ( log n ) O(\log n) O ( log n ) .) Finally, the leaves H of D \mathcal{D} D contain only O ( 1 ) O(1) O ( 1 ) nodes.
Figure 1. This figure shows how H is split into H₁ and H₂.
Further, each subtree H ∈ D \in\mathcal{D} ∈ D is modified to a graph H ^ \widehat{H} H by adding new edges and changing weights of the current ones. For the root T of D \mathcal{D} D , we have T ^ = G \widehat{T}=G T = G . Letting r H r_H r H be the root of H, the most important property that H ^ \widehat{H} H satisfies is that, for any i ∈ { 1 , 2 } i \in\{1,2\} i ∈ { 1 , 2 } and t ∈ H i t \in H_i t ∈ H i , we have d H ^ ( r H , t ) = d H ^ i ( r H i , t ) d_{\widehat{H}}(r_H,t)=d_{\widehat{H}_i}(r_{H_i},t) d H ( r H , t ) = d H i ( r H i , t ) . By applying this property repeatedly, until we get to the root T of D \mathcal{D} D , we obtain d H ^ ( r H , t ) = d G ( s , t ) d_{\widehat{H}}(r_H,t)=d_G(s,t) d H ( r H , t ) = d G ( s , t ) . This means that the shortest path tree from r H r_H r H in H ^ \widehat{H} H contains the same nodes in the same ancestor/descendant relationship as H, and distances remain invariant to the original source vertex s s s .
While normal distances from the root r H r_H r H in H ^ \widehat{H} H are always preserved, distances under one vertex failure from the root, follow the following properties.
Lemma 5.1 (Lemma 6 of [HKIM24]). Let H ∈ D \in\mathcal{D} ∈ D . For any x , t ∈ H 2 ∖ { z H } x,t \in H_2 \setminus\{z_H\} x , t ∈ H 2 ∖ { z H } , we have
d H ^ ∖ x ( r H , t ) = d H ^ 2 ∖ x ( r H 2 , t ) . d_{\widehat{H}\setminus x}(r_H,t)=d_{\widehat{H}_2\setminus x}(r_{H_2},t). d H ∖ x ( r H , t ) = d H 2 ∖ x ( r H 2 , t ) .
Lemma 5.2 (Lemma 7 of [HKIM24]). Let H ∈ D \in\mathcal{D} ∈ D . For any x , t ∈ H 1 x,t \in H_1 x , t ∈ H 1 , we have all of the following:
if x ∉ π G ( r H , z H ) x \notin\pi_G(r_H,z_H) x ∈ / π G ( r H , z H ) , then d H ^ ∖ x ( r H , t ) = d H ^ 1 ∖ x ( r H 1 , t ) d_{\widehat{H}\setminus x}(r_H,t)=d_{\widehat{H}_1\setminus x}(r_{H_1},t) d H ∖ x ( r H , t ) = d H 1 ∖ x ( r H 1 , t ) ;
if x ∈ π G ( r H , z H ) x \in\pi_G(r_H,z_H) x ∈ π G ( r H , z H ) , then at least one of the two following holds:
d H ^ ∖ π G ( x , z H ) ( r H , t ) = d H ^ ∖ x ( r H , t ) d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t)=d_{\widehat{H}\setminus x}(r_H,t) d H ∖ π G ( x , z H ) ( r H , t ) = d H ∖ x ( r H , t ) and d H ^ ∖ x ( r H , t ) ≤ d H ^ 1 ∖ x ( r H 1 , t ) d_{\widehat{H}\setminus x}(r_H,t)\leq d_{\widehat{H}_1\setminus x}(r_{H_1},t) d H ∖ x ( r H , t ) ≤ d H 1 ∖ x ( r H 1 , t ) ;
d H ^ 1 ∖ x ( r H 1 , t ) d_{\widehat{H}_1\setminus x}(r_{H_1},t) d H 1 ∖ x ( r H 1 , t ) is a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation of d H ^ ∖ x ( r H , t ) d_{\widehat{H}\setminus x}(r_H,t) d H ∖ x ( r H , t ) .
Lemma 5.3. Let H ∈ D \in\mathcal{D} ∈ D . For any x ∈ π G ( r H , z H ) x \in\pi_G(r_H,z_H) x ∈ π G ( r H , z H ) and t ∈ H 2 ∖ { z H } t \in H_2 \setminus\{z_H\} t ∈ H 2 ∖ { z H } , we have
d H ^ ∖ x ( r H , t ) = min { d H ^ ∖ x ( r H , z H ) + d H ^ ( z H , t ) , d H ^ ∖ π G ( x , z H ) ( r H , t ) } . d_{\widehat{H}\setminus x}(r_H,t)=\min\left\{d_{\widehat{H}\setminus x}(r_H,z_H)+d_{\widehat{H}}(z_H,t),d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t)\right\}. d H ∖ x ( r H , t ) = min { d H ∖ x ( r H , z H ) + d H ( z H , t ) , d H ∖ π G ( x , z H ) ( r H , t ) } .
Proof. While this property is implicit in the general discussion of [HKIM24], it is not explicitly stated as a standalone lemma or theorem. For the sake of completeness (and because it is short), we provide an argument below.
Note that if the path π H ^ ∖ x ( r H , t ) \pi_{\widehat{H}\setminus x}(r_H,t) π H ∖ x ( r H , t ) goes through any node in v ∈ π G ( x , z H ) ∖ { x } v \in\pi_G(x,z_H) \setminus\{x\} v ∈ π G ( x , z H ) ∖ { x } , then from v v v to t t t the path coincides with a shortest path from v v v to t t t in H ^ \widehat{H} H (or also T or G). In particular, it passes through z H z_H z H .
Thus, either π H ^ ∖ x ( r H , t ) \pi_{\widehat{H}\setminus x}(r_H,t) π H ∖ x ( r H , t ) goes through z H z_H z H and d H ^ ∖ x ( r H , t ) = d H ^ ∖ x ( r H , z H ) + d H ^ ( z H , t ) d_{\widehat{H}\setminus x}(r_H,t)=d_{\widehat{H}\setminus x}(r_H,z_H)+d_{\widehat{H}}(z_H,t) d H ∖ x ( r H , t ) = d H ∖ x ( r H , z H ) + d H ( z H , t ) , or π H ^ ∖ x ( r H , t ) \pi_{\widehat{H}\setminus x}(r_H,t) π H ∖ x ( r H , t ) avoids all nodes in π G ( x , z H ) \pi_G(x,z_H) π G ( x , z H ) and we conclude d H ^ ∖ x ( r H , t ) = d H ^ ∖ π G ( x , z H ) ( r H , t ) d_{\widehat{H}\setminus x}(r_H,t)=d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t) d H ∖ x ( r H , t ) = d H ∖ π G ( x , z H ) ( r H , t ) .
Lemma 5.1, Lemma 5.2, and Lemma 5.3 tell us that we can compute (recursively) an approximation d ~ H ^ ∖ x ( r H , t ) \widetilde{d}_{\widehat{H}\setminus x}(r_H,t) d H ∖ x ( r H , t ) of d H ^ ∖ x ( r H , t ) d_{\widehat{H}\setminus x}(r_H,t) d H ∖ x ( r H , t ) using the following recursive formula:
d ~ H ^ ∖ x ( r H , t ) = { d ~ H ^ 2 ∖ x ( r H 2 , t ) if x , t ∈ H 2 ∖ { z H } , d ~ H ^ 1 ∖ x ( r H 1 , t ) if x ∉ π G ( r H , z H ) , t ∈ H 1 , min { d H ^ ∖ π G ( x , z H ) ( r H , t ) , d ~ H ^ 1 ∖ x ( r H 1 , t ) } if x ∈ π G ( r H , z H ) , t ∈ H 1 , min { d H ^ ∖ x ( r H , z H ) + d H ^ ( z H , t ) , d H ^ ∖ π G ( x , z H ) ( r H , t ) } if x ∈ π G ( r H , z H ) , t ∈ H 2 ∖ { z H } . (8) \widetilde{d}_{\widehat{H}\setminus x}(r_H,t)=
\begin{cases}
\widetilde{d}_{\widehat{H}_2\setminus x}(r_{H_2},t) & \text{if }x,t\in H_2\setminus\{z_H\},\\
\widetilde{d}_{\widehat{H}_1\setminus x}(r_{H_1},t) & \text{if }x\notin\pi_G(r_H,z_H),\ t\in H_1,\\
\min\left\{d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t),\widetilde{d}_{\widehat{H}_1\setminus x}(r_{H_1},t)\right\} & \text{if }x\in\pi_G(r_H,z_H),\ t\in H_1,\\
\min\left\{d_{\widehat{H}\setminus x}(r_H,z_H)+d_{\widehat{H}}(z_H,t),d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t)\right\} & \text{if }x\in\pi_G(r_H,z_H),\ t\in H_2\setminus\{z_H\}.
\end{cases} \tag*{(8)} d H ∖ x ( r H , t ) = ⎩ ⎨ ⎧ d H 2 ∖ x ( r H 2 , t ) d H 1 ∖ x ( r H 1 , t ) min { d H ∖ π G ( x , z H ) ( r H , t ) , d H 1 ∖ x ( r H 1 , t ) } min { d H ∖ x ( r H , z H ) + d H ( z H , t ) , d H ∖ π G ( x , z H ) ( r H , t ) } if x , t ∈ H 2 ∖ { z H } , if x ∈ / π G ( r H , z H ) , t ∈ H 1 , if x ∈ π G ( r H , z H ) , t ∈ H 1 , if x ∈ π G ( r H , z H ) , t ∈ H 2 ∖ { z H } . (8)
Note, in each level of recursion this formula accumulates at most a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) error in approximation (specifically coming from Lemma 5.2 in the third case of Equation (8) ). Since the depth of D \mathcal{D} D is bounded by O ( log n ) O(\log n) O ( log n ) , we end up with an ( 1 + ε ) O ( log n ) (1+\varepsilon)^{O(\log n)} ( 1 + ε ) O ( l o g n ) -approximation. Thus, by evaluating the formula at the root of D \mathcal{D} D we can get an ( 1 + ε ′ ) (1+\varepsilon') ( 1 + ε ′ ) -approximation d ~ G ∖ x ( s , t ) \widetilde{d}_{G\setminus x}(s,t) d G ∖ x ( s , t ) of d G ∖ x ( s , t ) d_{G\setminus x}(s,t) d G ∖ x ( s , t ) for ε ′ = Θ ( ε log n ) \varepsilon'=\Theta(\varepsilon\log n) ε ′ = Θ ( ε log n ) .
We remark that to evaluate Equation (8) in the third and fourth case, the algorithm of [HKIM24] additionally uses ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximations of d H ^ ∖ π G ( x , z H ) ( r H , t ) d_{\widehat{H}\setminus\pi_G(x,z_H)}(r_H,t) d H ∖ π G ( x , z H ) ( r H , t ) and d H ^ ∖ x ( r H , z H ) d_{\widehat{H}\setminus x}(r_H,z_H) d H ∖ x ( r H , z H ) instead of their real values. Obviously, this still gives an ( 1 + ε ′ ) (1+\varepsilon') ( 1 + ε ′ ) -approximation.
Our adaptation of [HKIM24]. For our purposes, we need to view Equation (8) in a non-recursive way. Given x , t ∈ G x,t\in G x , t ∈ G such that x ∈ π G ( s , t ) x\in\pi_G(s,t) x ∈ π G ( s , t ) , let H ( 1 ) , … , H ( ℓ ) ∈ D H^{(1)},\ldots,H^{(\ell)}\in\mathcal{D} H ( 1 ) , … , H ( ℓ ) ∈ D be the root-to-node path in D \mathcal{D} D such that x , t ∈ H ( i ) x,t\in H^{(i)} x , t ∈ H ( i ) and H ( ℓ ) H^{(\ell)} H ( ℓ ) has no children in D \mathcal{D} D which both contain x , t x,t x , t . (That is, until H ( ℓ ) H^{(\ell)} H ( ℓ ) the nodes x , t x,t x , t are in the same partition of T \mathbf{T} T in D \mathcal{D} D .) Note that we necessarily have x ∈ π G ( r H ( ℓ ) , z H ( ℓ ) ) x\in\pi_G(r_{H^{(\ell)}},z_{H^{(\ell)}}) x ∈ π G ( r H ( ℓ ) , z H ( ℓ ) ) .
By collecting in the index set I ( x , t ) I(x,t) I ( x , t ) all indices i ∈ [ 1 … ℓ ] i\in[1\ldots\ell] i ∈ [ 1 … ℓ ] such that x ∈ π G ( r H ( i ) , z H ( i ) ) x\in\pi_G(r_{H^{(i)}},z_{H^{(i)}}) x ∈ π G ( r H ( i ) , z H ( i ) ) , we can write out Equation (8) as:
d ~ G ∖ x ( s , t ) = min { min i ∈ I ( x , t ) { d H ^ ( i ) ∖ π G ( x , z H ( i ) ) ( r H ( i ) , t ) } , d H ^ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) + d H ^ ( ℓ ) ( z H ( ℓ ) , t ) } . (9) \widetilde{d}_{G\setminus x}(s,t)=
\min\left\{
\min_{i\in I(x,t)}
\left\{
d_{\widehat{H}^{(i)}\setminus\pi_G(x,z_{H^{(i)}})}(r_{H^{(i)}},t)
\right\},
d_{\widehat{H}^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}})+d_{\widehat{H}^{(\ell)}}(z_{H^{(\ell)}},t)
\right\}. \tag*{(9)} d G ∖ x ( s , t ) = min { i ∈ I ( x , t ) min { d H ( i ) ∖ π G ( x , z H ( i ) ) ( r H ( i ) , t ) } , d H ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) + d H ( ℓ ) ( z H ( ℓ ) , t ) } . (9)
We want to further modify Equation (9) . In particular, as in [HKIM24], we also want to use ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximations of d H ^ ( i ) ∖ π G ( x , z H ( i ) ) ( r H ( i ) , t ) d_{\widehat{H}^{(i)}\setminus\pi_G(x,z_{H^{(i)}})}(r_{H^{(i)}},t) d H ( i ) ∖ π G ( x , z H ( i ) ) ( r H ( i ) , t ) and d H ^ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) d_{\widehat{H}^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}}) d H ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) and we want to use some more structure that lies in these terms.
To better describe this, fix H ∈ D H\in\mathcal{D} H ∈ D and abbreviate r = r H r=r_H r = r H and z = z H z=z_H z = z H . For each t ∈ H t\in H t ∈ H and x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) , the ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation d ‾ H ^ ∖ π G ( x , z ) ( r , t ) \overline{d}_{\widehat{H}\setminus\pi_G(x,z)}(r,t) d H ∖ π G ( x , z ) ( r , t ) of d H ^ ∖ π G ( x , z ) ( r , t ) d_{\widehat{H}\setminus\pi_G(x,z)}(r,t) d H ∖ π G ( x , z ) ( r , t ) in [HKIM24] is obtained by combining other Q = O ( log n ) Q=O(\log n) Q = O ( log n ) values. We let the i i i -th value be q H i ( x , t ) q_H^i(x,t) q H i ( x , t ) for i ∈ [ 1 … Q ] i\in[1\ldots Q] i ∈ [ 1 … Q ] .13
The values q H i ( x , t ) q_H^i(x,t) q H i ( x , t ) have the following properties14 :
1 Fix i ∈ [ 1 … Q ] i\in[1\ldots Q] i ∈ [ 1 … Q ] and t ∈ H t\in H t ∈ H . Then, the values q H i ( x , t ) q_H^i(x,t) q H i ( x , t ) are monotonically decreasing in x x x , as x x x goes from r r r to z z z in the same order as the vertices on π G ( r , z ) \pi_G(r,z) π G ( r , z ) .
2 Fix again i ∈ [ 1 … Q ] i\in[1\ldots Q] i ∈ [ 1 … Q ] and t ∈ H t\in H t ∈ H . Then, there are at most O ( log ( n M ) / ε ) O(\log(nM)/\varepsilon) O ( log ( n M ) / ε ) change points, because relevant distances range up to n M nM n M ; thus q H i ( ⋅ , t ) q_H^i(\cdot,t) q H i ( ⋅ , t ) can be stored using O ( log ( n M ) / ε ) O(\log(nM)/\varepsilon) O ( log ( n M ) / ε ) values, such that the previous value q H i ( x ′ , t ) q_H^i(x',t) q H i ( x ′ , t ) differs from q H i ( x , t ) q_H^i(x,t) q H i ( x , t ) (x ′ x' x ′ is the node on π G ( r , z ) \pi_G(r,z) π G ( r , z ) preceding x x x ). In particular, the values q H i ( x , t ) q_H^i(x,t) q H i ( x , t ) can be stored in a compressed way, using only O ( log M / ε ) O(\log M/\varepsilon) O ( log M / ε ) space.
3 For any x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) and t ∈ H t\in H t ∈ H , an ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation d ‾ H ^ ∖ π G ( x , z ) ( r , t ) \overline{d}_{\widehat{H}\setminus\pi_G(x,z)}(r,t) d H ∖ π G ( x , z ) ( r , t ) to d H ^ ∖ π G ( x , z ) ( r , t ) d_{\widehat{H}\setminus\pi_G(x,z)}(r,t) d H ∖ π G ( x , z ) ( r , t ) is
d ‾ H ^ ∖ π G ( x , z ) ( r , t ) = min i ∈ [ 1 … Q ] q H i ( x , t ) . \overline{d}_{\widehat{H}\setminus\pi_G(x,z)}(r,t)=\min_{i\in[1\ldots Q]}q_H^i(x,t). d H ∖ π G ( x , z ) ( r , t ) = i ∈ [ 1 … Q ] min q H i ( x , t ) .
We derive that we get an ( 1 + ε ′ ) (1+\varepsilon') ( 1 + ε ′ ) -approximation d ˉ G ∖ x ( s , t ) \bar d_{G\setminus x}(s,t) d ˉ G ∖ x ( s , t ) of d G ∖ x ( s , t ) d_{G\setminus x}(s,t) d G ∖ x ( s , t ) by changing Equation (9) to
d ˉ G ∖ x ( s , t ) : = min { min i ∈ I ( x , t ) j ∈ [ 1 … Q ] { q H ( i ) j ( x , t ) } , d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) + d H ( ℓ ) ( z H ( ℓ ) , t ) } = min { min i ∈ I ( x , t ) j ∈ [ 1 … Q ] { q H ( i ) j ( x , t ) − d H ( ℓ ) ( z H ( ℓ ) , t ) } + d H ( ℓ ) ( z H ( ℓ ) , t ) ⏟ (a) , d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) ⏟ (b) + d H ( ℓ ) ( z H ( ℓ ) , t ) } . (10) \begin{aligned}
\bar d_{G\setminus x}(s,t) &:= \min\left\{\min_{\substack{i\in I(x,t)\\j\in[1\ldots Q]}}\left\{q^{j}_{H^{(i)}}(x,t)\right\},\bar d_{\bar H^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}})+d_{H^{(\ell)}}(z_{H^{(\ell)}},t)\right\}\\
&=\min\left\{\min_{\substack{i\in I(x,t)\\j\in[1\ldots Q]}}\left\{q^{j}_{H^{(i)}}(x,t)-d_{H^{(\ell)}}(z_{H^{(\ell)}},t)\right\}+\underbrace{d_{H^{(\ell)}}(z_{H^{(\ell)}},t)}_{\text{(a)}},\underbrace{\bar d_{\bar H^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}})}_{\text{(b)}}+d_{H^{(\ell)}}(z_{H^{(\ell)}},t)\right\}. \tag*{(10)}
\end{aligned} d ˉ G ∖ x ( s , t ) := min ⎩ ⎨ ⎧ i ∈ I ( x , t ) j ∈ [ 1 … Q ] min { q H ( i ) j ( x , t ) } , d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) + d H ( ℓ ) ( z H ( ℓ ) , t ) ⎭ ⎬ ⎫ = min ⎩ ⎨ ⎧ i ∈ I ( x , t ) j ∈ [ 1 … Q ] min { q H ( i ) j ( x , t ) − d H ( ℓ ) ( z H ( ℓ ) , t ) } + (a) d H ( ℓ ) ( z H ( ℓ ) , t ) , (b) d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) + d H ( ℓ ) ( z H ( ℓ ) , t ) ⎭ ⎬ ⎫ . (10)
where d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) \bar d_{\bar H^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}}) d ˉ H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) is an ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximation to d H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) d_{\bar H^{(\ell)}\setminus x}(r_{H^{(\ell)}},z_{H^{(\ell)}}) d H ˉ ( ℓ ) ∖ x ( r H ( ℓ ) , z H ( ℓ ) ) . Equation (10) is convenient for us because:
(a) For each i ∈ I ( x , t ) i\in I(x,t) i ∈ I ( x , t ) and j ∈ [ 1 … Q ] j\in[1\ldots Q] j ∈ [ 1 … Q ] , the first term is monotonically decreasing in x x x and does not change more than O ( log n / ε ) O(\log n/\varepsilon) O ( log n / ε ) times, as x x x follows the order on π G ( r H ( i ) , z H ( i ) ) \pi_G(r_{H^{(i)}},z_{H^{(i)}}) π G ( r H ( i ) , z H ( i ) ) .
(b) The second term does not depend on t t t .
These properties come in handy for the following lemma.
Lemma 5.4. Let H ∈ D H\in\mathcal D H ∈ D , and abbreviate r = r H r=r_H r = r H and z = z H z=z_H z = z H . Moreover, let H ( 1 ) , … , H ( ℓ ) = H ∈ D H^{(1)},\ldots,H^{(\ell)}=H\in\mathcal D H ( 1 ) , … , H ( ℓ ) = H ∈ D be the root-to-H H H path in D \mathcal D D . Suppose that we have access to the values:
d ^ H ˉ ( z , t ) \hat d_{\bar H}(z,t) d ^ H ˉ ( z , t ) for all t ∈ H 2 ∖ { z } t\in H_2\setminus\{z\} t ∈ H 2 ∖ { z } ;
d ˉ H ˉ ∖ x ( r , z ) \bar d_{\bar H\setminus x}(r,z) d ˉ H ˉ ∖ x ( r , z ) for all x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) ; and
q H ( i ) j ( x , t ) q^j_{H^{(i)}}(x,t) q H ( i ) j ( x , t ) (in compressed form) for all x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) , t ∈ H ∖ { z } t\in H\setminus\{z\} t ∈ H ∖ { z } , i ∈ I ( x , t ) i\in I(x,t) i ∈ I ( x , t ) , j ∈ [ 1 … Q ] j\in[1\ldots Q] j ∈ [ 1 … Q ] .
Then, in time O ~ ε ( n H log M ) \tilde O_{\varepsilon}(n_H\log M) O ~ ε ( n H log M ) , where n H n_H n H are the nodes in H H H , we can compute for each x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) the value
α H ( x ) : = max t ∈ H 2 ∖ { z } d ˉ G ∖ x ( s , t ) . \alpha_H(x):=\max_{t\in H_2\setminus\{z\}}\bar d_{G\setminus x}(s,t). α H ( x ) := t ∈ H 2 ∖ { z } max d ˉ G ∖ x ( s , t ) .
Proof. For any x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) , we maintain all t ∈ H 2 t\in H_2 t ∈ H 2 in an ordered set W x W_x W x that supports split and merge operations, sorted by the key
k x ( t ) : = min i ∈ I ( x , t ) , j ∈ [ 1 … Q ] q H ( i ) j ( x , t ) − d ^ H ˉ ( z H , t ) . k_x(t):=\min_{\substack{i\in I(x,t),\,j\in[1\ldots Q]}}q^j_{H^{(i)}}(x,t)-\hat d_{\bar H}(z_H,t). k x ( t ) := i ∈ I ( x , t ) , j ∈ [ 1 … Q ] min q H ( i ) j ( x , t ) − d ^ H ˉ ( z H , t ) .
By Equation (10) , to get α H ( x ) \alpha_H(x) α H ( x ) we can divide W x W_x W x into W x > W_x^{>} W x > and W x ≤ W_x^{\leq} W x ≤ according to whether k x ( t ) k_x(t) k x ( t ) is strictly greater than or less than/equal to d ˉ H ˉ ∖ x ( r H , z H ) \bar d_{\bar H\setminus x}(r_H,z_H) d ˉ H ˉ ∖ x ( r H , z H ) , respectively. Assuming that we maintain subtree maxima, we can query
w x > : = max t ∈ W x > d ^ H ˉ ( z H , t ) and w x ≤ : = max t ∈ W x ≤ k x ( t ) + d ^ H ˉ ( z H , t ) . w_x^{>}:=\max_{t\in W_x^{>}}\hat d_{\bar H}(z_H,t)
\qquad\text{and}\qquad
w_x^{\leq}:=\max_{t\in W_x^{\leq}}k_x(t)+\hat d_{\bar H}(z_H,t). w x > := t ∈ W x > max d ^ H ˉ ( z H , t ) and w x ≤ := t ∈ W x ≤ max k x ( t ) + d ^ H ˉ ( z H , t ) .
We can get α H ( x ) \alpha_H(x) α H ( x ) by computing max { w x > + d ˉ H ˉ ∖ x ( r H , z H ) , w x ≤ } \max\{w_x^{>}+\bar d_{\bar H\setminus x}(r_H,z_H),w_x^{\leq}\} max { w x > + d ˉ H ˉ ∖ x ( r H , z H ) , w x ≤ } .
To compute all α H ( x ) \alpha_H(x) α H ( x ) we initialize W x W_x W x for x = r x=r x = r and then update W x W_x W x as x x x follows the path π G ( r , z ) \pi_G(r,z) π G ( r , z ) , each time computing α H ( x ) \alpha_H(x) α H ( x ) . It remains to explain how to update W x W_x W x to get W x ′ W_{x'} W x ′ where x ′ x' x ′ is the node that immediately succeeds x x x in π G ( r , z ) \pi_G(r,z) π G ( r , z ) . To this end, for each t ∈ H 2 t\in H_2 t ∈ H 2 , we store q H ( i ) j ( x , t ) q^j_{H^{(i)}}(x,t) q H ( i ) j ( x , t ) for all i ∈ I ( x , t ) i\in I(x,t) i ∈ I ( x , t ) and j ∈ [ 1 … Q ] j\in[1\ldots Q] j ∈ [ 1 … Q ] . When going from x x x and x ′ x' x ′ we check whether I ( x , t ) ≠ I ( x ′ , t ) I(x,t)\ne I(x',t) I ( x , t ) = I ( x ′ , t ) or if there are any i ∈ I ( x , t ) ∩ I ( x ′ , t ) i\in I(x,t)\cap I(x',t) i ∈ I ( x , t ) ∩ I ( x ′ , t ) and j ∈ [ 1 … Q ] j\in[1\ldots Q] j ∈ [ 1 … Q ] such that q H ( i ) j ( x , t ) ≠ q H ( i ) j ( x ′ , t ) q^j_{H^{(i)}}(x,t)\ne q^j_{H^{(i)}}(x',t) q H ( i ) j ( x , t ) = q H ( i ) j ( x ′ , t ) . If the check passes, we recompute k x ′ ( t ) k_{x'}(t) k x ′ ( t ) from scratch and update W x ′ W_{x'} W x ′ accordingly.
We finally observe that for all i ∈ [ 1 … ℓ ] i\in[1\ldots\ell] i ∈ [ 1 … ℓ ] if π G ( r H ( i ) , z H ( i ) ) ∩ π G ( r , z ) ≠ ∅ \pi_G(r_{H^{(i)}},z_{H^{(i)}})\cap\pi_G(r,z)\ne\varnothing π G ( r H ( i ) , z H ( i ) ) ∩ π G ( r , z ) = ∅ , then π G ( r H ( i ) , z H ( i ) ) \pi_G(r_{H^{(i)}},z_{H^{(i)}}) π G ( r H ( i ) , z H ( i ) ) and π G ( r , z ) \pi_G(r,z) π G ( r , z ) must share a prefix. This means that for any t ∈ H 2 ∖ { z } t\in H_2\setminus\{z\} t ∈ H 2 ∖ { z } , if x x x precedes x ′ x' x ′ on π G ( r , z ) \pi_G(r,z) π G ( r , z ) , then I ( x ′ , t ) ⊆ I ( x , t ) I(x',t)\subseteq I(x,t) I ( x ′ , t ) ⊆ I ( x , t ) ; hence indices can only disappear as x x x moves toward z z z .
Runtime: For any round x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) and for each t t t we maintain O ~ ( 1 ) \tilde O(1) O ~ ( 1 ) values of the type q H ( i ) j ( x , t ) q^j_{H^{(i)}}(x,t) q H ( i ) j ( x , t ) . By the properties of the latter values, we know that over all x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) we have at most O ~ ( 1 ) \tilde O(1) O ~ ( 1 ) changes in I ( x , t ) I(x,t) I ( x , t ) and O ~ ( log M / ε ) \tilde O(\log M/\varepsilon) O ~ ( log M / ε ) changes in the values q H ( i ) j ( x , t ) q^j_{H^{(i)}}(x,t) q H ( i ) j ( x , t ) . Furthermore, for each of the at most n H n_H n H nodes x ∈ π G ( r , z ) x\in\pi_G(r,z) x ∈ π G ( r , z ) we spend O ~ ( 1 ) \tilde O(1) O ~ ( 1 ) to get α H ( x ) \alpha_H(x) α H ( x ) . This gives the desired running time of O ~ ε ( n H log M ) \tilde O_{\varepsilon}(n_H\log M) O ~ ε ( n H log M ) .
This finally allows us to get to Lemma 5.5.
Lemma 5.5 (Adapted from [HKIM24]). For any ε > 0 \varepsilon> 0 ε > 0 , there is an algorithm for decremental ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) -approximate eccentricities of a single node in a (directed or undirected) graph with weights in [ 1 … M ] [1 \ldots M] [ 1 … M ] with O ~ ( m p o l y l o g M ) \tilde{O}(m\mathop{\mathrm{polylog}} M) O ~ ( m polylog M ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Proof. As already explained above, it suffices if we focus on vertex failures in directed graphs.
We use the same algorithm as [HKIM24]. That is, given H ∈ D \mathbf{H} \in\mathcal{D} H ∈ D , we find z H z_{\mathbf{H}} z H , compute q H j ( x , t ) q^{j}_{\mathbf{H}}(x,t) q H j ( x , t ) for all x ∈ π G ( r H , z H ) x \in\pi_{\mathbf{G}}(r_{\mathbf{H}},z_{\mathbf{H}}) x ∈ π G ( r H , z H ) , t ∈ H 2 ∖ { z H } t \in H_{2} \setminus\{z_{\mathbf{H}}\} t ∈ H 2 ∖ { z H } , j ∈ [ 1 … Q ] j \in[1 \ldots Q] j ∈ [ 1 … Q ] and d ˉ H ∖ x ( r H , z H ) \bar{d}_{\mathbf{H}\setminus x}(r_{\mathbf{H}},z_{\mathbf{H}}) d ˉ H ∖ x ( r H , z H ) for all x ∈ π G ( r H , z H ) x \in\pi_{\mathbf{G}}(r_{\mathbf{H}},z_{\mathbf{H}}) x ∈ π G ( r H , z H ) , construct H ^ 1 \widehat{H}_{1} H 1 and H ^ 2 \widehat{H}_{2} H 2 , and recurse on H 1 H_{1} H 1 and H 2 H_{2} H 2 .
The only modification is that before constructing H ^ 1 \widehat{H}_{1} H 1 and H ^ 2 \widehat{H}_{2} H 2 , we use Lemma 5.4 to compute for each x ∈ π G ( r , z ) x \in\pi_{\mathbf{G}}(r,z) x ∈ π G ( r , z ) the value α H ( x ) \alpha_{\mathbf{H}}(x) α H ( x ) . (Note that d ˉ H ( z H , t ) = d G ( z H , t ) \bar{d}_{\mathbf{H}}(z_{\mathbf{H}},t)=d_{\mathbf{G}}(z_{\mathbf{H}},t) d ˉ H ( z H , t ) = d G ( z H , t ) for all t ∈ H 2 ∖ { z } t \in H_{2} \setminus\{z\} t ∈ H 2 ∖ { z } so indeed all values are available, assuming we have run Dijkstra’s algorithm with source s s s in the beginning.) For x ∈ G x \in G x ∈ G , let T ( x ) T(x) T ( x ) represent the nodes (x x x excluded) in the subtree of x x x w.r.t. T T T . After finishing the construction, for every x ∈ G x \in G x ∈ G , we compute max t ∈ T ( x ) d ˉ G ∖ x ( s , t ) = max H ∈ D : x ∈ π G ( r H , z H ) α H ( x ) \max_{t \in T(x)} \bar{d}_{G \setminus x}(s,t)=\max_{\mathbf{H}\in\mathcal{D}:x\in\pi_{\mathbf{G}}(r_{\mathbf{H}},z_{\mathbf{H}})}\alpha_{\mathbf{H}}(x) max t ∈ T ( x ) d ˉ G ∖ x ( s , t ) = max H ∈ D : x ∈ π G ( r H , z H ) α H ( x ) , which is a maximum of at most O ~ ( 1 ) \tilde{O}(1) O ~ ( 1 ) values.
On a query for x ∈ G x \in G x ∈ G , we return max { max t ∈ T ( x ) d ˉ G ∖ x ( s , t ) , ecc G ( s ) } \max\{\max_{t \in T(x)}\bar{d}_{G \setminus x}(s,t),\operatorname{ecc}_{G}(s)\} max { max t ∈ T ( x ) d ˉ G ∖ x ( s , t ) , ecc G ( s )} as an approximation of ecc G ∖ x ( s ) \operatorname{ecc}_{G \setminus x}(s) ecc G ∖ x ( s ) . This indeed yields an ( 1 + ε ′ ) (1+\varepsilon') ( 1 + ε ′ ) -approximation of the eccentricity, as ecc G ∖ x ( s ) = max { max t ∈ T ( x ) d G ∖ x ( s , t ) , ecc G ( s ) } \operatorname{ecc}_{G \setminus x}(s)=\max\{\max_{t \in T(x)}d_{G \setminus x}(s,t),\operatorname{ecc}_{G}(s)\} ecc G ∖ x ( s ) = max { max t ∈ T ( x ) d G ∖ x ( s , t ) , ecc G ( s )} and d ˉ G ∖ x ( s , t ) \bar{d}_{G \setminus x}(s,t) d ˉ G ∖ x ( s , t ) is a ( 1 + ε ′ ) (1+\varepsilon') ( 1 + ε ′ ) -approximation of d G ∖ x ( s , t ) d_{G \setminus x}(s,t) d G ∖ x ( s , t ) .
Runtime: Regarding the computational complexity, we observe that outside and within the recursive construction, Lemma 5.4 does not asymptotically dominate the execution time of the existing routines in [HKIM24]. Consequently, the total runtime stays the same.
Approximate Decremental Diameter
Next, we are interested in approximating decremental diameter. In the static setting, one can compute diameter in time O ~ ( m n ) \tilde{O}(mn) O ~ ( mn ) by running Dijkstra’s algorithm from every node and returning the largest eccentricity obtained. In dense graphs with small edge weights there are faster algorithms that take advantage of matrix multiplication, but in graphs where m = O ~ ( n ) m=\tilde{O}(n) m = O ~ ( n ) improving over the O ~ ( m 2 ) \tilde{O}(m^{2}) O ~ ( m 2 ) runtime would refute the Strong Exponential Time Hypothesis (SETH) [RV13].
This motivated much of the work in designing faster approximation algorithms for diameter in sparse graphs. The most important of these algorithms, i.e., [RV13], [CLR+14] and [CGR16], have a similar structure: they sample k k k nodes for some 0 ≤ k ≤ m 0 \leq k \leq m 0 ≤ k ≤ m , run Dijkstra’s algorithm from each of them, and then return the maximum eccentricity obtained, taking time O ~ ( m k ) \tilde{O}(mk) O ~ ( mk ) . The technically challenging part of such an algorithm is devising a sampling procedure that guarantees that at least one node will have a large eccentricity. More specifically, they all compute a sample defined as follows.
Definition 6.1. Let G = ( V , E ) G=(V,E) G = ( V , E ) be an undirected graph, and let α > 1 \alpha> 1 α > 1 , β ≥ 0 \beta\geq0 β ≥ 0 , and k ≥ 1 k \geq1 k ≥ 1 . An ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample from V V V is a set of nodes S ⊆ V S \subseteq V S ⊆ V so that ∣ S ∣ ≤ k |S| \leq k ∣ S ∣ ≤ k and, for any γ ≥ 0 \gamma\geq0 γ ≥ 0 , either
(i) for every v ∈ V v \in V v ∈ V , we have d G ( v , S ) ≤ ( 1 − 1 / α ) γ + β / α d_{G}(v,S) \leq(1-1/\alpha)\gamma+\beta/\alpha d G ( v , S ) ≤ ( 1 − 1/ α ) γ + β / α , or
(ii) there exists s ∈ S s \in S s ∈ S with ecc G ( s ) ≥ γ / α − β / α \operatorname{ecc}_{G}(s) \geq\gamma/\alpha-\beta/\alpha ecc G ( s ) ≥ γ / α − β / α .
Here is how such a sample can be used to obtain a ( α , β ) (\alpha,\beta) ( α , β ) -approximation for diameter. Let γ = diam ( G ) \gamma=\operatorname{diam}(G) γ = diam ( G ) , and let a ∈ V a \in V a ∈ V so that ecc G ( a ) = diam ( G ) \operatorname{ecc}_{G}(a)=\operatorname{diam}(G) ecc G ( a ) = diam ( G ) . Then:
(i) If there is an s a ∈ S s_a \in S s a ∈ S so that d G ( a , s a ) ≤ ( 1 − 1 / α ) diam ( G ) + β / α d_{G}(a,s_a) \leq(1-1/\alpha)\operatorname{diam}(G)+\beta/\alpha d G ( a , s a ) ≤ ( 1 − 1/ α ) diam ( G ) + β / α , we combine this with ecc G ( a ) ≤ ecc G ( s a ) + d G ( a , s a ) \operatorname{ecc}_{G}(a) \leq\operatorname{ecc}_{G}(s_a)+d_{G}(a,s_a) ecc G ( a ) ≤ ecc G ( s a ) + d G ( a , s a ) to conclude ecc G ( s a ) ≥ diam ( G ) − ( 1 − 1 / α ) diam ( G ) − β / α = diam ( G ) / α − β / α \operatorname{ecc}_{G}(s_a) \geq\operatorname{diam}(G)-(1-1/\alpha)\operatorname{diam}(G)-\beta/\alpha=\operatorname{diam}(G)/\alpha-\beta/\alpha ecc G ( s a ) ≥ diam ( G ) − ( 1 − 1/ α ) diam ( G ) − β / α = diam ( G ) / α − β / α .
(ii) Otherwise, by Definition 6.1, there is s ∈ S s \in S s ∈ S with ecc G ( s ) ≥ diam ( G ) / α − β / α \operatorname{ecc}_{G}(s) \geq\operatorname{diam}(G)/\alpha-\beta/\alpha ecc G ( s ) ≥ diam ( G ) / α − β / α as well.
Therefore, returning the maximum eccentricity in S S S (scaled first multiplicatively by α \alpha α then additively by β \beta β ) yields the desired approximation algorithm. The algorithms of [RV13], [CLR+14] and [CGR16] work by finding ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -samples for particular values of α \alpha α , β \beta β , and k k k . Our core observation is that these algorithms all compute samples that satisfy the above requirements for any γ \gamma γ , not just for γ = diam ( G ) \gamma=\operatorname{diam}(G) γ = diam ( G ) .
The central theorem we prove in this (sub)section is that we can essentially replicate any algorithm using ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -samples in the decremental setting as long as we have a good decremental algorithm for the eccentricity of a single node.
We restate and prove Main Theorem 2:
Main Theorem 2. Let G = ( V , E ) G=(V,E) G = ( V , E ) be an undirected graph with non-negative edge weights. Further, suppose there is an algorithm to find an ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample from V V V in time T T T and an algorithm for single-node ( α ′ , β ′ ) (\alpha',\beta') ( α ′ , β ′ ) -approximate decremental eccentricity in G G G with P P P preprocessing and Q Q Q query time. Then, there is a ( α α ′ , α β ′ + β ) (\alpha\alpha',\alpha\beta' + \beta) ( α α ′ , α β ′ + β ) -approximate algorithm for decremental diameter in G G G with O ( T + P + k m Q ) O(T+P+kmQ) O ( T + P + k m Q ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time.
Proof. In the preprocessing stage, our algorithm does the following:
(i) Compute an ( α , β , k ) (\alpha,\beta,k) ( α , β , k ) -sample S ⊆ V S\subseteq V S ⊆ V .
(ii) For each s ∈ S s\in S s ∈ S , run the single-node decremental eccentricity algorithm, and for each e ∈ E e\in E e ∈ E compute the ( α ′ , β ′ ) (\alpha',\beta') ( α ′ , β ′ ) -approximation ecc ~ G ∖ e ( s ) \widetilde{\operatorname{ecc}}_{G\setminus e}(s) ecc G ∖ e ( s ) of ecc G ∖ e ( s ) \operatorname{ecc}_{G\setminus e}(s) ecc G ∖ e ( s ) .
(iii) For each e ∈ E e\in E e ∈ E compute diam ~ ( G ∖ e ) : = α ⋅ max s ∈ S ecc ~ G ∖ e ( s ) + β \widetilde{\operatorname{diam}}(G\setminus e):=\alpha\cdot\max_{s\in S}\widetilde{\operatorname{ecc}}_{G\setminus e}(s)+\beta diam ( G ∖ e ) := α ⋅ max s ∈ S ecc G ∖ e ( s ) + β as approximation of diam ( G ∖ e ) \operatorname{diam}(G\setminus e) diam ( G ∖ e ) .
On a query for e ∈ E e\in E e ∈ E , we return diam ~ ( G ∖ e ) \widetilde{\operatorname{diam}}(G\setminus e) diam ( G ∖ e ) .
Correctness: Let e = { x , y } ∈ E e=\{x,y\}\in E e = { x , y } ∈ E be arbitrary. It suffices to show that α ⋅ max s ∈ S ecc G ∖ e ( s ) + β \alpha\cdot\max_{s\in S}\operatorname{ecc}_{G\setminus e}(s)+\beta α ⋅ max s ∈ S ecc G ∖ e ( s ) + β is a ( α , β ) (\alpha,\beta) ( α , β ) -approximation of diam ( G ∖ e ) \operatorname{diam}(G\setminus e) diam ( G ∖ e ) . To this end, let a , b ∈ V a,b\in V a , b ∈ V so that d G ∖ e ( a , b ) = diam ( G ∖ e ) d_{G\setminus e}(a,b)=\operatorname{diam}(G\setminus e) d G ∖ e ( a , b ) = diam ( G ∖ e ) . We distinguish two cases.
Case 1: e ∉ π G ( a , b ) e\notin\pi_G(a,b) e ∈ / π G ( a , b ) . Then, diam ( G ) = diam ( G ∖ e ) \operatorname{diam}(G)=\operatorname{diam}(G\setminus e) diam ( G ) = diam ( G ∖ e ) . Before we argued that α ⋅ max s ∈ S ecc G ( s ) + β \alpha\cdot\max_{s\in S}\operatorname{ecc}_G(s)+\beta α ⋅ max s ∈ S ecc G ( s ) + β is a ( α , β ) (\alpha,\beta) ( α , β ) -approximation of diam ( G ) \operatorname{diam}(G) diam ( G ) . We conclude
diam ( G ∖ e ) = diam ( G ) ≤ α ⋅ max s ∈ S ecc G ( s ) + β ≤ α ⋅ max s ∈ S ecc G ∖ e ( s ) + β ≤ α ⋅ diam ( G ∖ e ) + β . \operatorname{diam}(G\setminus e)=\operatorname{diam}(G)\leq\alpha\cdot\max_{s\in S}\operatorname{ecc}_G(s)+\beta\leq\alpha\cdot\max_{s\in S}\operatorname{ecc}_{G\setminus e}(s)+\beta\leq\alpha\cdot\operatorname{diam}(G\setminus e)+\beta. diam ( G ∖ e ) = diam ( G ) ≤ α ⋅ s ∈ S max ecc G ( s ) + β ≤ α ⋅ s ∈ S max ecc G ∖ e ( s ) + β ≤ α ⋅ diam ( G ∖ e ) + β .
Case 2: e ∈ π G ( a , b ) e\in\pi_G(a,b) e ∈ π G ( a , b ) . Without loss of generality, we assume that x x x appears before y y y in π G ( a , b ) \pi_G(a,b) π G ( a , b ) , which means d G ( a , x ) ≤ d G ( a , y ) d_G(a,x)\leq d_G(a,y) d G ( a , x ) ≤ d G ( a , y ) because of the non-negativity of the weights. Further, without loss of generality, we assume d G ( a , x ) ≥ d G ( y , b ) d_G(a,x)\geq d_G(y,b) d G ( a , x ) ≥ d G ( y , b ) . We further perform a case distinction depending on s a : = arg min s ∈ S d G ( a , s ) s_a:=\arg\min_{s\in S}d_G(a,s) s a := arg min s ∈ S d G ( a , s ) .
Case 2(a): e ∉ π G ( a , s a ) e\notin\pi_G(a,s_a) e ∈ / π G ( a , s a ) . Then, we use the property of S S S setting γ = diam ( G ∖ e ) \gamma=\operatorname{diam}(G\setminus e) γ = diam ( G ∖ e ) . Consequently, either d G ( a , s a ) ≤ ( 1 − 1 / α ) diam ( G ∖ e ) + β / α d_G(a,s_a)\leq(1-1/\alpha)\operatorname{diam}(G\setminus e)+\beta/\alpha d G ( a , s a ) ≤ ( 1 − 1/ α ) diam ( G ∖ e ) + β / α , which implies
ecc G ∖ e ( s a ) ≥ ecc G ∖ e ( a ) − d G ∖ e ( a , s a ) ≥ ecc G ∖ e ( a ) − d G ( a , s a ) ≥ 1 / α ⋅ diam ( G ∖ e ) − β / α , \operatorname{ecc}_{G\setminus e}(s_a)\geq\operatorname{ecc}_{G\setminus e}(a)-d_{G\setminus e}(a,s_a)\geq\operatorname{ecc}_{G\setminus e}(a)-d_G(a,s_a)\geq1/\alpha\cdot\operatorname{diam}(G\setminus e)-\beta/\alpha, ecc G ∖ e ( s a ) ≥ ecc G ∖ e ( a ) − d G ∖ e ( a , s a ) ≥ ecc G ∖ e ( a ) − d G ( a , s a ) ≥ 1/ α ⋅ diam ( G ∖ e ) − β / α ,
or we get directly that there is s ∈ S s\in S s ∈ S with ecc G ∖ e ( s ) ≥ ecc G ( s ) ≥ 1 / α ⋅ diam ( G ∖ e ) − β / α \operatorname{ecc}_{G\setminus e}(s)\geq\operatorname{ecc}_G(s)\geq1/\alpha\cdot\operatorname{diam}(G\setminus e)-\beta/\alpha ecc G ∖ e ( s ) ≥ ecc G ( s ) ≥ 1/ α ⋅ diam ( G ∖ e ) − β / α . In any case, α ⋅ max s ∈ S ecc G ∖ e ( s ) + β \alpha\cdot\max_{s\in S}\operatorname{ecc}_{G\setminus e}(s)+\beta α ⋅ max s ∈ S ecc G ∖ e ( s ) + β is a ( α , β ) (\alpha,\beta) ( α , β ) -approximation of diam ( G ∖ e ) \operatorname{diam}(G\setminus e) diam ( G ∖ e ) .
Case 2(b): e ∈ π G ( a , s a ) e\in\pi_G(a,s_a) e ∈ π G ( a , s a ) . Then, we can assume that e ∉ π G ( b , s a ) e\notin\pi_G(b,s_a) e ∈ / π G ( b , s a ) . To see why, take a shortest b b b -s a s_a s a path that uses e = { x , y } e=\{x,y\} e = { x , y } . If it traverses x x x to y y y , replace its prefix ending at y y y by the b b b -y y y suffix of π G ( a , b ) \pi_G(a,b) π G ( a , b ) ; the triangle inequality shows this does not increase length. If it traverses y y y to x x x , replace its suffix starting at y y y by the y y y -s a s_a s a suffix of π G ( a , s a ) \pi_G(a,s_a) π G ( a , s a ) . Both replacements avoid e e e , so a shortest b b b -s a s_a s a path avoiding e e e exists.
Next, we again use the property of S S S setting γ = diam ( G ∖ e ) \gamma=\operatorname{diam}(G\setminus e) γ = diam ( G ∖ e ) . Thus, we either have that d G ( a , s a ) ≤ ( 1 − 1 / α ) diam ( G ∖ e ) + β / α d_G(a,s_a)\leq(1-1/\alpha)\operatorname{diam}(G\setminus e)+\beta/\alpha d G ( a , s a ) ≤ ( 1 − 1/ α ) diam ( G ∖ e ) + β / α or there is s ∈ S s\in S s ∈ S with ecc G ∖ e ( s ) ≥ ecc G ( s ) ≥ diam ( G ∖ e ) / α − β / α \operatorname{ecc}_{G\setminus e}(s)\geq\operatorname{ecc}_G(s)\geq\operatorname{diam}(G\setminus e)/\alpha-\beta/\alpha ecc G ∖ e ( s ) ≥ ecc G ( s ) ≥ diam ( G ∖ e ) / α − β / α . It suffices to show that for the former case, we have ecc G ∖ e ( s a ) ≥ diam ( G ∖ e ) / α − β / α \operatorname{ecc}_{G\setminus e}(s_a)\geq\operatorname{diam}(G\setminus e)/\alpha-\beta/\alpha ecc G ∖ e ( s a ) ≥ diam ( G ∖ e ) / α − β / α . Because then, as before, we get that α ⋅ max s ∈ S ecc G ∖ e ( s ) + β \alpha\cdot\max_{s\in S}\operatorname{ecc}_{G\setminus e}(s)+\beta α ⋅ max s ∈ S ecc G ∖ e ( s ) + β is a ( α , β ) (\alpha,\beta) ( α , β ) -approximation of diam ( G ∖ e ) \operatorname{diam}(G\setminus e) diam ( G ∖ e ) .
To this end, we observe that
d G ∖ e ( b , s a ) = d G ( b , s a ) ≤ d G ( y , s a ) + d G ( b , y ) = ( d G ( a , s a ) − d G ( a , x ) − w ( x , y ) + d G ( b , y ) ≤ d G ( a , s a ) − d G ( a , x ) + d G ( b , y ) ≤ d G ( a , s a ) . \begin{aligned}
d_{G\setminus e}(b,s_a)&=d_G(b,s_a)\leq d_G(y,s_a)+d_G(b,y)=(d_G(a,s_a)-d_G(a,x)-w(x,y)+d_G(b,y)\\
&\leq d_G(a,s_a)-d_G(a,x)+d_G(b,y)\\
&\leq d_G(a,s_a).
\end{aligned} d G ∖ e ( b , s a ) = d G ( b , s a ) ≤ d G ( y , s a ) + d G ( b , y ) = ( d G ( a , s a ) − d G ( a , x ) − w ( x , y ) + d G ( b , y ) ≤ d G ( a , s a ) − d G ( a , x ) + d G ( b , y ) ≤ d G ( a , s a ) .
We conclude
ecc G ∖ e ( s a ) ≥ ecc G ∖ e ( b ) − d G ∖ e ( b , s a ) ≥ ecc G ∖ e ( b ) − d G ( a , s a ) ≥ diam ( G ∖ e ) − ( 1 − 1 / α ) diam ( G ∖ e ) − β / α ≥ diam ( G ∖ e ) / α − β / α , \begin{aligned}
\operatorname{ecc}_{G\setminus e}(s_a) \ge\operatorname{ecc}_{G\setminus e}(b)-d_{G\setminus e}(b,s_a) \ge\operatorname{ecc}_{G\setminus e}(b)-d_G(a,s_a) \\
&\ge\operatorname{diam}(G\setminus e)-(1-1/\alpha)\operatorname{diam}(G\setminus e)-\beta/\alpha\\
&\ge\operatorname{diam}(G\setminus e)/\alpha-\beta/\alpha,
\end{aligned} ecc G ∖ e ( s a ) ≥ ecc G ∖ e ( b ) − d G ∖ e ( b , s a ) ≥ ecc G ∖ e ( b ) − d G ( a , s a ) ≥ diam ( G ∖ e ) − ( 1 − 1/ α ) diam ( G ∖ e ) − β / α ≥ diam ( G ∖ e ) / α − β / α ,
as desired.
Approximate Incremental Eccentricity
In this section we show a general technique to convert an α \alpha α -approximation algorithm for (directed or undirected) all-node eccentricities into an α \alpha α -approximation for a single node eccentricity under 1-edge insertion. We first show how to apply this idea to a simple 2-approximation algorithm for directed and undirected eccentricity (Main Theorem 3), and then apply it to a slightly more involved 5/3-approximation for undirected eccentricity (Main Theorem 4). The new incremental algorithm runs in the same preprocessing time as the original all-node eccentricity algorithm and has constant query time. We further show that this approach allows us to compute the approximate eccentricity of n γ n^\gamma n γ vertices, under 1-edge insertion, faster than simply running the single-node eccentricity approximation n γ n^\gamma n γ times, using fast matrix multiplication, at the cost of a + ε +\varepsilon + ε to the approximation factor.
We would like to be able to compute ecc G + ( p ) \operatorname{ecc}_{G^+}(p) ecc G + ( p ) in the graph G + G^+ G + obtained by the addition of an edge ( x , y ) (x,y) ( x , y ) , G + : = ( V , E ∪ { ( x , y ) } ) G^+ := (V,E\cup\{(x,y)\}) G + := ( V , E ∪ {( x , y )}) . Note that if the graph is directed, or in the undirected case if p p p is closer to x x x than it is to y y y , we have d G + ( p , v ) = min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v ) ) d_{G^+}(p,v)=\min(d_G(p,v),d_G(p,x)+w(x,y)+d_G(y,v)) d G + ( p , v ) = min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v )) . So in fact, the quantity we wish to compute is
ecc G + ( p ) = max v ( min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v ) ) ) . \operatorname{ecc}_{G^+}(p)=\max_{v}\left(\min(d_G(p,v),d_G(p,x)+w(x,y)+d_G(y,v))\right). ecc G + ( p ) = v max ( min ( d G ( p , v ) , d G ( p , x ) + w ( x , y ) + d G ( y , v )) ) .
This motivates the following definition.
Definition 7.1. Given a value k k k , subset U ⊆ V U\subseteq V U ⊆ V and vertices p , y ∈ V p,y\in V p , y ∈ V , let
δ k U ( p , y ) : = max u ∈ U { min ( d G ( p , u ) , d G ( y , u ) + k ) } . \delta_k^U(p,y):=\max_{u\in U}\{\min(d_G(p,u),d_G(y,u)+k)\}. δ k U ( p , y ) := u ∈ U max { min ( d G ( p , u ) , d G ( y , u ) + k )} .
Note that if we set k : = d G ( p , x ) + w ( x , y ) k:=d_G(p,x)+w(x,y) k := d G ( p , x ) + w ( x , y ) , we have that ecc G + ( p ) = δ k V ( p , y ) \operatorname{ecc}_{G^+}(p)=\delta_k^V(p,y) ecc G + ( p ) = δ k V ( p , y ) . We proceed to give an algorithm that after some preprocessing allows us to have query access to such values.
Lemma 7.2. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted (directed or undirected) graph with edge weights bounded by M M M , let p ∈ V p\in V p ∈ V and P ⊂ V P\subset V P ⊂ V . Given two sets U , Z U,Z U , Z , there exists an algorithm that either:
(i) Runs in O ~ ( ∣ U ∣ ⋅ ∣ Z ∣ + m ⋅ min ( ∣ U ∣ , ∣ Z ∣ ) ) \widetilde{\mathcal{O}}(|U|\cdot|Z|+m\cdot\min(|U|,|Z|)) O ( ∣ U ∣ ⋅ ∣ Z ∣ + m ⋅ min ( ∣ U ∣ , ∣ Z ∣ )) preprocessing time and computes δ k U ( p , z ) \delta_k^U(p,z) δ k U ( p , z ) for any z ∈ Z z\in Z z ∈ Z and any k k k in O ~ ( 1 ) \widetilde{\mathcal{O}}(1) O ( 1 ) query time.
(ii) Given k k k at preprocessing time, runs in O ~ ( T max - min ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ ) ) \widetilde{\mathcal{O}}(T_{\max\text{-}\min}(|P|,|U|,|Z|)+m\cdot\min(|U|,|P|+|Z|)) O ( T m a x - m i n ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ )) preprocessing time and computes δ k U ( p , z ) \delta_k^U(p,z) δ k U ( p , z ) for any z ∈ Z z\in Z z ∈ Z , p ∈ P p\in P p ∈ P in O ( 1 ) \mathcal{O}(1) O ( 1 ) query time.
(iii) Runs in O ~ ( T max - min ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ ) ) \widetilde{\mathcal{O}}(T_{\max\text{-}\min}(|P|,|U|,|Z|)+m\cdot\min(|U|,|P|+|Z|)) O ( T m a x - m i n ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ )) preprocessing time and computes a ( 1 + ε ) (1+\varepsilon) ( 1 + ε ) approximation to δ k U ( p , z ) \delta_k^U(p,z) δ k U ( p , z ) for any z ∈ Z z\in Z z ∈ Z , p ∈ P p\in P p ∈ P , k ∈ [ M n ] k\in[Mn] k ∈ [ M n ] in O ( 1 ) \mathcal{O}(1) O ( 1 ) query time.
Proof. Note that we can obtain Algorithm (iii) as a direct corollary of Algorithm (ii). Use Algorithm (ii) to preprocess δ k U \delta_k^U δ k U for O ~ ( 1 ) \widetilde{\mathcal{O}}(1) O ( 1 ) values of k k k , namely for k ∈ { 0 } ∪ { ( 1 + ε ) i } i = 0 ⌈ log 1 + ε ( M n ) ⌉ k\in\{0\}\cup\{(1+\varepsilon)^i\}_{i=0}^{\lceil\log_{1+\varepsilon}(Mn)\rceil} k ∈ { 0 } ∪ {( 1 + ε ) i } i = 0 ⌈ l o g 1 + ε ( M n )⌉ . Upon query of p , z , k p,z,k p , z , k , round k k k down to the largest stored value k ^ ≤ k \hat{k}\le k k ^ ≤ k , handling k = 0 k=0 k = 0 exactly. For k ≥ 1 k\ge1 k ≥ 1 , we have k ^ ≤ k < ( 1 + ε ) k ^ \hat{k}\le k<(1+\varepsilon)\hat{k} k ^ ≤ k < ( 1 + ε ) k ^ , and nonnegativity of distances gives δ k U ( p , z ) / ( 1 + ε ) ≤ δ k ^ U ( p , z ) ≤ δ k U ( p , z ) \delta_k^U(p,z)/(1+\varepsilon)\le\delta_{\hat{k}}^U(p,z)\le\delta_k^U(p,z) δ k U ( p , z ) / ( 1 + ε ) ≤ δ k ^ U ( p , z ) ≤ δ k U ( p , z ) . We are left to prove Algorithm (i) and Algorithm (ii).
We first show Algorithm (i). We run the following algorithms at preprocessing and query time, described in Algorithm 1 and Algorithm 2 respectively.
Preprocessing: Begin by running Dijkstra’s algorithm in G G G from all the points in Z Z Z or to all the points in U U U , obtaining all the distances from Z Z Z to U U U . This takes O ~ ( m ⋅ min ( ∣ U ∣ , ∣ Z ∣ ) ) \widetilde{O}(m \cdot\min(|U|,|Z|)) O ( m ⋅ min ( ∣ U ∣ , ∣ Z ∣ )) time.
Next, for every u ∈ U u \in U u ∈ U and z ∈ Z z \in Z z ∈ Z define Δ z ( u ) : = d G ( p , u ) − d G ( z , u ) \Delta_z(u) := d_G(p,u)-d_G(z,u) Δ z ( u ) := d G ( p , u ) − d G ( z , u ) . Note that min ( d G ( p , u ) , d G ( z , u ) + k ) = d G ( p , u ) \min(d_G(p,u),d_G(z,u)+k)=d_G(p,u) min ( d G ( p , u ) , d G ( z , u ) + k ) = d G ( p , u ) if and only if Δ z ( u ) ≤ k \Delta_z(u) \leq k Δ z ( u ) ≤ k . Therefore,
δ k U ( p , z ) = max u ∈ U { min { d G ( p , u ) , d G ( z , u ) + k } } = max { max u ∈ U : Δ z ( u ) ≤ k { d G ( p , u ) } , max u ∈ U : Δ z ( u ) > k { d G ( z , u ) + k } } . (11) \delta_k^U(p,z) = \max_{u\in U}\left\{\min\{d_G(p,u),d_G(z,u)+k\}\right\}
= \max\left\{\max_{u\in U:\Delta_z(u)\leq k}\{d_G(p,u)\},\max_{u\in U:\Delta_z(u)>k}\{d_G(z,u)+k\}\right\}. \tag*{(11)} δ k U ( p , z ) = u ∈ U max { min { d G ( p , u ) , d G ( z , u ) + k } } = max { u ∈ U : Δ z ( u ) ≤ k max { d G ( p , u )} , u ∈ U : Δ z ( u ) > k max { d G ( z , u ) + k } } . (11)
To be able to compute this value for any k k k , we sort the vertices in U U U in increasing order with respect to Δ z ( u ) \Delta_z(u) Δ z ( u ) . Write q : = ∣ U ∣ q := |U| q := ∣ U ∣ and denote the ordered vertices by u 1 z , … , u q z u^z_1,\ldots,u^z_q u 1 z , … , u q z . For every i ∈ { 0 , … , q } i \in\{0,\ldots,q\} i ∈ { 0 , … , q } , define
a i ( z ) : = max 1 ≤ j ≤ i d G ( p , u j z ) and b i ( z ) : = max i < j ≤ q d G ( z , u j z ) , a_i(z) := \max_{1\leq j\leq i} d_G(p,u^z_j) \quad\text{and}\quad b_i(z) := \max_{i<j\leq q} d_G(z,u^z_j), a i ( z ) := 1 ≤ j ≤ i max d G ( p , u j z ) and b i ( z ) := i < j ≤ q max d G ( z , u j z ) ,
where the maximum of an empty set is − ∞ -\infty − ∞ . We compute all a i ( z ) a_i(z) a i ( z ) in a forward pass and all b i ( z ) b_i(z) b i ( z ) in a backward pass.
Query: Let i ∈ { 0 , … , q } i \in\{0,\ldots,q\} i ∈ { 0 , … , q } be the number of vertices with Δ z ( u j z ) ≤ k \Delta_z(u^z_j) \leq k Δ z ( u j z ) ≤ k , found by binary search. Then a i ( z ) = max u ∈ U : Δ z ( u ) ≤ k d G ( p , u ) a_i(z)=\max_{u\in U:\Delta_z(u)\leq k}d_G(p,u) a i ( z ) = max u ∈ U : Δ z ( u ) ≤ k d G ( p , u ) and b i ( z ) = max u ∈ U : Δ z ( u ) > k d G ( z , u ) b_i(z)=\max_{u\in U:\Delta_z(u)>k}d_G(z,u) b i ( z ) = max u ∈ U : Δ z ( u ) > k d G ( z , u ) . Therefore, we output δ k U ( p , z ) = max { a i ( z ) , b i ( z ) + k } \delta_k^U(p,z)=\max\{a_i(z),b_i(z)+k\} δ k U ( p , z ) = max { a i ( z ) , b i ( z ) + k } .
Table 1 (PDF p. 29).
Table 2 (PDF p. 29).
Runtime: Computing all distances in the preprocessing stage takes O ~ ( m ⋅ min ( ∣ U ∣ , ∣ Z ∣ ) ) \widetilde{O}(m\cdot\min(|U|,|Z|)) O ( m ⋅ min ( ∣ U ∣ , ∣ Z ∣ )) . Next, for every z ∈ Z z\in Z z ∈ Z we calculate ∣ U ∣ |U| ∣ U ∣ different values of Δ z ( u ) \Delta_z(u) Δ z ( u ) and sort U U U accordingly in O ~ ( ∣ U ∣ ) \widetilde{O}(|U|) O ( ∣ U ∣ ) time. In O ( ∣ U ∣ ) O(|U|) O ( ∣ U ∣ ) time we then compute and store a i ( z ) a_i(z) a i ( z ) and b i ( z ) b_i(z) b i ( z ) for every i ∈ { 0 , … , ∣ U ∣ } i\in\{0,\ldots,|U|\} i ∈ { 0 , … , ∣ U ∣ } . This gives us a total preprocessing time of O ~ ( ∣ U ∣ ⋅ ∣ Z ∣ + m ⋅ min ( ∣ U ∣ , ∣ Z ∣ ) ) \widetilde{O}(|U|\cdot|Z|+m\cdot\min(|U|,|Z|)) O ( ∣ U ∣ ⋅ ∣ Z ∣ + m ⋅ min ( ∣ U ∣ , ∣ Z ∣ )) . In the query, we only need to perform a binary search over ∣ U ∣ |U| ∣ U ∣ values of i i i to find the right index and then perform O ( 1 ) O(1) O ( 1 ) computations to return δ k U \delta_k^U δ k U . This yields a query time of O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) .
Correctness: For every z ∈ Z z\in Z z ∈ Z , the binary search returns the number i i i of vertices with Δ z ( u ) ≤ k \Delta_z(u)\leq k Δ z ( u ) ≤ k . Thus a i ( z ) = max u ∈ U : Δ z ( u ) ≤ k d G ( p , u ) a_i(z)=\max_{u\in U:\Delta_z(u)\leq k}d_G(p,u) a i ( z ) = max u ∈ U : Δ z ( u ) ≤ k d G ( p , u ) and b i ( z ) = max u ∈ U : Δ z ( u ) > k d G ( z , u ) b_i(z)=\max_{u\in U:\Delta_z(u)>k}d_G(z,u) b i ( z ) = max u ∈ U : Δ z ( u ) > k d G ( z , u ) , including the cases i = 0 i=0 i = 0 and i = ∣ U ∣ i=|U| i = ∣ U ∣ . By Equation (11) , the output max { a i ( z ) , b i ( z ) + k } \max\{a_i(z),b_i(z)+k\} max { a i ( z ) , b i ( z ) + k } is exactly δ k U ( p , z ) \delta_k^U(p,z) δ k U ( p , z ) .
Algorithm for a Larger Set: We now prove Algorithm (ii). With slight abuse of notation, we will refer to this algorithm also as Preprocess-delta( P , U , Z , k ) (P,U,Z,k) ( P , U , Z , k ) , Query-delta( p , z , U , k ) (p,z,U,k) ( p , z , U , k ) noting the effect of P P P being a set on the runtime and approximation guarantees.
During preprocessing, run Dijkstra’s algorithm to and from either U U U or P ∪ Z P \cup Z P ∪ Z to compute all distances from P ∪ Z P \cup Z P ∪ Z to U U U . Construct a ∣ P ∣ × ∣ U ∣ |P| \times|U| ∣ P ∣ × ∣ U ∣ sized matrix A A A by A [ p , u ] = d G ( p , u ) A[p,u] = d_G(p,u) A [ p , u ] = d G ( p , u ) and a ∣ U ∣ × ∣ Z ∣ |U| \times|Z| ∣ U ∣ × ∣ Z ∣ sized matrix B k B_k B k by B k [ u , z ] = d G ( z , u ) + k B_k[u,z] = d_G(z,u) + k B k [ u , z ] = d G ( z , u ) + k . Compute their max-min product C k : = A ⊛ B k C_k := A \mathbin{\mathbin{\circledast}} B_k C k := A ⊛ B k . Upon query p , z , U , k p,z,U,k p , z , U , k output C k [ p , z ] C_k[p,z] C k [ p , z ] .
Clearly the query algorithm runs in constant time. The preprocessing is dominated by the Dijkstra’s search and computing the max-min product, giving O ~ ( T m a x - m i n ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ ) ) \widetilde{O}(T_{\mathrm{max\text{-}min}}(|P|,|U|,|Z|) + m \cdot\min(|U|,|P|+|Z|)) O ( T max - min ( ∣ P ∣ , ∣ U ∣ , ∣ Z ∣ ) + m ⋅ min ( ∣ U ∣ , ∣ P ∣ + ∣ Z ∣ )) time. Correctness follows by definition of the δ k U ( p , z ) \delta_k^U(p,z) δ k U ( p , z ) and the max-min product.
Lemma 7.2 allows us to use an all-node eccentricity approximation algorithm in a white-box way to instead compute an approximation for δ k V ( p , y ) \delta_k^V(p,y) δ k V ( p , y ) for any y ∈ V y \in V y ∈ V and any value of k k k . To this end, we first recall the (static) 2-approximation algorithm of Choudhary and Gold [CG20].
Theorem 7.3 (Theorem 1.1 in [CG20]). Given a directed graph G = ( V , E ) G = (V,E) G = ( V , E ) , there exists a randomized algorithm running in O ( m log 2 n ) O(m \log^2 n) O ( m log 2 n ) time that computes a 2-approximation to all-node-eccentricities w.h.p.15
Proof sketch. First consider the case where we knew the center of the graph c = arg min v ∈ V ecc ( v ) c = \arg\min_{v \in V} \operatorname{ecc}(v) c = arg min v ∈ V ecc ( v ) , R = ecc ( c ) R = \operatorname{ecc}(c) R = ecc ( c ) . Then we can run an incoming Dijkstra’s search into c c c and for any vertex define ε ′ ( v ) : = d ( v , c ) + R \varepsilon'(v) := d(v,c) + R ε ′ ( v ) := d ( v , c ) + R .
Now, for every v ∈ V v \in V v ∈ V there exists u u u such that ecc ( v ) = d ( v , u ) \operatorname{ecc}(v) = d(v,u) ecc ( v ) = d ( v , u ) and so by the triangle inequality
ecc ( v ) = d ( v , u ) ≤ d ( v , c ) + d ( c , u ) ≤ d ( v , c ) + R = ε ′ ( v ) . \operatorname{ecc}(v) = d(v,u) \le d(v,c) + d(c,u) \le d(v,c) + R = \varepsilon'(v). ecc ( v ) = d ( v , u ) ≤ d ( v , c ) + d ( c , u ) ≤ d ( v , c ) + R = ε ′ ( v ) .
On the other hand, both d ( v , c ) d(v,c) d ( v , c ) and R R R are upper bounded by ecc ( v ) \operatorname{ecc}(v) ecc ( v ) , giving us that ε ′ ( v ) ≤ 2 ecc ( v ) \varepsilon'(v) \le2\operatorname{ecc}(v) ε ′ ( v ) ≤ 2 ecc ( v ) .
In [CG20], the authors show how to construct a set of pseudocenters: a set C ⊂ V C \subset V C ⊂ V of size O ( log 2 n ) O(\log^2 n) O ( log 2 n ) such that every vertex in V V V is within distance R R R of some vertex in C C C , max v ∈ V min c ′ ∈ C d ( c ′ , v ) ≤ R \max_{v \in V} \min_{c' \in C} d(c',v) \le R max v ∈ V min c ′ ∈ C d ( c ′ , v ) ≤ R .
Using this set C C C we can compute R C = max v ∈ V d ( C , v ) R_C = \max_{v \in V} d(C,v) R C = max v ∈ V d ( C , v ) . Now define an estimate ε ′ ( v ) = max c ′ ∈ C d ( v , c ′ ) + R C \varepsilon'(v) = \max_{c' \in C} d(v,c') + R_C ε ′ ( v ) = max c ′ ∈ C d ( v , c ′ ) + R C . With the guarantee that R C ≤ R R_C \le R R C ≤ R , the above argument shows that ε ′ ( v ) \varepsilon'(v) ε ′ ( v ) is in fact a 2-approximation to ecc ( v ) \operatorname{ecc}(v) ecc ( v ) .
We now adapt the above algorithm to get Main Theorem 3. The idea of the proof will be to use the above approach but instead of approximating ecc G ( v ) \operatorname{ecc}_G(v) ecc G ( v ) for every v ∈ V v \in V v ∈ V we will approximate δ k V ( p , v ) \delta_k^V(p,v) δ k V ( p , v ) for every v , k v,k v , k using the tool of Lemma 7.2. Recall that for the appropriate k k k and y y y ecc G + ( p ) = δ k V ( p , y ) \operatorname{ecc}_{G^+}(p) = \delta_k^V(p,y) ecc G + ( p ) = δ k V ( p , y ) .
Main Theorem 3. Let G = ( V , E ) G = (V,E) G = ( V , E ) be a weighted directed or undirected graph with nonnegative integer edge weights bounded by poly ( n ) \operatorname{poly}(n) poly ( n ) . There exists a randomized algorithm running in O ~ ( m ) \widetilde{O}(m) O ( m ) preprocessing time and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time that outputs a 2-approximation of the 1-incremental eccentricity of a single vertex w.h.p.
Proof. We would like to find a set C C C such that R C : = max x ∈ V d G ( C , v ) R_C := \max_{x \in V} d_G(C,v) R C := max x ∈ V d G ( C , v ) satisfies R C ≤ δ k V ( p , y ) R_C \le\delta_k^V(p,y) R C ≤ δ k V ( p , y ) for any y , k y,k y , k . Then we can run an outgoing shortest-path search from every c ∈ C c \in C c ∈ C to compute R C R_C R C , then run \textsc{Preprocess-Delta}(p,C,V) and define for every y y y
δ ~ k V ( p , y ) : = δ k C ( p , y ) + R C . \widetilde{\delta}_k^V(p,y) := \delta_k^C(p,y) + R_C. δ k V ( p , y ) := δ k C ( p , y ) + R C .
Given such a set C C C , the above argument gives us that δ ~ k V ( p , y ) \widetilde{\delta}_k^V(p,y) δ k V ( p , y ) is a 2-approximation to δ k V \delta_k^V δ k V . Indeed, on one hand, both δ k C ( p , y ) \delta_k^C(p,y) δ k C ( p , y ) and R C R_C R C are upper bounded by δ k V ( p , y ) \delta_k^V(p,y) δ k V ( p , y ) so δ ~ k V ( p , y ) ≤ 2 δ k V ( p , y ) \widetilde{\delta}_k^V(p,y) \le2\delta_k^V(p,y) δ k V ( p , y ) ≤ 2 δ k V ( p , y ) .
On the other hand, for any y , k y,k y , k there exists a u ∈ V u \in V u ∈ V such that δ k V ( p , y ) = min ( d G ( p , u ) , d G ( y , u ) + k ) \delta_k^V(p,y) = \min(d_G(p,u), d_G(y,u) + k) δ k V ( p , y ) = min ( d G ( p , u ) , d G ( y , u ) + k ) and there exists a c ∈ C c \in C c ∈ C such that d G ( c , u ) ≤ R C d_G(c,u) \le R_C d G ( c , u ) ≤ R C thus by the triangle inequality,
δ k V ( p , y ) = min ( d G ( p , u ) , d G ( y , u ) + k ) ≤ min ( d G ( p , c ) + d G ( c , u ) , d G ( y , c ) + d G ( c , u ) + k ) ≤ min ( d G ( p , c ) , d G ( y , c ) + k ) + R C ≤ δ k C ( p , y ) + R C = δ ~ k V ( p , y ) . \begin{aligned}
\delta_k^V(p,y) &= \min(d_G(p,u),d_G(y,u) + k) \\
&\le\min(d_G(p,c) + d_G(c,u),d_G(y,c) + d_G(c,u) + k) \\
&\le\min(d_G(p,c),d_G(y,c) + k) + R_C \le\delta_k^C(p,y) + R_C = \widetilde{\delta}_k^V(p,y).
\end{aligned} δ k V ( p , y ) = min ( d G ( p , u ) , d G ( y , u ) + k ) ≤ min ( d G ( p , c ) + d G ( c , u ) , d G ( y , c ) + d G ( c , u ) + k ) ≤ min ( d G ( p , c ) , d G ( y , c ) + k ) + R C ≤ δ k C ( p , y ) + R C = δ k V ( p , y ) .
To find such a set C C C , construct the graph H H H from G G G by adding a zero-weight edge from every vertex into p p p . If G G G is undirected, we construct a directed graph H H H by replacing every edge in G G G with two bidirectional edges between its endpoints and then adding a zero-weight edge from every vertex into p p p . In this graph, for every vertex we have
d H ( u , v ) = min ( d G ( u , v ) , d G ( p , v ) ) . d_H(u,v)=\min(d_G(u,v),d_G(p,v)). d H ( u , v ) = min ( d G ( u , v ) , d G ( p , v )) .
We now apply the algorithm of [CG20] to obtain a set of pseudocenters C ′ C' C ′ for H H H and take C : = C ′ ∪ { p } C := C' \cup\{p\} C := C ′ ∪ { p } . We have R C = max v min ( d G ( C ′ , v ) , d G ( p , v ) ) = max v d H ( C ′ , v ) ≤ radius ( H ) R_C=\max_v\min(d_G(C',v),d_G(p,v))=\max_v d_H(C',v)\leq\operatorname{radius}(H) R C = max v min ( d G ( C ′ , v ) , d G ( p , v )) = max v d H ( C ′ , v ) ≤ radius ( H ) by the guarantees of the algorithm. For any k , y k,y k , y we have that
δ k V ( p , y ) = max u ∈ V min ( d G ( p , u ) , d G ( y , u ) + k ) ≥ max u ∈ V min ( d G ( p , u ) , d G ( y , u ) ) = max u ∈ V d H ( y , u ) = ecc H ( y ) ≥ radius ( H ) ≥ R C . \begin{aligned}
\delta_k^V(p,y)=\max_{u\in V}\min(d_G(p,u),d_G(y,u)+k)\geq\max_{u\in V}\min(d_G(p,u),d_G(y,u)) \\
&=\max_{u\in V}d_H(y,u)=\operatorname{ecc}_H(y)\geq\operatorname{radius}(H)\geq R_C.
\end{aligned} δ k V ( p , y ) = u ∈ V max min ( d G ( p , u ) , d G ( y , u ) + k ) ≥ u ∈ V max min ( d G ( p , u ) , d G ( y , u )) = u ∈ V max d H ( y , u ) = ecc H ( y ) ≥ radius ( H ) ≥ R C .
Thus the set C C C satisfies the desired property, i.e. R C ≤ δ k V ( p , y ) R_C\leq\delta_k^V(p,y) R C ≤ δ k V ( p , y ) for any k , y k,y k , y and so δ ~ k V ( p , y ) \widetilde{\delta}_k^V(p,y) δ k V ( p , y ) is a 2-approximation to δ k V ( p , y ) \delta_k^V(p,y) δ k V ( p , y ) .
Runtime: Constructing the set C C C takes O ~ ( m ) \widetilde{O}(m) O ( m ) time using [CG20] and results in a set of size O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) . Running Preprocess-Delta( p , C , V ) (p,C,V) ( p , C , V ) takes O ( m ) O(m) O ( m ) time at preprocessing and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time using Lemma 7.2.
We now apply this technique to the 5/3-approximation to all-node undirected eccentricities of Chechik et al. [CLR+14] to show that more steps in eccentricity approximation algorithms can be included in this approach. Here we see that if instead of a single point p p p we want to approximate the incremental eccentricity of a set P P P we are able to share much of the preprocessing among all the vertices. We obtain the following result.
Main Theorem 4. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted and undirected graph with nonnegative integer edge weights bounded by M M M . Consider the problem of computing a 5/3-approximation to the incremental eccentricities of a set P P P . Then:
If ∣ P ∣ = 1 |P|=1 ∣ P ∣ = 1 we can obtain a ( 5 / 3 , 2 M / 3 ) (5/3,2M/3) ( 5/3 , 2 M /3 ) -approximation with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time.
If ∣ P ∣ = n γ |P|=n^{\gamma} ∣ P ∣ = n γ and m = Ω ( n ) m=\Omega(n) m = Ω ( n ) , we can obtain ( 5 / 3 + ε , 2 M / 3 + ε ) (5/3+\varepsilon,2M/3+\varepsilon) ( 5/3 + ε , 2 M /3 + ε ) -approximation with O ~ ( m n 1 + γ 2 + m ⋅ n 1 + 1 + γ 4 ) \widetilde{O}\left(mn^{\frac{1+\gamma}{2}}+\sqrt{m}\cdot n^{1+\frac{1+\gamma}{4}}\right) O ( m n 2 1 + γ + m ⋅ n 1 + 4 1 + γ ) preprocessing and O ( n γ ) O(n^{\gamma}) O ( n γ ) query time.
Proof. For simplicity, in the proof of this theorem we assume that the graph is unweighted and ecc G + ( p ) \operatorname{ecc}_{G^+}(p) ecc G + ( p ) is divisible by 5 for every p ∈ P p\in P p ∈ P , in which case we obtain a purely multiplicative error. In a general weighted graph with maximum edge weight M M M our algorithm can incur an additive error of at most + 2 M / 3 +2M/3 + 2 M /3 . We discuss this additional error and ways to avoid it at the end of the proof.
The algorithm: We begin by sampling a set S S S and running Dijkstra’s algorithm from the set S S S and every p ∈ P p\in P p ∈ P . This allows us to find for each p ∈ P p\in P p ∈ P , the point w p w_p w p that maximizes min ( d G ( S , w p ) , 2 5 d G ( p , w p ) ) \min(d_G(S,w_p),\frac{2}{5}d_G(p,w_p)) min ( d G ( S , w p ) , 5 2 d G ( p , w p )) , breaking ties by d G ( S , ⋅ ) d_G(S,\cdot) d G ( S , ⋅ ) . For each p ∈ P p\in P p ∈ P , we run Dijkstra’s algorithm from w p w_p w p to find the closest n log n / ∣ S ∣ n\log n/|S| n log n /∣ S ∣ nodes to w p w_p w p , denote this set by T p T_p T p . Next, we run Dijkstra’s from the set T p T_p T p to find for every vertex its nearest neighbor in the set. Finally, we call Preprocess-Delta( P , S , V ) (P,S,V) ( P , S , V ) and Preprocess-Delta( p , V , T p ) (p,V,T_p) ( p , V , T p ) , Preprocess-Delta( p , w p , V ) (p,w_p,V) ( p , w p , V ) for every p ∈ P p\in P p ∈ P .
After adding an edge ( x , y ) (x,y) ( x , y ) , we can query the approximate eccentricity of a vertex p ∈ P p\in P p ∈ P as follows. We set k p = d G ( p , x ) + w ( x , y ) k_p=d_G(p,x)+w(x,y) k p = d G ( p , x ) + w ( x , y ) and assume without loss of generality that p p p is closer to x x x than to y y y . Given y y y and k k k , find the closest point z p z_p z p to y y y in T p T_p T p . Query Query-Delta( p , y , S ∪ { w p } , k p ) (p,y,S\cup\{w_p\},k_p) ( p , y , S ∪ { w p } , k p ) and Query-Delta( p , z p , V , k p ) (p,z_p,V,k_p) ( p , z p , V , k p ) to obtain an exact value or estimate of δ k p S ∪ { w p } ( p , y ) \delta_{k_p}^{S\cup\{w_p\}}(p,y) δ k p S ∪ { w p } ( p , y ) and δ k p V ( p , z p ) \delta_{k_p}^V(p,z_p) δ k p V ( p , z p ) , respectively. Finally, we can compute the desired approximation,
δ ~ k p V ( p , y ) : = max ( δ k p S ∪ { w p } ( p , y ) , δ k p V ( p , z p ) − d G ( z p , y ) ) . \widetilde{\delta}_{k_p}^V(p,y):=\max\left(\delta_{k_p}^{S\cup\{w_p\}}(p,y),\delta_{k_p}^V(p,z_p)-d_G(z_p,y)\right). δ k p V ( p , y ) := max ( δ k p S ∪ { w p } ( p , y ) , δ k p V ( p , z p ) − d G ( z p , y ) ) .
Correctness: Let p ∈ P p \in P p ∈ P be an arbitrary vertex, and for sake of brevity abbreviate w p , T p , z p w_p,T_p,z_p w p , T p , z p with w , T , z w,T,z w , T , z . Further, let v ∈ V v \in V v ∈ V be a point such that min ( d G ( p , v ) , d G ( y , v ) + k ) = δ k V ( p , y ) = ecc G + ( p ) \min(d_G(p,v),d_G(y,v)+k)=\delta_k^V(p,y)=\operatorname{ecc}_G^+(p) min ( d G ( p , v ) , d G ( y , v ) + k ) = δ k V ( p , y ) = ecc G + ( p ) . If there exists a point s ∈ S s \in S s ∈ S such that d G ( s , v ) ≤ 2 5 δ k V ( p , y ) d_G(s,v)\le\frac{2}{5}\delta_k^V(p,y) d G ( s , v ) ≤ 5 2 δ k V ( p , y ) then by the triangle inequality min ( d G ( p , s ) , d G ( y , s ) + k ) ≥ 3 5 δ k V ( p , y ) \min(d_G(p,s),d_G(y,s)+k)\ge\frac{3}{5}\delta_k^V(p,y) min ( d G ( p , s ) , d G ( y , s ) + k ) ≥ 5 3 δ k V ( p , y ) . Therefore in this case we have, δ k S ( p , y ) ≥ min ( d G ( p , s ) , d G ( y , s ) + k ) ≥ 3 / 5 ⋅ δ k V ( p , y ) \delta_k^S(p,y)\ge\min(d_G(p,s),d_G(y,s)+k)\ge3/5\cdot\delta_k^V(p,y) δ k S ( p , y ) ≥ min ( d G ( p , s ) , d G ( y , s ) + k ) ≥ 3/5 ⋅ δ k V ( p , y ) .
If this is not the case, then d G ( S , v ) > 2 5 δ k V ( p , y ) d_G(S,v)>\frac{2}{5}\delta_k^V(p,y) d G ( S , v ) > 5 2 δ k V ( p , y ) . Since d G ( S , v ) > 2 5 δ k V ( p , y ) d_G(S,v)>\frac{2}{5}\delta_k^V(p,y) d G ( S , v ) > 5 2 δ k V ( p , y ) and d G ( v , p ) ≥ δ k V ( p , y ) d_G(v,p)\ge\delta_k^V(p,y) d G ( v , p ) ≥ δ k V ( p , y ) we know that these inequalities hold for the point w w w as well. If d G ( w , y ) ≥ 3 5 δ k V ( p , y ) d_G(w,y)\ge\frac{3}{5}\delta_k^V(p,y) d G ( w , y ) ≥ 5 3 δ k V ( p , y ) , then δ k { w } ( p , y ) = min ( d G ( p , w ) , d G ( y , w ) + k ) ≥ 3 5 δ k V ( p , y ) \delta_k^{\{w\}}(p,y)=\min(d_G(p,w),d_G(y,w)+k)\ge\frac{3}{5}\delta_k^V(p,y) δ k { w } ( p , y ) = min ( d G ( p , w ) , d G ( y , w ) + k ) ≥ 5 3 δ k V ( p , y ) . Otherwise, we have d G ( w , y ) < 3 5 δ k V ( p , y ) d_G(w,y)<\frac{3}{5}\delta_k^V(p,y) d G ( w , y ) < 5 3 δ k V ( p , y ) and so there exists a point z z z on the shortest path between w w w and y y y such that d G ( w , z ) = 2 5 δ k V ( p , y ) d_G(w,z)=\frac{2}{5}\delta_k^V(p,y) d G ( w , z ) = 5 2 δ k V ( p , y ) and so d G ( z , y ) ≤ 1 5 δ k V ( p , y ) d_G(z,y)\le\frac{1}{5}\delta_k^V(p,y) d G ( z , y ) ≤ 5 1 δ k V ( p , y ) . It is at this point that we assume that 2 5 δ k V ( p , y ) \frac{2}{5}\delta_k^V(p,y) 5 2 δ k V ( p , y ) is an integer and the graph is unweighted so such a point z z z exists. Without these assumptions this step incurs an additive error which we discuss at the end of the proof.
With high probability, the set S S S hits T T T . Therefore, T T T contains a point of distance > 2 5 δ k V ( p , y ) >\frac{2}{5}\delta_k^V(p,y) > 5 2 δ k V ( p , y ) from w w w and so it contains all points of distance ≤ 2 5 δ k V ( p , y ) \le\frac{2}{5}\delta_k^V(p,y) ≤ 5 2 δ k V ( p , y ) from w w w including z z z . We will use the following claim.
Claim 7.4. Any pair of points y , z ∈ V y,z \in V y , z ∈ V satisfy, δ k V ( p , y ) ≥ δ k V ( p , z ) − d G ( z , y ) ≥ δ k V ( p , y ) − 2 d G ( z , y ) \delta_k^V(p,y)\ge\delta_k^V(p,z)-d_G(z,y)\ge\delta_k^V(p,y)-2d_G(z,y) δ k V ( p , y ) ≥ δ k V ( p , z ) − d G ( z , y ) ≥ δ k V ( p , y ) − 2 d G ( z , y ) .
Proof. We will show the left inequality, as it implies the right. Let u u u be the point maximizing min ( d G ( p , u ) , d G ( u , z ) + k ) \min(d_G(p,u),d_G(u,z)+k) min ( d G ( p , u ) , d G ( u , z ) + k ) . By the triangle inequality,
δ k V ( p , z ) − d G ( z , y ) = min ( d G ( u , p ) , d G ( u , z ) + k ) − d G ( z , y ) ≤ min ( d G ( u , p ) , d G ( u , z ) − d G ( z , y ) + k ) ≤ min ( d G ( u , p ) , d G ( u , y ) + k ) ≤ max v min ( d G ( u , p ) , d G ( u , y ) + k ) = δ k V ( p , y ) . \begin{aligned}
\delta_k^V(p,z)-d_G(z,y)=\min(d_G(u,p),d_G(u,z)+k)-d_G(z,y) \\
&\le\min(d_G(u,p),d_G(u,z)-d_G(z,y)+k) \\
&\le\min(d_G(u,p),d_G(u,y)+k) \\
&\le\max_v \min(d_G(u,p),d_G(u,y)+k)=\delta_k^V(p,y).
\end{aligned} δ k V ( p , z ) − d G ( z , y ) = min ( d G ( u , p ) , d G ( u , z ) + k ) − d G ( z , y ) ≤ min ( d G ( u , p ) , d G ( u , z ) − d G ( z , y ) + k ) ≤ min ( d G ( u , p ) , d G ( u , y ) + k ) ≤ v max min ( d G ( u , p ) , d G ( u , y ) + k ) = δ k V ( p , y ) .
By Claim 7.4, if d G ( z , y ) ≤ 1 5 δ k V ( p , y ) d_G(z,y)\le\frac{1}{5}\delta_k^V(p,y) d G ( z , y ) ≤ 5 1 δ k V ( p , y ) then δ k V ( p , z ) − d G ( z , y ) ≥ 3 5 δ k V ( p , y ) \delta_k^V(p,z)-d_G(z,y)\ge\frac{3}{5}\delta_k^V(p,y) δ k V ( p , z ) − d G ( z , y ) ≥ 5 3 δ k V ( p , y ) . Thus, δ k V ( p , y ) ≥ δ ~ k V ( p , y ) ≥ 3 / 5 ⋅ δ k V ( p , y ) \delta_k^V(p,y)\ge\widetilde{\delta}_k^V(p,y)\ge3/5\cdot\delta_k^V(p,y) δ k V ( p , y ) ≥ δ k V ( p , y ) ≥ 3/5 ⋅ δ k V ( p , y ) . For ∣ P ∣ = 1 |P|=1 ∣ P ∣ = 1 , this gives a 5 / 3 5/3 5/3 -approximation. Otherwise, only δ k V ( p , y ) \delta_k^V(p,y) δ k V ( p , y ) is rounded down, while the other two terms remain exact; using accuracy 1 + 3 ε / 5 1+3\varepsilon/5 1 + 3 ε /5 in Lemma 7.2 gives factor 5 / 3 + ε 5/3+\varepsilon 5/3 + ε , preserving the additive term 2 M / 3 2M/3 2 M /3 derived below.
Runtime for Algorithm (i): Set ∣ S ∣ = n |S|=\sqrt{n} ∣ S ∣ = n . In our preprocessing stage we run Dijkstra from at most O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) different vertices. Moreover, when using Lemma 7.2, since ∣ T p ∣ = n |T_p|=\sqrt{n} ∣ T p ∣ = n , we do not use more than time O ~ ( n 1.5 + m ⋅ n ) = O ~ ( m n ) \widetilde{O}(n^{1.5}+m\cdot\sqrt{n})=\widetilde{O}(m\sqrt{n}) O ( n 1.5 + m ⋅ n ) = O ( m n ) . Lastly, in our query algorithm we spend time O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) .
Runtime for Algorithm (ii): Assume m = Ω ( n ) m=\Omega(n) m = Ω ( n ) . In our preprocessing stage we run Dijkstra’s from O ( ∣ P ∣ ) O(|P|) O ( ∣ P ∣ ) nodes and then execute Preprocess-delta( P , S , V ) (P,S,V) ( P , S , V ) and ∣ P ∣ |P| ∣ P ∣ calls to Preprocess-delta( p , V , T p ) (p,V,T_p) ( p , V , T p ) and Preprocess-delta( p , { w p } , V ) (p,\{w_p\},V) ( p , { w p } , V ) . Thus our total runtime is:
O ~ ( m ⋅ n γ + m ⋅ ∣ S ∣ + T max - min ( n γ , ∣ S ∣ , n ) + n γ ⋅ ( m ⋅ n ∣ S ∣ + n 2 ∣ S ∣ ) ) = O ~ ( m ⋅ ( ∣ S ∣ + n 1 + γ ∣ S ∣ ) + T max - min ( n γ , ∣ S ∣ , n ) ) . \begin{aligned}
\widetilde{O}\left(m\cdot n^\gamma+m\cdot|S|+T_{\max\text{-}\min}(n^\gamma,|S|,n)+n^\gamma\cdot\left(m\cdot\frac{n}{|S|}+\frac{n^2}{|S|}\right)\right) \\
&=\widetilde{O}\left(m\cdot\left(|S|+\frac{n^{1+\gamma}}{|S|}\right)+T_{\max\text{-}\min}(n^\gamma,|S|,n)\right).
\end{aligned} O ( m ⋅ n γ + m ⋅ ∣ S ∣ + T m a x - m i n ( n γ , ∣ S ∣ , n ) + n γ ⋅ ( m ⋅ ∣ S ∣ n + ∣ S ∣ n 2 ) ) = O ( m ⋅ ( ∣ S ∣ + ∣ S ∣ n 1 + γ ) + T m a x - m i n ( n γ , ∣ S ∣ , n ) ) .
Put p = n γ p=n^\gamma p = n γ , s = ∣ S ∣ s=|S| s = ∣ S ∣ , and θ = ( ω − 1 ) / 2 \theta=(\omega-1)/2 θ = ( ω − 1 ) /2 . By Theorem 3.2, splitting into square blocks of side min { p , s } \min\{p,s\} min { p , s } gives
T max - min ( p , s , n ) = { O ~ ( n s p θ ) , s ≥ p , O ~ ( n p s θ ) , s ≤ p . T_{\max\text{-}\min}(p,s,n)=
\begin{cases}
\widetilde{O}(nsp^\theta), & s\ge p,\\
\widetilde{O}(nps^\theta), & s\le p.
\end{cases} T m a x - m i n ( p , s , n ) = { O ( n s p θ ) , O ( n p s θ ) , s ≥ p , s ≤ p .
To balance the preprocessing terms, choose
s = { min { n p , m p ( 1 − θ ) / 2 } , m ≥ p 1 + θ , m 1 / ( 1 + θ ) , m < p 1 + θ . (12) s=
\begin{cases}
\min\{\sqrt{np},\sqrt{m}\,p^{(1-\theta)/2}\}, & m\ge p^{1+\theta},\\
m^{1/(1+\theta)}, & m<p^{1+\theta}.
\end{cases} \tag*{(12)} s = { min { n p , m p ( 1 − θ ) /2 } , m 1/ ( 1 + θ ) , m ≥ p 1 + θ , m < p 1 + θ . (12)
In the first case, s ≥ p s \ge p s ≥ p and this balances ( m + n p θ ) s (m + np^{\theta})s ( m + n p θ ) s with m n p / s mnp/s mn p / s up to constant factors. In the second, s ≤ p s \le p s ≤ p and m n p / s = n p s θ mnp/s = np\,s^{\theta} mn p / s = n p s θ , while m s ms m s is absorbed since s 2 ≤ n p s^2 \le np s 2 ≤ n p . Substitution gives preprocessing time
O ~ ( m n 1 + γ 2 + m ⋅ n ω + 1 4 γ + n 1 + γ m ω − 1 ω + 1 ) . \widetilde{O}\left(mn^{\frac{1+\gamma}{2}}+\sqrt{m}\cdot n^{\frac{\omega+1}{4}\gamma}+n^{1+\gamma}m^{\frac{\omega-1}{\omega+1}}\right). O ( m n 2 1 + γ + m ⋅ n 4 ω + 1 γ + n 1 + γ m ω + 1 ω − 1 ) .
Lastly, in our query algorithm we spend constant time each for ∣ P ∣ |P| ∣ P ∣ queries.
Additive Error: In a general graph, we show our algorithm outputs ε ~ \widetilde{\varepsilon} ε such that ecc G + ( p ) ⋅ 3 / 5 − 2 M / 5 ≤ ε ~ ≤ ecc G + ( p ) \operatorname{ecc}_{G^+}(p)\cdot3/5-2M/5 \le\widetilde{\varepsilon} \le\operatorname{ecc}_{G^+}(p) ecc G + ( p ) ⋅ 3/5 − 2 M /5 ≤ ε ≤ ecc G + ( p ) , thus giving a ( 5 / 3 , 2 M / 3 ) (5/3,2M/3) ( 5/3 , 2 M /3 ) approximation16 . Consider the correctness analysis for the approximation of ecc G + ( p ) \operatorname{ecc}_{G^+}(p) ecc G + ( p ) for some p ∈ P p \in P p ∈ P . We now have that if d G ( S , v ) ≤ 2 5 δ k V ( p , y ) + 2 M 5 d_G(S,v) \le\frac{2}{5}\delta_k^V(p,y)+\frac{2M}{5} d G ( S , v ) ≤ 5 2 δ k V ( p , y ) + 5 2 M or if d G ( w , y ) ≥ 3 5 δ k V ( p , y ) − 2 M 5 d_G(w,y) \ge\frac{3}{5}\delta_k^V(p,y)-\frac{2M}{5} d G ( w , y ) ≥ 5 3 δ k V ( p , y ) − 5 2 M then δ k V ( p , y ) \delta_k^V(p,y) δ k V ( p , y ) or δ k { w } ( p , y ) \delta_k^{\{w\}}(p,y) δ k { w } ( p , y ) obtains ours desired approximation respectively.
Without assuming that the graph is unweighted and 2 5 δ k V ( p , y ) \frac{2}{5}\delta_k^V(p,y) 5 2 δ k V ( p , y ) is an integer, we can no longer assume that there is a vertex on the path between w w w and y y y of this exact distance from w w w . Instead, we can find a node z z z on this path with the guarantee that
2 5 δ k V ( p , y ) − 3 M 5 ≤ d G ( w , z ) ≤ 2 5 δ k V ( p , y ) + 2 M 5 . \frac{2}{5}\delta_k^V(p,y)-\frac{3M}{5} \le d_G(w,z) \le\frac{2}{5}\delta_k^V(p,y)+\frac{2M}{5}. 5 2 δ k V ( p , y ) − 5 3 M ≤ d G ( w , z ) ≤ 5 2 δ k V ( p , y ) + 5 2 M .
By the same argument we know T T T must contain z z z and by the triangle inequality we have d G ( z , y ) ≤ 1 5 δ k V ( p , y ) + M 5 d_G(z,y) \le\frac{1}{5}\delta_k^V(p,y)+\frac{M}{5} d G ( z , y ) ≤ 5 1 δ k V ( p , y ) + 5 M . Now, by Claim 7.4, δ k V ( p , z ) ≥ 3 5 δ k V ( p , y ) − 2 M 5 \delta_k^V(p,z) \ge\frac{3}{5}\delta_k^V(p,y)-\frac{2M}{5} δ k V ( p , z ) ≥ 5 3 δ k V ( p , y ) − 5 2 M obtaining our desired approximation.
One way to address this error in weighted graphs allowing zero weight edges is the following. Begin by reducing the maximum degree of the graph to constant by taking a node v v v of degree Δ \Delta Δ and splitting its edges into Δ 2 \frac{\Delta}{2} 2 Δ pairs. For every pair of edges we replace its v v v endpoint with a distinct copy of v v v . Finally, we connect the Δ 2 \frac{\Delta}{2} 2 Δ copies of v v v with a binary tree of weight zero edges and depth O ( log Δ ) O(\log\Delta) O ( log Δ ) . After doing this for all vertices we are left with a graph of maximum degree 3 with O ( m ) O(m) O ( m ) vertices and O ~ ( m ) \widetilde{O}(m) O ( m ) edges. Now when computing δ k V \delta_k^V δ k V for all the points in T T T we can do it for all of the neighbors of T T T as well, as this set is only larger than T T T by a constant fraction. On the path between w w w and y y y we take z z z to be the last vertex such that d G ( w , z ) ≤ 2 5 δ k V ( p , y ) d_G(w,z) \le\frac{2}{5}\delta_k^V(p,y) d G ( w , z ) ≤ 5 2 δ k V ( p , y ) . Now z z z is in T T T and the next vertex on the path, which is a neighbor of z z z , is guaranteed to be within distance 1 5 δ k V ( p , y ) \frac{1}{5}\delta_k^V(p,y) 5 1 δ k V ( p , y ) of y y y , giving the desired approximation.
Thus, getting rid of the additive error blows up the number of nodes in the graph from n n n to m m m , so for a single point we get a preprocessing time of O ~ ( m 3 / 2 ) \widetilde{O}(m^{3/2}) O ( m 3/2 ) and for ∣ P ∣ = n γ |P|=n^\gamma ∣ P ∣ = n γ we get a preprocessing time of O ~ ( m 3 / 2 n ω + 1 4 γ + m 2 ω ω + 1 n γ ) \widetilde{O}(m^{3/2}n^{\frac{\omega+1}{4}\gamma}+m^{\frac{2\omega}{\omega+1}}n^\gamma) O ( m 3/2 n 4 ω + 1 γ + m ω + 1 2 ω n γ ) , since the transformed graph has O ( m ) O(m) O ( m ) vertices and edges, while ∣ P ∣ = n γ |P|=n^\gamma ∣ P ∣ = n γ .
Approximate Undirected Incremental Diameter and Radius
In this section we consider approximating the diameter and radius in the incremental setting. All the graphs in the following algorithms will be weighted and undirected. We note that most algorithms in this section incur an additive error proportional to the largest edge weight in the graph. The only exception is the purely multiplicative 3-approximation given in Theorem 8.3.
We begin by introducing the key lemma that serves as the foundation for our algorithms. This lemma states that if an edge is added to an undirected graph, then for any set of 3 vertices, at least one of the pairwise distances between these vertices will remain unchanged.
Lemma 8.1. Let w 1 , w 2 , … , w k w_1,w_2,\ldots,w_k w 1 , w 2 , … , w k be k = 2 r + 1 k=2^r+1 k = 2 r + 1 vertices in an undirected graph G = ( V , E ) G=(V,E) G = ( V , E ) . In the graph G + G^+ G + obtained by the addition of r r r edges to G G G , G + = ( V , E ∪ { ( x 1 , y 1 ) , … , ( x r , y r ) } ) G^+=(V,E\cup\{(x_1,y_1),\ldots,(x_r,y_r)\}) G + = ( V , E ∪ {( x 1 , y 1 ) , … , ( x r , y r )}) , at least one of the pairwise distances will remain unchanged, d G + ( w i , w j ) = d G ( w i , w j ) d_{G^+}(w_i,w_j)=d_G(w_i,w_j) d G + ( w i , w j ) = d G ( w i , w j ) .
Proof. For any two distinct vertices x , y ∈ V x,y\in V x , y ∈ V , define W x [ y ] = { v ∈ V : d G ( v , x ) ≤ d G ( v , y ) } W_{x[y]}=\{v\in V:d_G(v,x)\le d_G(v,y)\} W x [ y ] = { v ∈ V : d G ( v , x ) ≤ d G ( v , y )} and W y [ x ] = { v ∈ V : d G ( v , y ) ≤ d G ( v , x ) } W_{y[x]}=\{v\in V:d_G(v,y)\le d_G(v,x)\} W y [ x ] = { v ∈ V : d G ( v , y ) ≤ d G ( v , x )} . We observe that for any pair of points x , y x,y x , y the sets W x [ y ] , W y [ x ] W_{x[y]},W_{y[x]} W x [ y ] , W y [ x ] cover all vertices. Moreover, we claim the following.
Claim 8.2. For any a , b ∈ W x [ y ] a,b \in W_{x[y]} a , b ∈ W x [ y ] , the distance between a , b a,b a , b is not shortcuted by the addition of the edge ( x , y ) (x,y) ( x , y ) , i.e., d G ∪ ( x , y ) ( a , b ) = d G ( a , b ) d_{G\cup(x,y)}(a,b)=d_G(a,b) d G ∪ ( x , y ) ( a , b ) = d G ( a , b ) .
Proof. A shorter path would use ( x , y ) (x,y) ( x , y ) ; exchanging a , b a,b a , b if necessary, it visits a , x , y , b a,x,y,b a , x , y , b in this order. Since b ∈ W x [ y ] b \in W_{x[y]} b ∈ W x [ y ] and edge weights are nonnegative, its length is at least d G ( a , x ) + w ( x , y ) + d G ( y , b ) ≥ d G ( a , x ) + d G ( x , b ) ≥ d G ( a , b ) d_G(a,x)+w(x,y)+d_G(y,b) \ge d_G(a,x)+d_G(x,b) \ge d_G(a,b) d G ( a , x ) + w ( x , y ) + d G ( y , b ) ≥ d G ( a , x ) + d G ( x , b ) ≥ d G ( a , b ) , a contradiction.
Set G 0 = G G_0=G G 0 = G and G ℓ = G ℓ − 1 ∪ { ( x ℓ , y ℓ ) } G_\ell=G_{\ell-1}\cup\{(x_\ell,y_\ell)\} G ℓ = G ℓ − 1 ∪ {( x ℓ , y ℓ )} for ℓ ∈ [ 1 … r ] \ell\in[1\ldots r] ℓ ∈ [ 1 … r ] . For each ℓ \ell ℓ , define Z 0 ℓ = { v : d G ℓ − 1 ( v , x ℓ ) ≤ d G ℓ − 1 ( v , y ℓ ) } Z_0^\ell=\{v:d_{G_{\ell-1}}(v,x_\ell)\le d_{G_{\ell-1}}(v,y_\ell)\} Z 0 ℓ = { v : d G ℓ − 1 ( v , x ℓ ) ≤ d G ℓ − 1 ( v , y ℓ )} , Z 1 ℓ = V ∖ Z 0 ℓ Z_1^\ell=V\setminus Z_0^\ell Z 1 ℓ = V ∖ Z 0 ℓ . Applying Claim 8.2 in G ℓ − 1 G_{\ell-1} G ℓ − 1 , and symmetrically with x ℓ , y ℓ x_\ell,y_\ell x ℓ , y ℓ exchanged, shows that distances within either set are unchanged by the ℓ \ell ℓ th insertion. The intersections Z p = ⋂ ℓ = 1 r Z p ℓ ℓ Z_p=\bigcap_{\ell=1}^r Z_{p_\ell}^\ell Z p = ⋂ ℓ = 1 r Z p ℓ ℓ for p ∈ { 0 , 1 } r p\in\{0,1\}^r p ∈ { 0 , 1 } r , partition V V V into at most 2 r 2^r 2 r sets. Hence two of the 2 r + 1 2^r+1 2 r + 1 given vertices lie in the same Z p Z_p Z p , and their distance is unchanged at every step, i.e., d G + ( w i , w j ) = d G r ( w i , w j ) = ⋯ = d G 0 ( w i , w j ) = d G ( w i , w j ) d_{G^+}(w_i,w_j)=d_{G_r}(w_i,w_j)=\cdots=d_{G_0}(w_i,w_j)=d_G(w_i,w_j) d G + ( w i , w j ) = d G r ( w i , w j ) = ⋯ = d G 0 ( w i , w j ) = d G ( w i , w j ) .
Using Lemma 8.1 we can construct a 3-approximation for 1-incremental undirected diameter.
Theorem 8.3. There exists a 3-approximation for 1-incremental undirected diameter running in O ( m + n log n ) O(m+n\log n) O ( m + n log n ) pre-processing time and O ( 1 ) O(1) O ( 1 ) query time.
Proof. Pick an arbitrary vertex w 1 w_1 w 1 and run Dijkstra’s algorithm from it. Now, for i = 1 , 2 i=1,2 i = 1 , 2 set w i + 1 w_{i+1} w i + 1 to be the vertex that maximizes the distance to the set { w 1 , … , w i } \{w_1,\ldots,w_i\} { w 1 , … , w i } and run Dijkstra’s algorithm from it. This completes our preprocessing stage in O ( m + n log n ) O(m+n\log n) O ( m + n log n ) time.
After adding an edge G + = ( V , E ∪ { ( x , y ) } ) G^+=(V,E\cup\{(x,y)\}) G + = ( V , E ∪ {( x , y )}) compute all the new distances between pairs of points w i , w j w_i,w_j w i , w j in O ( 1 ) O(1) O ( 1 ) time per pair using the precomputed distances as follows:
d G + ( w i , w j ) = min ( d G ( w i , w j ) , d G ( w i , x ) + w ( x , y ) + d G ( y , w j ) , d G ( w i , y ) + w ( x , y ) + d G ( x , w j ) ) . d_{G^+}(w_i,w_j)=\min(d_G(w_i,w_j),d_G(w_i,x)+w(x,y)+d_G(y,w_j),d_G(w_i,y)+w(x,y)+d_G(x,w_j)). d G + ( w i , w j ) = min ( d G ( w i , w j ) , d G ( w i , x ) + w ( x , y ) + d G ( y , w j ) , d G ( w i , y ) + w ( x , y ) + d G ( x , w j )) .
Return the greatest of the distances computed. Since there are 3 pairs of points, the query runs in constant time. We want to argue that some pair of points must have d G + ( w i , w j ) ≥ diam ( G + ) / 3 d_{G^+}(w_i,w_j)\ge\operatorname{diam}(G^+)/3 d G + ( w i , w j ) ≥ diam ( G + ) /3 , and so our algorithm achieves a 3-approximation.
To this end, let s , t ∈ G s,t\in G s , t ∈ G be such that d G + ( s , t ) = diam ( G + ) d_{G^+}(s,t)=\operatorname{diam}(G^+) d G + ( s , t ) = diam ( G + ) . First, if d G ( s , w i ) ≥ diam ( G + ) / 3 d_G(s,w_i)\ge\operatorname{diam}(G^+)/3 d G ( s , w i ) ≥ diam ( G + ) /3 for every i ∈ [ 3 ] i\in[3] i ∈ [ 3 ] , then the farthest-point choice of each w j w_j w j gives d G ( w i , w j ) ≥ d G ( s , { w 1 , … , w j − 1 } ) ≥ diam ( G + ) / 3 d_G(w_i,w_j)\ge d_G(s,\{w_1,\ldots,w_{j-1}\})\ge\operatorname{diam}(G^+)/3 d G ( w i , w j ) ≥ d G ( s , { w 1 , … , w j − 1 }) ≥ diam ( G + ) /3 for every i < j i<j i < j . Therefore, by Lemma 8.1, at least one of these distances is unchanged by the addition of the r r r new edges and so d G + ( w i , w j ) ≥ diam ( G + ) / 3 d_{G^+}(w_i,w_j)\ge\operatorname{diam}(G^+)/3 d G + ( w i , w j ) ≥ diam ( G + ) /3 . Similarly, if d G ( t , w i ) ≥ diam ( G + ) / 3 d_G(t,w_i)\ge\operatorname{diam}(G^+)/3 d G ( t , w i ) ≥ diam ( G + ) /3 for all i ∈ [ 1 … 2 r + 1 ] i\in[1\ldots2^r+1] i ∈ [ 1 … 2 r + 1 ] we are finished. Otherwise, d G ( s , w i ) < diam ( G + ) / 3 d_G(s,w_i)<\operatorname{diam}(G^+)/3 d G ( s , w i ) < diam ( G + ) /3 and d G ( t , w j ) < diam ( G + ) / 3 d_G(t,w_j)<\operatorname{diam}(G^+)/3 d G ( t , w j ) < diam ( G + ) /3 for some i , j ∈ [ 3 ] i,j\in[3] i , j ∈ [ 3 ] . Therefore d G + ( s , w i ) , d G + ( t , w j ) < diam ( G + ) / 3 d_{G^+}(s,w_i),d_{G^+}(t,w_j)<\operatorname{diam}(G^+)/3 d G + ( s , w i ) , d G + ( t , w j ) < diam ( G + ) /3 and so by the triangle inequality, d G + ( w i , w j ) > diam ( G + ) / 3 d_{G^+}(w_i,w_j)>\operatorname{diam}(G^+)/3 d G + ( w i , w j ) > diam ( G + ) /3 .
Next, we demonstrate how to combine Lemma 8.1 with standard eccentricity-based arguments to derive the following structural result. These results form the foundation for various algorithms designed to maintain an approximate diameter in the incremental setting.
Lemma 8.4. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a weighted undirected graph with nonnegative edge weights bounded by M M M . Further, let α , β > 0 \alpha,\beta>0 α , β > 0 and 0 ≤ γ ≤ 1 0\le\gamma\le1 0 ≤ γ ≤ 1 be parameters, and consider the following process:
Sample a hitting set S ⊆ V S\subseteq V S ⊆ V of size ∣ S ∣ = Θ ( n γ log n ) |S|=\Theta(n^\gamma\log n) ∣ S ∣ = Θ ( n γ log n ) (taking S = V S=V S = V if this exceeds n n n );
Let w 1 ∈ V w_1\in V w 1 ∈ V maximize d G ( S , w 1 ) d_G(S,w_1) d G ( S , w 1 ) and let W 1 ⊆ V W_1\subseteq V W 1 ⊆ V be the Θ ( n 1 − γ ) \Theta(n^{1-\gamma}) Θ ( n 1 − γ ) closest points to w 1 w_1 w 1 ;
Let w 2 ∈ V w_2\in V w 2 ∈ V maximize min ( α d G ( S , w 2 ) , β d G ( W 1 , w 2 ) ) \min(\alpha d_G(S,w_2),\beta d_G(W_1,w_2)) min ( α d G ( S , w 2 ) , β d G ( W 1 , w 2 )) and let W 2 ⊆ V W_2\subseteq V W 2 ⊆ V be the Θ ( n 1 − γ ) \Theta(n^{1-\gamma}) Θ ( n 1 − γ ) closest points to w 2 w_2 w 2 ;
Let w 3 ∈ V w_3\in V w 3 ∈ V maximize min ( α d G ( S , w 3 ) , β d G ( W 1 ∪ W 2 , w 3 ) ) \min(\alpha d_G(S,w_3),\beta d_G(W_1\cup W_2,w_3)) min ( α d G ( S , w 3 ) , β d G ( W 1 ∪ W 2 , w 3 )) and let W 3 ⊆ V W_3\subseteq V W 3 ⊆ V be the Θ ( n 1 − γ ) \Theta(n^{1-\gamma}) Θ ( n 1 − γ ) closest points to w 3 w_3 w 3 ;
Consider adding to G G G the edge ( x , y ) (x,y) ( x , y ) of weight w ( x , y ) w(x,y) w ( x , y ) resulting in the graph G + G^+ G + . Then, for T : = W 1 ∪ W 2 ∪ W 3 T:=W_1\cup W_2\cup W_3 T := W 1 ∪ W 2 ∪ W 3 , D : = diam ( G + ) D:=\operatorname{diam}(G^+) D := diam ( G + ) and any Δ ≥ 0 \Delta\ge0 Δ ≥ 0 , with high probability at least one of the following holds:
(a) D − 2 Δ / α ≤ max u , v ∈ S d G + ( u , v ) D - 2\Delta/\alpha\le\max_{u,v\in S} d_{G^+}(u,v) D − 2Δ/ α ≤ max u , v ∈ S d G + ( u , v ) and D − Δ / α ≤ max ( u , v ) ∈ S × V d G + ( u , v ) D - \Delta/\alpha\le\max_{(u,v)\in S\times V} d_{G^+}(u,v) D − Δ/ α ≤ max ( u , v ) ∈ S × V d G + ( u , v ) ;
(b) Δ ( 1 / α + 1 / β ) − M ≤ max u , v ∈ { w 1 , w 2 , w 3 } d G + ( u , v ) \Delta(1/\alpha+ 1/\beta) - M \le\max_{u,v\in\{w_1,w_2,w_3\}} d_{G^+}(u,v) Δ ( 1/ α + 1/ β ) − M ≤ max u , v ∈ { w 1 , w 2 , w 3 } d G + ( u , v ) ; or
(c) D − Δ / β ≤ max ( u , v ) ∈ T × V d G + ( u , v ) D - \Delta/\beta\le\max_{(u,v)\in T\times V} d_{G^+}(u,v) D − Δ/ β ≤ max ( u , v ) ∈ T × V d G + ( u , v ) .
Proof. Condition on S S S hitting the chosen closest-point neighborhood of every vertex; this holds with high probability. Let s , t s,t s , t be diameter endpoints in G + G^+ G + . If both are within distance Δ / α \Delta/\alpha Δ/ α of S S S in G + G^+ G + , the triangle inequality gives Case (a).
Otherwise, assume d G + ( s , S ) > Δ / α d_{G^+}(s,S) > \Delta/\alpha d G + ( s , S ) > Δ/ α . If d G + ( s , T ) ≤ Δ / β d_{G^+}(s,T) \le\Delta/\beta d G + ( s , T ) ≤ Δ/ β , a closest point z ∈ T z \in T z ∈ T satisfies d G + ( z , t ) ≥ D − Δ / β d_{G^+}(z,t) \ge D - \Delta/\beta d G + ( z , t ) ≥ D − Δ/ β , giving Case (c). Hence assume also d G + ( s , T ) > Δ / β d_{G^+}(s,T) > \Delta/\beta d G + ( s , T ) > Δ/ β . Since original distances are no smaller, the choices of w 1 , w 2 , w 3 w_1,w_2,w_3 w 1 , w 2 , w 3 , using s s s as a candidate, imply
d G ( w i , S ) > Δ / α for 1 ≤ i ≤ 3 and, d G ( w j , W i ) > Δ / β for i < j . d_G(w_i,S) > \Delta/\alpha\text{ for } 1 \le i \le3 \text{ and, }\qquad d_G(w_j,W_i) > \Delta/\beta\text{ for } i < j. d G ( w i , S ) > Δ/ α for 1 ≤ i ≤ 3 and, d G ( w j , W i ) > Δ/ β for i < j .
As S S S hits each W i W_i W i , the set W i W_i W i contains the ball of radius Δ / α \Delta/\alpha Δ/ α around w i w_i w i .
For i < j i < j i < j with finite d G ( w i , w j ) d_G(w_i,w_j) d G ( w i , w j ) , let z z z be the last vertex at distance at most Δ / α \Delta/\alpha Δ/ α from w i w_i w i on a shortest w i w_i w i –w j w_j w j path. The next edge has weight at most M M M , so z ∈ W i z \in W_i z ∈ W i and d G ( w i , z ) > Δ / α − M d_G(w_i,z) > \Delta/\alpha- M d G ( w i , z ) > Δ/ α − M . Thus d G ( w i , w j ) = d G ( w i , z ) + d G ( z , w j ) > Δ ( 1 / α + 1 / β ) − M d_G(w_i,w_j) = d_G(w_i,z) + d_G(z,w_j) > \Delta(1/\alpha+ 1/\beta) - M d G ( w i , w j ) = d G ( w i , z ) + d G ( z , w j ) > Δ ( 1/ α + 1/ β ) − M . This inequality also holds when the distance is infinite. By Lemma 8.1, one of these three pairwise distances is unchanged, giving Case (b).
Via Lemma 8.4 we can construct the following algorithms that achieve different tradeoffs.
Main Theorem 5. Let G = ( V , E ) G = (V,E) G = ( V , E ) be a weighted and undirected graph with edge weights in [ 1.. M ] [1..M] [ 1.. M ] . Then, we can devise the following algorithms for incremental diameter:
a ( 3 / 2 + ε , M / 2 ) (3/2 + \varepsilon, M/2) ( 3/2 + ε , M /2 ) -approximation with O ~ ( m n + n ( ω + 7 ) / 4 + min ( M n ω , m n ) ) ≤ O ~ ( m n + n 2.343 + min ( M n ω , m n ) ) \widetilde{O}(m\sqrt{n} + n^{(\omega+7)/4} + \min(Mn^\omega,mn)) \le\widetilde{O}(m\sqrt{n} + n^{2.343} + \min(Mn^\omega,mn)) O ( m n + n ( ω + 7 ) /4 + min ( M n ω , mn )) ≤ O ( m n + n 2.343 + min ( M n ω , mn )) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time;
a ( 3 / 2 + ε , M / 2 ) (3/2 + \varepsilon, M/2) ( 3/2 + ε , M /2 ) -approximation with O ~ ( n 2.5 + min ( M n ω , m n ) ) \widetilde{O}(n^{2.5} + \min(Mn^\omega,mn)) O ( n 2.5 + min ( M n ω , mn )) preprocessing time and O ( 1 ) O(1) O ( 1 ) query time;
a ( 5 / 3 + ε , 2 M / 3 ) (5/3 + \varepsilon, 2M/3) ( 5/3 + ε , 2 M /3 ) -approximation with O ~ ( m n ( ω + 1 ) / ( 2 ω ) + n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) + min { m n , M n ω } ) ≤ O ~ ( m n 0.711 + n 2.198 + min { m n , M n ω } ) \widetilde{O}(mn^{(\omega+1)/(2\omega)} + n^{(\omega^2+6\omega+1)/(4\omega)} + \min\{mn,Mn^\omega\}) \le\widetilde{O}(mn^{0.711} + n^{2.198} + \min\{mn,Mn^\omega\}) O ( m n ( ω + 1 ) / ( 2 ω ) + n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) + min { mn , M n ω }) ≤ O ( m n 0.711 + n 2.198 + min { mn , M n ω }) preprocessing and O ~ ( n ( ω + 1 ) / ( 2 ω ) ) ≤ O ( n 0.711 ) \widetilde{O}(n^{(\omega+1)/(2\omega)}) \le O(n^{0.711}) O ( n ( ω + 1 ) / ( 2 ω ) ) ≤ O ( n 0.711 ) query time;
a ( 2 + ε , M ) (2 + \varepsilon, M) ( 2 + ε , M ) -approximation with O ~ ( m n + n ( ω + 5 ) / 4 ) ≤ O ~ ( m n + n 1.843 ) \widetilde{O}(m\sqrt{n} + n^{(\omega+5)/4}) \le\widetilde{O}(m\sqrt{n} + n^{1.843}) O ( m n + n ( ω + 5 ) /4 ) ≤ O ( m n + n 1.843 ) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time;
a ( 5 / 2 , M / 2 ) (5/2, M/2) ( 5/2 , M /2 ) -approximation with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time.
Proof. Choose η > 0 \eta> 0 η > 0 with ( 1 + η ) 2 ≤ 1 + ε / 2 (1+\eta)^2 \le1+\varepsilon/2 ( 1 + η ) 2 ≤ 1 + ε /2 and set I : = { 0 } ∪ { ( 1 + η ) i : 0 ≤ i ≤ ⌈ log 1 + η ( max { 1 , M n } ) ⌉ } \mathcal{I} := \{0\} \cup\{(1+\eta)^i : 0 \le i \le\lceil\log_{1+\eta}(\max\{1,Mn\})\rceil\} I := { 0 } ∪ {( 1 + η ) i : 0 ≤ i ≤ ⌈ log 1 + η ( max { 1 , M n })⌉} , and [ z ] I : = max { q ∈ I : q ≤ z } [z]_{\mathcal{I}} := \max\{q \in\mathcal{I}: q \le z\} [ z ] I := max { q ∈ I : q ≤ z } .
Algorithms (i) and (ii): In the pre-processing stage, we begin by computing the sets S S S , W 1 W_1 W 1 , W 2 W_2 W 2 , W 3 W_3 W 3 and points w 1 , w 2 , w 3 w_1,w_2,w_3 w 1 , w 2 , w 3 as in Lemma 8.4 with γ = 1 / 2 \gamma= 1/2 γ = 1/2 and α = β = 3 \alpha= \beta= 3 α = β = 3 , and taking T : = W 1 ∪ W 2 ∪ W 3 T := W_1 \cup W_2 \cup W_3 T := W 1 ∪ W 2 ∪ W 3 , using a constant number of calls to Dijkstra’s algorithm.
As in Lemma 7.2, set B [ u , v ] = d G ( u , v ) B[u,v] = d_G(u,v) B [ u , v ] = d G ( u , v ) for u ∈ S ∪ T u \in S \cup T u ∈ S ∪ T , v ∈ V v \in V v ∈ V , and C k [ w , v ] = d G ( v , w ) + k C_k[w,v] = d_G(v,w) + k C k [ w , v ] = d G ( v , w ) + k for w , v ∈ V w,v \in V w , v ∈ V , k ∈ I k \in\mathcal{I} k ∈ I . Compute A k = B ∘ C k A_k = B \mathbin{\circ} C_k A k = B ∘ C k .
Orient ( x , y ) (x,y) ( x , y ) for each u u u so that d G ( u , x ( u ) ) ≤ d G ( u , y ( u ) ) d_G(u,x(u)) \le d_G(u,y(u)) d G ( u , x ( u )) ≤ d G ( u , y ( u )) , and set k ( u ) = [ d G ( u , x ( u ) ) + w ( x , y ) ] I k(u) = [d_G(u,x(u)) + w(x,y)]_{\mathcal{I}} k ( u ) = [ d G ( u , x ( u )) + w ( x , y ) ] I . Upon the insertion of an edge ( x , y ) (x,y) ( x , y ) , we compute d G + ( w i , w j ) d_{G^+}(w_i,w_j) d G + ( w i , w j ) for i , j ∈ { 1 , 2 , 3 } i,j \in\{1,2,3\} i , j ∈ { 1 , 2 , 3 } and max u ∈ T ∪ S A k ( u ) [ u , y ( u ) ] \max_{u\in T\cup S} A_{k(u)}[u,y(u)] max u ∈ T ∪ S A k ( u ) [ u , y ( u )] and return the largest distance found.
For Algorithm (ii), precompute D ~ r ( x , y ) \widetilde{D}_r(x,y) D r ( x , y ) for x , y ∈ V x,y \in V x , y ∈ V and r ∈ I r \in\mathcal{I} r ∈ I , where
k r ( u ) = [ d G ( u , x ( u ) ) + r ] I , d ~ r ( w i , w j ) = min { d G ( w i , w j ) , d G ( w i , x ( w i ) ) + r + d G ( y ( w i ) , w j ) } , k_r(u) = [d_G(u,x(u)) + r]_{\mathcal{I}}, \qquad\widetilde{d}_r(w_i,w_j) = \min\{d_G(w_i,w_j),d_G(w_i,x(w_i)) + r + d_G(y(w_i),w_j)\}, k r ( u ) = [ d G ( u , x ( u )) + r ] I , d r ( w i , w j ) = min { d G ( w i , w j ) , d G ( w i , x ( w i )) + r + d G ( y ( w i ) , w j )} ,
D ~ r ( x , y ) = max { max 1 ≤ i < j ≤ 3 d ~ r ( w i , w j ) , max u ∈ T ∪ S A k r ( u ) [ u , y ( u ) ] } . \widetilde{D}_r(x,y) = \max\left\{\max_{1\le i<j\le3}\widetilde{d}_r(w_i,w_j),\max_{u\in T\cup S} A_{k_r(u)}[u,y(u)]\right\}. D r ( x , y ) = max { 1 ≤ i < j ≤ 3 max d r ( w i , w j ) , u ∈ T ∪ S max A k r ( u ) [ u , y ( u )] } .
On query ( x , y ) (x,y) ( x , y ) , return D ~ [ w ( x , y ) ] I ( x , y ) \widetilde{D}_{[w(x,y)]_{\mathcal{I}}}(x,y) D [ w ( x , y ) ] I ( x , y ) .
Correctness: Let D ^ \widehat{D} D be the returned value and define
D ~ : = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max u ∈ T ∪ S , v ∈ V d G + ( u , v ) } . \widetilde{D}:=\max\left\{\max_{1\leq i<j\leq3}d_{G^+}(w_i,w_j),\max_{\substack{u\in T\cup S,\\v\in V}}d_{G^+}(u,v)\right\}. D := max ⎩ ⎨ ⎧ 1 ≤ i < j ≤ 3 max d G + ( w i , w j ) , u ∈ T ∪ S , v ∈ V max d G + ( u , v ) ⎭ ⎬ ⎫ .
Algorithm (i) rounds once and Algorithm (ii) twice, so D ~ / ( 1 + η ) 2 ≤ D ^ ≤ D ~ \widetilde{D}/(1+\eta)^2\leq\widehat{D}\leq\widetilde{D} D / ( 1 + η ) 2 ≤ D ≤ D . With D = diam ( G + ) D=\operatorname{diam}(G^+) D = diam ( G + ) , Lemma 8.4 at ( Δ , α , β ) = ( D + M , 3 , 3 ) (\Delta,\alpha,\beta)=(D+M,3,3) ( Δ , α , β ) = ( D + M , 3 , 3 ) gives ( 2 D − M ) / 3 ≤ D ~ ≤ D (2D-M)/3\leq\widetilde{D}\leq D ( 2 D − M ) /3 ≤ D ≤ D . Hence D ^ ≤ D ≤ 3 / 2 ( 1 + η ) 2 D ^ + M / 2 ≤ ( 3 / 2 + ε ) D ^ + M / 2 \widehat{D}\leq D\leq3/2(1+\eta)^2\widehat{D}+M/2\leq(3/2+\varepsilon)\widehat{D}+M/2 D ≤ D ≤ 3/2 ( 1 + η ) 2 D + M /2 ≤ ( 3/2 + ε ) D + M /2 .
Runtime: The Shoshan–Zwick APSP algorithm [SZ99] supplies C k C_k C k in O ~ ( M n ω ) \widetilde{O}(Mn^\omega) O ( M n ω ) time, alternatively we can compute APSP in O ( m n ) O(mn) O ( mn ) time. Constructing S S S , W 1 W_1 W 1 , W 2 W_2 W 2 , W 3 W_3 W 3 and B B B costs O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) . Each of the ∣ I ∣ |\mathcal{I}| ∣ I ∣ products costs O ~ ( n ( ω + 7 ) / 4 ) \widetilde{O}(n^{(\omega+7)/4}) O ( n ( ω + 7 ) /4 ) by Theorem 3.2 . Algorithm (i) queries O ( ∣ S ∪ T ∣ ) = O ~ ( n ) O(|S\cup T|)=\widetilde{O}(\sqrt{n}) O ( ∣ S ∪ T ∣ ) = O ( n ) entries. Algorithm (ii) precomputes D ~ r \widetilde{D}_r D r in O ~ ( n 2.5 ) \widetilde{O}(n^{2.5}) O ( n 2.5 ) additional time and answers in O ( 1 ) O(1) O ( 1 ) time.
Algorithm (iv): Take α = β = 4 \alpha=\beta=4 α = β = 4 in Lemma 8.4 and set U = S ∪ T U=S\cup T U = S ∪ T . Restrict B B B to U × U U\times U U × U and C k C_k C k to U × V U\times V U × V , then compute A k = B ∘ ∨ C k A_k=B\mathbin{\circ\!\vee}C_k A k = B ∘ ∨ C k .
Upon the insertion of an edge ( x , y ) (x,y) ( x , y ) we compute and output
max ( d G + ( w 1 , w 2 ) , d G + ( w 1 , w 3 ) , d G + ( w 2 , w 3 ) , max u ∈ T ∪ S A k ( u ) [ u , y ( u ) ] ) . \max\left(d_{G^+}(w_1,w_2),d_{G^+}(w_1,w_3),d_{G^+}(w_2,w_3),\max_{u\in T\cup S}A_{k(u)}[u,y(u)]\right). max ( d G + ( w 1 , w 2 ) , d G + ( w 1 , w 3 ) , d G + ( w 2 , w 3 ) , u ∈ T ∪ S max A k ( u ) [ u , y ( u )] ) .
Correctness: Set U = S ∪ T U=S\cup T U = S ∪ T , D = diam ( G + ) D=\operatorname{diam}(G^+) D = diam ( G + ) , R = ( D + M ) / 4 R=(D+M)/4 R = ( D + M ) /4 , and
Q = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max u , v ∈ U d G + ( u , v ) } . Q=\max\left\{\max_{1\leq i<j\leq3}d_{G^+}(w_i,w_j),\max_{u,v\in U}d_{G^+}(u,v)\right\}. Q = max { 1 ≤ i < j ≤ 3 max d G + ( w i , w j ) , u , v ∈ U max d G + ( u , v ) } .
If d G + ( v , U ) > R d_{G^+}(v,U)>R d G + ( v , U ) > R for some v v v , the choices of w i w_i w i imply d G ( w i , S ) > R d_G(w_i,S)>R d G ( w i , S ) > R and d G ( w j , W i ) > R d_G(w_j,W_i)>R d G ( w j , W i ) > R for i < j i<j i < j ; Lemmas 8.1 and 8.4 then gives Q > 2 R − M Q>2R-M Q > 2 R − M . Otherwise choose diameter endpoints s , t s,t s , t and u s , u t ∈ U u_s,u_t\in U u s , u t ∈ U with d G + ( s , u s ) , d G + ( t , u t ) ≤ R d_{G^+}(s,u_s),d_{G^+}(t,u_t)\leq R d G + ( s , u s ) , d G + ( t , u t ) ≤ R ; then Q ≥ d G + ( u s , u t ) ≥ D − 2 R Q\geq d_{G^+}(u_s,u_t)\geq D-2R Q ≥ d G + ( u s , u t ) ≥ D − 2 R . Thus Q ≥ ( D − M ) / 2 Q\geq(D-M)/2 Q ≥ ( D − M ) /2 . Since Q / ( 1 + η ) ≤ D ^ ≤ Q Q/(1+\eta)\leq\widehat{D}\leq Q Q / ( 1 + η ) ≤ D ≤ Q , D ^ ≤ D ≤ 2 ( 1 + η ) D ^ + M ≤ ( 2 + ε ) D ^ + M \widehat{D}\leq D\leq2(1+\eta)\widehat{D}+M\leq(2+\varepsilon)\widehat{D}+M D ≤ D ≤ 2 ( 1 + η ) D + M ≤ ( 2 + ε ) D + M .
Runtime: Since C k C_k C k has only ∣ U ∣ = O ~ ( n ) |U|=\widetilde{O}(\sqrt{n}) ∣ U ∣ = O ( n ) rows, Dijkstra from U U U supplies its distances in O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) time. Each product costs O ~ ( n ( ω + 5 ) / 4 ) \widetilde{O}(n^{(\omega+5)/4}) O ( n ( ω + 5 ) /4 ) by Theorem 3.2 , and the query scans O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) entries.
Algorithm (iii): We now combine the approaches of the previous two algorithms. We take α = 5 \alpha=5 α = 5 , β = 5 / 2 \beta=5/2 β = 5/2 and γ = ( ω + 1 ) / ( 2 ω ) \gamma=(\omega+1)/(2\omega) γ = ( ω + 1 ) / ( 2 ω ) in Lemma 8.4 .
Apply the matrix construction separately to T × V T\times V T × V and S × S S\times S S × S . The query time is O ~ ( n γ + n 1 − γ ) \widetilde{O}(n^\gamma+n^{1-\gamma}) O ( n γ + n 1 − γ ) ; the product time is O ( T m a x - m i n ( n γ , n γ , n ) + T m a x - m i n ( n 1 − γ , n , n ) ) O(T_{\mathrm{max\text{-}min}}(n^\gamma,n^\gamma,n)+T_{\mathrm{max\text{-}min}}(n^{1-\gamma},n,n)) O ( T max - min ( n γ , n γ , n ) + T max - min ( n 1 − γ , n , n )) .
Let Q = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max t ∈ T , v ∈ V d G + ( t , v ) , max s , t ∈ S d G + ( s , t ) } Q=\max\{\max_{1\leq i<j\leq3}d_{G^+}(w_i,w_j),\max_{t\in T,v\in V}d_{G^+}(t,v),\max_{s,t\in S}d_{G^+}(s,t)\} Q = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max t ∈ T , v ∈ V d G + ( t , v ) , max s , t ∈ S d G + ( s , t )} . The matrix construction returns D ^ \widehat{D} D with Q / ( 1 + η ) ≤ D ^ ≤ Q Q/(1+\eta)\leq\widehat{D}\leq Q Q / ( 1 + η ) ≤ D ≤ Q .
Correctness: Set D = diam ( G + ) D=\operatorname{diam}(G^+) D = diam ( G + ) . At ( Δ , α , β ) = ( D + M , 5 , 5 / 2 ) (\Delta,\alpha,\beta)=(D+M,5,5/2) ( Δ , α , β ) = ( D + M , 5 , 5/2 ) , every case of Lemma 8.4 gives Q ≥ ( 3 D − 2 M ) / 5 Q\geq(3D-2M)/5 Q ≥ ( 3 D − 2 M ) /5 . Hence D ^ ≤ D ≤ 5 / 3 ( 1 + η ) D ^ + 2 M / 3 ≤ ( 5 / 3 + ε ) D ^ + 2 M / 3 \widehat{D}\leq D\leq5/3(1+\eta)\widehat{D}+2M/3\leq(5/3+\varepsilon)\widehat{D}+2M/3 D ≤ D ≤ 5/3 ( 1 + η ) D + 2 M /3 ≤ ( 5/3 + ε ) D + 2 M /3 .
Runtime: By our choice of γ \gamma γ , the query time is O ~ ( n γ ) = O ~ ( n ( ω + 1 ) / ( 2 ω ) ) \widetilde{O}(n^\gamma)=\widetilde{O}(n^{(\omega+1)/(2\omega)}) O ( n γ ) = O ( n ( ω + 1 ) / ( 2 ω ) ) . The stated preprocessing bound counts O ~ ( n γ ) \widetilde{O}(n^\gamma) O ( n γ ) calls to Dijkstra’s algorithm and two max-min products. By Theorem 3.2 ,
T m a x - m i n ( n γ , n γ , n ) ≤ n 1 − γ ⋅ n γ ⋅ n ( 3 + ω ) / 2 = n ( 2 ω + 6 ω + 1 ) / ( 4 ω ) , T_{\mathrm{max\text{-}min}}(n^\gamma,n^\gamma,n)\leq n^{1-\gamma}\cdot n^\gamma\cdot n^{(3+\omega)/2}=n^{(2\omega+6\omega+1)/(4\omega)}, T max - min ( n γ , n γ , n ) ≤ n 1 − γ ⋅ n γ ⋅ n ( 3 + ω ) /2 = n ( 2 ω + 6 ω + 1 ) / ( 4 ω ) ,
T m a x - m i n ( n 1 − γ , n , n ) ≤ n 2 γ ⋅ n ( 1 − γ ) ( 3 + ω ) / 2 = n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) . T_{\mathrm{max\text{-}min}}(n^{1-\gamma},n,n)\leq n^{2\gamma}\cdot n^{(1-\gamma)(3+\omega)/2}=n^{(\omega^2+6\omega+1)/(4\omega)}. T max - min ( n 1 − γ , n , n ) ≤ n 2 γ ⋅ n ( 1 − γ ) ( 3 + ω ) /2 = n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) .
These steps take O ~ ( m n ( ω + 1 ) / ( 2 ω ) + n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) ) \widetilde{O}(mn^{(\omega+1)/(2\omega)}+n^{(\omega^2+6\omega+1)/(4\omega)}) O ( m n ( ω + 1 ) / ( 2 ω ) + n ( ω 2 + 6 ω + 1 ) / ( 4 ω ) ) time. Additionally, we must compute APSP in time O ~ ( min ( m n , M n ω ) ) \widetilde{O}(\min(mn,Mn^\omega)) O ( min ( mn , M n ω )) to obtain C k C_k C k .
Algorithm (v): Use Lemma 8.4 with ( γ , α , β ) = ( 1 / 2 , 5 , 5 ) (\gamma,\alpha,\beta)=(1/2,5,5) ( γ , α , β ) = ( 1/2 , 5 , 5 ) to obtain S , T , w 1 , w 2 , w 3 S,T,w_1,w_2,w_3 S , T , w 1 , w 2 , w 3 . For each u ∈ S ∪ T u\in S\cup T u ∈ S ∪ T , halve the estimate from Main Theorem 3 to obtain ε ~ ( u ) \widetilde{\varepsilon}(u) ε ( u ) with ε ~ ( u ) ≤ ecc G + ( u ) ≤ 2 ε ~ ( u ) \widetilde{\varepsilon}(u)\leq\operatorname{ecc}_{G^+}(u)\leq2\widetilde{\varepsilon}(u) ε ( u ) ≤ ecc G + ( u ) ≤ 2 ε ( u ) . Return D ^ = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max u ∈ S ∪ T ε ~ ( u ) } \widehat{D}=\max\{\max_{1\leq i<j\leq3}d_{G^+}(w_i,w_j),\max_{u\in S\cup T}\widetilde{\varepsilon}(u)\} D = max { max 1 ≤ i < j ≤ 3 d G + ( w i , w j ) , max u ∈ S ∪ T ε ( u )} .
Correctness: Set D = diam ( G + ) D=\operatorname{diam}(G^+) D = diam ( G + ) . At ( Δ , α , β ) = ( D + 2 M , 5 , 5 ) (\Delta,\alpha,\beta)=(D+2M,5,5) ( Δ , α , β ) = ( D + 2 M , 5 , 5 ) , Lemma 8.4 gives either a landmark distance of at least ( 2 D − M ) / 5 (2D-M)/5 ( 2 D − M ) /5 or an eccentricity in S ∪ T S\cup T S ∪ T of at least ( 4 D − 2 M ) / 5 (4D-2M)/5 ( 4 D − 2 M ) /5 . Thus D ^ ≥ ( 2 D − M ) / 5 \widehat{D}\geq(2D-M)/5 D ≥ ( 2 D − M ) /5 , and D ^ ≤ D ≤ 5 / 2 D ^ + M / 2 \widehat{D}\leq D\leq5/2\widehat{D}+M/2 D ≤ D ≤ 5/2 D + M /2 . Runtime: By our choice of γ \gamma γ , our query time is O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) and our preprocessing time is dominated by O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) calls to Dijkstra’s algorithm and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) calls to Main Theorem 3, running in total O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing time.
Lastly, we demonstrate how to adapt Lemma 8.4 to make it applicable to radius as well.
Lemma 8.5. Let G = ( V , E ) \mathrm{G}=(V,E) G = ( V , E ) be a weighted undirected graph with nonnegative edge weights bounded by M M M . Consider the following process:
Sample a hitting set S ⊆ V S\subseteq V S ⊆ V of size ∣ S ∣ = Θ ( n 1 / 2 log n ) |S|=\Theta(n^{1/2}\log n) ∣ S ∣ = Θ ( n 1/2 log n ) ;
Let w 1 ∈ V w_1\in V w 1 ∈ V maximize d G ( S , w 1 ) d_{\mathrm{G}}(S,w_1) d G ( S , w 1 ) and let W 1 ⊆ V W_1\subseteq V W 1 ⊆ V be the Θ ( n 1 / 2 ) \Theta(n^{1/2}) Θ ( n 1/2 ) closest points to w 1 w_1 w 1 ;
Let w 2 ∈ V w_2\in V w 2 ∈ V maximize min ( 4 d G ( S , w 2 ) , d G ( w 1 , w 2 ) + 2 M ) \min(4d_{\mathrm{G}}(S,w_2),d_{\mathrm{G}}(w_1,w_2)+2M) min ( 4 d G ( S , w 2 ) , d G ( w 1 , w 2 ) + 2 M ) and let W 2 ⊆ V W_2\subseteq V W 2 ⊆ V be the Θ ( n 1 / 2 ) \Theta(n^{1/2}) Θ ( n 1/2 ) closest points to w 2 w_2 w 2 ;
Let w 3 ∈ V w_3\in V w 3 ∈ V maximize d G ( w 1 , w 3 ) d_{\mathrm{G}}(w_1,w_3) d G ( w 1 , w 3 ) ;
Consider adding to G \mathrm{G} G the edge ( x , y ) (x,y) ( x , y ) of weight w ( x , y ) w(x,y) w ( x , y ) resulting in the graph G + \mathrm{G}^{+} G + . With high probability, either there is z ∈ S ∪ W 1 ∪ W 2 ∪ { w 3 } z\in S\cup W_1\cup W_2\cup\{w_3\} z ∈ S ∪ W 1 ∪ W 2 ∪ { w 3 } with ecc G + ( z ) ≤ 3 / 2 ⋅ radius ( G + ) + M / 2 \operatorname{ecc}_{\mathrm{G}^{+}}(z)\le3/2\cdot\operatorname{radius}(\mathrm{G}^{+})+M/2 ecc G + ( z ) ≤ 3/2 ⋅ radius ( G + ) + M /2 or ecc G ( w 1 ) ≤ 3 radius ( G + ) \operatorname{ecc}_{\mathrm{G}}(w_1)\le3\operatorname{radius}(\mathrm{G}^{+}) ecc G ( w 1 ) ≤ 3 radius ( G + ) .
Proof. Condition on S S S hitting the fixed closest-point neighborhood of every vertex. Let c c c be a center of G + \mathrm{G}^{+} G + , put R = radius ( G + ) R=\operatorname{radius}(\mathrm{G}^{+}) R = radius ( G + ) and a = ( R + M ) / 2 a=(R+M)/2 a = ( R + M ) /2 , and write X = S ∪ W 1 ∪ W 2 ∪ { w 3 } X=S\cup W_1\cup W_2\cup\{w_3\} X = S ∪ W 1 ∪ W 2 ∪ { w 3 } . We may assume R < ∞ R<\infty R < ∞ , since otherwise the claim is immediate. If c ∈ X c\in X c ∈ X or d G ( c , S ) ≤ a d_{\mathrm{G}}(c,S)\le a d G ( c , S ) ≤ a , the first alternative follows from the triangle inequality. Otherwise d G ( w 1 , S ) > a d_{\mathrm{G}}(w_1,S)>a d G ( w 1 , S ) > a , so W 1 W_1 W 1 contains the ball of radius a a a around w 1 w_1 w 1 .
If ecc G ( w 1 ) ≤ 3 R \operatorname{ecc}_{\mathrm{G}}(w_1)\le3R ecc G ( w 1 ) ≤ 3 R , we are done. Otherwise d G ( w 1 , w 3 ) > 3 R d_{\mathrm{G}}(w_1,w_3)>3R d G ( w 1 , w 3 ) > 3 R . By Lemma 8.1 , one distance among w 1 , w 3 , c w_1,w_3,c w 1 , w 3 , c is unchanged. Since d G + ( w 1 , w 3 ) ≤ 2 R d_{\mathrm{G}^{+}}(w_1,w_3)\le2R d G + ( w 1 , w 3 ) ≤ 2 R , either d G ( w 1 , c ) ≤ R d_{\mathrm{G}}(w_1,c)\le R d G ( w 1 , c ) ≤ R or d G ( w 3 , c ) ≤ R d_{\mathrm{G}}(w_3,c)\le R d G ( w 3 , c ) ≤ R . If the former fails, the latter and the triangle inequality give d G ( w 1 , c ) > 2 R d_{\mathrm{G}}(w_1,c)>2R d G ( w 1 , c ) > 2 R . Hence c c c satisfies min { 4 d G ( S , c ) , d G ( w 1 , c ) + 2 M } > 2 R + 2 M \min\{4d_{\mathrm{G}}(S,c),d_{\mathrm{G}}(w_1,c)+2M\}>2R+2M min { 4 d G ( S , c ) , d G ( w 1 , c ) + 2 M } > 2 R + 2 M . Our choice of w 2 w_2 w 2 implies d G ( w 1 , w 2 ) > 2 R d_{\mathrm{G}}(w_1,w_2)>2R d G ( w 1 , w 2 ) > 2 R and d G ( w 2 , S ) > a d_{\mathrm{G}}(w_2,S)>a d G ( w 2 , S ) > a . Applying Lemma 8.1 to w 1 , w 2 , c w_1,w_2,c w 1 , w 2 , c now forces d G ( w 2 , c ) = d G + ( w 2 , c ) ≤ R d_{\mathrm{G}}(w_2,c)=d_{\mathrm{G}^{+}}(w_2,c)\le R d G ( w 2 , c ) = d G + ( w 2 , c ) ≤ R .
Thus, for some i ∈ { 1 , 2 } i\in\{1,2\} i ∈ { 1 , 2 } , d G ( w i , c ) ≤ R d_{\mathrm{G}}(w_i,c)\le R d G ( w i , c ) ≤ R and W i W_i W i contains the ball of radius a a a around w i w_i w i . If d G ( w i , c ) ≤ a d_{\mathrm{G}}(w_i,c)\le a d G ( w i , c ) ≤ a , then c ∈ W i c\in W_i c ∈ W i . Otherwise, let z z z be the last vertex within distance a a a of w i w_i w i on a shortest w i w_i w i –c c c path. The next edge has weight at most M M M , so z ∈ W i z\in W_i z ∈ W i and d G ( z , c ) < R − a + M = a d_{\mathrm{G}}(z,c)<R-a+M=a d G ( z , c ) < R − a + M = a , and ecc G + ( z ) ≤ R + d G ( z , c ) ≤ 3 R + M 2 \operatorname{ecc}_{\mathrm{G}^{+}}(z)\le R+d_{\mathrm{G}}(z,c)\le\frac{3R+M}{2} ecc G + ( z ) ≤ R + d G ( z , c ) ≤ 2 3 R + M . This proves the first alternative.
Lemma 8.5 yields the following algorithm.
Theorem 8.6. For weighted undirected graphs with nonnegative edge weights bounded by M M M , there exists a ( 3 , M ) (3,M) ( 3 , M ) -approximation for incremental radius with expected O ~ ( ( m + n ) n ) \widetilde{O}((m+n)\sqrt{n}) O (( m + n ) n ) preprocessing time and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time.
Proof. Construct S , w 1 , W 1 , w 2 , W 2 , w 3 S,w_1,W_1,w_2,W_2,w_3 S , w 1 , W 1 , w 2 , W 2 , w 3 as in Lemma 8.5 and store ecc G ( w 1 ) \operatorname{ecc}_{\mathrm{G}}(w_1) ecc G ( w 1 ) . For each z ∈ X : = S ∪ W 1 ∪ W 2 ∪ { w 3 } z\in X:=S\cup W_1\cup W_2\cup\{w_3\} z ∈ X := S ∪ W 1 ∪ W 2 ∪ { w 3 } , use the pseudo-center construction in the proof of Main Theorem 3 to maintain an upper estimate ecc G + ( z ) ≤ e ~ ( z ) ≤ 2 ecc G + ( z ) \operatorname{ecc}_{\mathrm{G}^{+}}(z)\le\widetilde{e}(z)\le2\operatorname{ecc}_{\mathrm{G}^{+}}(z) ecc G + ( z ) ≤ e ( z ) ≤ 2 ecc G + ( z ) . Upon insertion, return R ~ : = min { ecc G ( w 1 ) , min z ∈ X e ~ ( z ) } \widetilde{R}:=\min\{\operatorname{ecc}_{\mathrm{G}}(w_1),\min_{z\in X}\widetilde{e}(z)\} R := min { ecc G ( w 1 ) , min z ∈ X e ( z )} .
Correctness: Write R = radius ( G + ) R=\operatorname{radius}(\mathrm{G}^{+}) R = radius ( G + ) . Every candidate is at least R R R : in particular, edge insertion gives ecc G ( w 1 ) ≥ ecc G + ( w 1 ) ≥ R \operatorname{ecc}_{\mathrm{G}}(w_1)\ge\operatorname{ecc}_{\mathrm{G}^{+}}(w_1)\ge R ecc G ( w 1 ) ≥ ecc G + ( w 1 ) ≥ R . By Lemma 8.5 , either some z ∈ X z\in X z ∈ X has ecc G + ( z ) ≤ ( 3 R + M ) / 2 \operatorname{ecc}_{\mathrm{G}^{+}}(z)\le(3R+M)/2 ecc G + ( z ) ≤ ( 3 R + M ) /2 , and hence e ~ ( z ) ≤ 3 R + M \widetilde{e}(z)\le3R+M e ( z ) ≤ 3 R + M , or ecc G ( w 1 ) ≤ 3 R \operatorname{ecc}_{\mathrm{G}}(w_1)\le3R ecc G ( w 1 ) ≤ 3 R . Consequently, R ≤ R ~ ≤ 3 R + M R\le\widetilde{R}\le3R+M R ≤ R ≤ 3 R + M .
Runtime: There are O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) candidates. Each eccentricity oracle takes expected O ~ ( m + n ) \widetilde{O}(m+n) O ( m + n ) preprocessing and O ~ ( 1 ) \widetilde{O}(1) O ( 1 ) query time, giving expected O ~ ( ( m + n ) n ) \widetilde{O}((m+n)\sqrt{n}) O (( m + n ) n ) preprocessing and O ~ ( n ) \widetilde{O}(\sqrt{n}) O ( n ) query time in total. For m = Ω ( n ) m=\Omega(n) m = Ω ( n ) , the preprocessing bound is O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) .
We conclude this section by giving an algorithm for incremental diameter in disconnected graphs.
Lemma 8.7. There exists a 5 / 3 5/3 5/3 -approximation for the incremental diameter of a disconnected undirected graph, with O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) preprocessing time and O ( 1 ) O(1) O ( 1 ) query time.
Proof. If the disconnected graph has more than two connected components, then after any single edge insertion there will still be more than one connected component and therefore infinite diameter. Thus, in this case we just output ∞ \infty ∞ no matter what edge is added.
If the original graph has two connected components, S 1 , S 2 S_1, S_2 S 1 , S 2 , we compute for every vertex v ∈ S 1 v \in S_1 v ∈ S 1 its 5 / 3 5/3 5/3 -approximate eccentricity in the graph G [ S 1 ] G[S_1] G [ S 1 ] . Denote its true eccentricity by ε 1 ( s ) : = ecc G [ S 1 ] ( s ) \varepsilon_1(s) := \operatorname{ecc}_{G[S_1]}(s) ε 1 ( s ) := ecc G [ S 1 ] ( s ) and the approximation by ε ~ 1 ( v ) \widetilde{\varepsilon}_1(v) ε 1 ( v ) . Similarly, we approximate all the eccentricities ε ~ 2 \widetilde{\varepsilon}_2 ε 2 of vertices in the graph G [ S 2 ] G[S_2] G [ S 2 ] . Using the all-node eccentricity 5 / 3 5/3 5/3 -approximation of Chechik et al. [CLR+14], this can be done in O ~ ( m n ) \widetilde{O}(m\sqrt{n}) O ( m n ) time. Let D 1 D_1 D 1 be the maximal approximate eccentricity computed within S 1 S_1 S 1 and D 2 D_2 D 2 be the maximal approximate eccentricity computed within S 2 S_2 S 2 .
Now, when an edge ( u , v ) (u,v) ( u , v ) is added, if u u u and v v v lie in the same connected component in the original graph, then the graph is still disconnected and thus the diameter is infinite. Otherwise, w.l.o.g. u ∈ S 1 u \in S_1 u ∈ S 1 and v ∈ S 2 v \in S_2 v ∈ S 2 . In this case we output D ~ : = max ( D 1 , D 2 , ε ~ 1 ( u ) + w ( u , v ) + ε ~ 2 ( v ) ) \widetilde{D} := \max(D_1, D_2, \widetilde{\varepsilon}_1(u) + w(u,v) + \widetilde{\varepsilon}_2(v)) D := max ( D 1 , D 2 , ε 1 ( u ) + w ( u , v ) + ε 2 ( v )) . We claim that this gives the desired approximation.
Consider the longest path in the graph after adding the edge ( u , v ) (u,v) ( u , v ) , denote its length by D : = diam ( G ∪ ( u , v ) ) D := \operatorname{diam}(G \cup(u,v)) D := diam ( G ∪ ( u , v )) . If the path is contained entirely in S 1 S_1 S 1 , then its length is at most the diameter of G [ S 1 ] G[S_1] G [ S 1 ] and so D 1 D_1 D 1 is a good approximation for it, 3 D 5 ≤ D 1 ≤ D \frac{3D}{5} \le D_1 \le D 5 3 D ≤ D 1 ≤ D . Similarly, if the path is contained in S 2 S_2 S 2 then 3 D 5 ≤ D 2 ≤ D \frac{3D}{5} \le D_2 \le D 5 3 D ≤ D 2 ≤ D . Otherwise, the path must begin in S 1 S_1 S 1 , go through the edge ( u , v ) (u,v) ( u , v ) and then continue in S 2 S_2 S 2 . In this case, the length of path of the path contained in S 1 S_1 S 1 is bounded by ε 1 ( u ) \varepsilon_1(u) ε 1 ( u ) and the length of the path contained in S 2 S_2 S 2 is bounded by ε 2 ( v ) \varepsilon_2(v) ε 2 ( v ) . Therefore, D ≤ ε 1 ( u ) + w ( u , v ) + ε 2 ( v ) D \le\varepsilon_1(u) + w(u,v) + \varepsilon_2(v) D ≤ ε 1 ( u ) + w ( u , v ) + ε 2 ( v ) , and by our approximation guarantees we have
3 D 5 ≤ 3 ε 1 ( u ) 5 + w ( u , v ) + 3 ε 2 ( v ) 5 ≤ ε ~ 1 ( u ) + w ( u , v ) + ε ~ 2 ( v ) . \frac{3D}{5} \le\frac{3\varepsilon_1(u)}{5} + w(u,v) + \frac{3\varepsilon_2(v)}{5} \le\widetilde{\varepsilon}_1(u) + w(u,v) + \widetilde{\varepsilon}_2(v). 5 3 D ≤ 5 3 ε 1 ( u ) + w ( u , v ) + 5 3 ε 2 ( v ) ≤ ε 1 ( u ) + w ( u , v ) + ε 2 ( v ) .
We conclude that 3 D 5 ≤ D ~ ≤ D \frac{3D}{5} \le\widetilde{D} \le D 5 3 D ≤ D ≤ D .
Lower Bounds
In this section, we show the following lower bounds.
Lemma 9.1. We can encode a boolean matrix product in a single instance of decremental diameter and decremental all-nodes eccentricities in unweighted (undirected or directed) graphs such that any ( 3 / 2 − ε ) (3/2-\varepsilon) ( 3/2 − ε ) -approximate algorithm for these problems allows us to read off the solution to the boolean matrix product from O ( n 2 ) O(n^2) O ( n 2 ) queries.
Lemma 9.2. Assuming the OV hypothesis, for ε , δ > 0 \varepsilon,\delta> 0 ε , δ > 0 , there is no data structure which has both O ( m 2 − δ ) O(m^{2-\delta}) O ( m 2 − δ ) preprocessing time and O ( m 1 − δ ) O(m^{1-\delta}) O ( m 1 − δ ) query time for the following incremental problems:
(i) ( 5 / 3 − ε ) (5/3-\varepsilon) ( 5/3 − ε ) -approximate eccentricity of a single node in an unweighted and undirected graph;
(ii) ( 5 / 3 − ε ) (5/3-\varepsilon) ( 5/3 − ε ) -approximate diameter or radius in an unweighted and undirected graph;
(iii) ( 2 − ε ) (2-\varepsilon) ( 2 − ε ) -approximate eccentricity of a single node or radius of an unweighted and directed graph; and
(iv) ( 2 − ε ) (2-\varepsilon) ( 2 − ε ) -approximate diameter in an unweighted and directed graph;
The lower bounds (i),(ii) hold even when the input graph is guaranteed to be disconnected.
We give the proof of Lemma 9.1 in § 12.1 , of Theorem 9.2(i),(ii) in § 12.2 and of Theorem 9.2(iii),(iv) in § 12.4 .
Lower Bound for Decremental Diameter
Proof of Lemma 9.1. Let X , Y X,Y X , Y be two boolean n × n n \times n n × n matrices whose boolean product Z ≔ X Y Z \coloneqq XY Z : = X Y we wish to compute. Based on X X X and Y Y Y , we construct an unweighted graph G G G . (In our case G G G is undirected, extending it to a directed graph is straightforward.) Executing a decremental diameter (resp. decremental eccentricities) algorithm on G G G allows us to extract Z Z Z from the results.
Refer to Figure 2 for an example of G G G . The node set of G G G consists of a tripartite set A ∪ B ∪ C A \cup B \cup C A ∪ B ∪ C and two auxiliary nodes ℓ , r \ell,r ℓ , r . The sets A , B , C A,B,C A , B , C each consist of n n n nodes, specifically A = { a 1 , … , a n } A = \{a_1,\ldots,a_n\} A = { a 1 , … , a n } , B = { b 1 , … , b n } B = \{b_1,\ldots,b_n\} B = { b 1 , … , b n } , and C = { c 1 , … , c n } C = \{c_1,\ldots,c_n\} C = { c 1 , … , c n } . The edge set is defined as follows: The nodes ℓ \ell ℓ and r r r are connected to all nodes in A ∪ C A \cup C A ∪ C and B ∪ C B \cup C B ∪ C , respectively. All nodes in A A A and B B B are connected to each other (forming a complete bipartite graph between A A A and B B B ). Additionally, there is an edge ( a i , c k ) (a_i,c_k) ( a i , c k ) if X i , k = 1 X_{i,k}=1 X i , k = 1 , and an edge ( c k , b j ) (c_k,b_j) ( c k , b j ) if Y k , j = 1 Y_{k,j}=1 Y k , j = 1 .
Figure 2. An example of the graph G G G used in the reduction of Lemma 9.1.
Observe that the distance from ℓ \ell ℓ (resp. r r r ) to any node in its neighbor set A ∪ C A \cup C A ∪ C (resp. B ∪ C B \cup C B ∪ C ) is one. Furthermore, the distance from any c k c_k c k to any other node is at most two (via ℓ \ell ℓ or r r r ), and this remains true even if an edge of the form ( a i , b j ) (a_i,b_j) ( a i , b j ) is removed. Finally, the distance from any a i a_i a i to b j b_j b j is initially one. This distance remains 1 for any pair ( a i ′ , b j ′ ) (a_{i'},b_{j'}) ( a i ′ , b j ′ ) where i ≠ i ′ i \ne i' i = i ′ or j ≠ j ′ j \ne j' j = j ′ , even in G ∖ ( a i ′ , b j ′ ) G \setminus(a_{i'},b_{j'}) G ∖ ( a i ′ , b j ′ ) . However, in G ∖ ( a i , b j ) G \setminus(a_i,b_j) G ∖ ( a i , b j ) , the distance between a i a_i a i and b j b_j b j is two if and only if there exists a c k c_k c k such that both ( a i , c k ) (a_i,c_k) ( a i , c k ) and ( c k , b j ) (c_k,b_j) ( c k , b j ) are edges (implying X i , k = 1 X_{i,k}=1 X i , k = 1 and Y k , j = 1 Y_{k,j}=1 Y k , j = 1 ). Otherwise, the distance is three. We conclude that Z i , j = 1 Z_{i,j}=1 Z i , j = 1 if and only if diam ( G ∖ ( a i , b j ) ) = 2 \operatorname{diam}(G \setminus(a_i,b_j))=2 diam ( G ∖ ( a i , b j )) = 2 , and Z i , j = 0 Z_{i,j}=0 Z i , j = 0 if and only if diam ( G ∖ ( a i , b j ) ) = 3 \operatorname{diam}(G \setminus(a_i,b_j))=3 diam ( G ∖ ( a i , b j )) = 3 . Similarly, Z i , j = 0 Z_{i,j}=0 Z i , j = 0 if and only if ecc G ∖ ( a i , b j ) ( a i ) = 3 \operatorname{ecc}_{G\setminus(a_i,b_j)}(a_i)=3 ecc G ∖ ( a i , b j ) ( a i ) = 3 .
Lower Bounds for Incremental Algorithms in Undirected Graphs
Base graph
Both of our reductions for undirected graphs begin with the same base graph G G G , constructed from an OV instance as follows. Let V V V be the vector set in the OV instance, with ∣ V ∣ = N |V|=N ∣ V ∣ = N , and let C C C be the coordinate set. We begin constructing the graph G G G by creating four layers of nodes. The first layer V 1 V_1 V 1 consists of the vectors in V V V , and the second consists of the coordinates C C C . We abuse notation slightly and allow C C C to stand for both the coordinate set and the set of nodes in the second layer of G G G . The third and fourth layers V 2 V_2 V 2 and V 3 V_3 V 3 are copies of V 1 V_1 V 1 . For a v ∈ V v \in V v ∈ V , we let v 1 v_1 v 1 , v 2 v_2 v 2 , and v 3 v_3 v 3 denote the nodes corresponding to v v v in V 1 V_1 V 1 , V 2 V_2 V 2 , and V 3 V_3 V 3 respectively. Let a a a be a constant to be decided later. We add an undirected path of a a a edges between v ∈ V 1 v \in V_1 v ∈ V 1 and c ∈ C c \in C c ∈ C whenever v [ c ] = 1 v[c] = 1 v [ c ] = 1 . We add a path of a a a edges between c ∈ C c \in C c ∈ C and v ∈ V 2 v \in V_2 v ∈ V 2 whenever v [ c ] = 1 v[c] = 1 v [ c ] = 1 . We add an undirected path of a a a edges between matching nodes in V 2 V_2 V 2 and V 3 V_3 V 3 . Refer to Figure 3 for an example of a graph G G G .
Figure 3. An example of the graph G G G used in the reduction for undirected graphs where a = 2 a = 2 a = 2 . The red node and edge is added to G G G in the first round of the lower bound of Theorem 9.2(i).
Proposition 9.3. If v ∈ V v \in V v ∈ V is in an orthogonal pair, then ecc G ( v 1 ) ≥ 5 a \operatorname{ecc}_G(v_1) \ge5a ecc G ( v 1 ) ≥ 5 a . Otherwise, ecc G ( v 1 ) ≤ 3 a \operatorname{ecc}_G(v_1) \le3a ecc G ( v 1 ) ≤ 3 a .
Proof. Suppose ( v , u ) (v,u) ( v , u ) is an orthogonal pair, and consider the shortest path P P P from v 1 v_1 v 1 to u 3 u_3 u 3 . By our construction, P P P must go through a coordinate node c ∈ C c \in C c ∈ C so that v [ c ] = 1 v[c] = 1 v [ c ] = 1 , and must also go though a c ′ ∈ C c' \in C c ′ ∈ C so that u [ c ′ ] = 1 u[c'] = 1 u [ c ′ ] = 1 . Because v v v and u u u are orthogonal, c ≠ c ′ c \ne c' c = c ′ , so P P P must go through at least two coordinate nodes. Any two coordinate nodes have distance at least 2 a 2a 2 a from each other. Therefore, the shortest path from v 1 v_1 v 1 to u 3 u_3 u 3 must have the following structure: a path of length at least a a a from v 1 v_1 v 1 to c c c , then a path of length at least 2 a 2a 2 a from c c c to c ′ c' c ′ , then a path of length at least 2 a 2a 2 a from c ′ c' c ′ to u 3 u_3 u 3 . Thus, ecc G ( v 1 ) ≥ 5 a \operatorname{ecc}_G(v_1) \ge5a ecc G ( v 1 ) ≥ 5 a .
Otherwise, suppose v v v is not orthogonal to any other vector. Consider an arbitrary node w ∈ V ( G ) w \in V(G) w ∈ V ( G ) . If w w w lies on a path between u 1 ∈ V 1 u_1 \in V_1 u 1 ∈ V 1 and c ∈ C c \in C c ∈ C , then there is a path of length at most 3 a 3a 3 a from v 1 v_1 v 1 to w w w which takes a length 2 a 2a 2 a path from v 1 v_1 v 1 to u 1 u_1 u 1 , then a path of length at most a a a from u 1 u_1 u 1 to w w w . Similarly, if there is a u u u so that w w w lies on a path between c ∈ C c \in C c ∈ C and u 2 u_2 u 2 , or between u 2 u_2 u 2 and u 3 u_3 u 3 , then there is a length at most 3 a 3a 3 a path from v 1 v_1 v 1 to w w w going through u 2 u_2 u 2 . This exhausts all the cases, so ecc G ( v 1 ) = 3 a \operatorname{ecc}_G(v_1) = 3a ecc G ( v 1 ) = 3 a .
We devise reductions from the above base graph which gives us desired lower-bounds.
Reductions
Proof of Theorem 9.2(i). We assume towards contradiction that there exists such data structure. We build a strongly subquadratic time algorithm for OV as follows. First, construct the graph G e c c G_{\mathrm{ecc}} G ecc which consists of G G G with a ≔ ⌈ 1 / ε ⌉ a \coloneqq\lceil1/\varepsilon\rceil a : = ⌈ 1/ ε ⌉ , along with an additional node s s s . We use our data structure to maintain the eccentricity of s s s in G e c c G_{\mathrm{ecc}} G ecc under the following updates: for each v 1 ∈ V 1 v_1 \in V_1 v 1 ∈ V 1 , we add an edge ( s , v 1 ) (s,v_1) ( s , v 1 ) to G e c c G_{\mathrm{ecc}} G ecc . After each update, we query the ( 5 / 3 − ε ) (5/3 - \varepsilon) ( 5/3 − ε ) -approximate eccentricity of s s s . If, after any update, the data structure returns at least 5 a + 1 5a + 1 5 a + 1 , then we return that there is an orthogonal pair. Otherwise, after all the updates are completed, we return that there is no orthogonal pair.
For each v ∈ V v \in V v ∈ V , insert ( s , v 1 ) (s,v_1) ( s , v 1 ) into the original graph and call the resulting graph G v G_v G v . We observe that if an orthogonal pair ( v , w ) ∈ V (v,w) \in V ( v , w ) ∈ V exists, then ecc G v ( s ) = 1 + ecc G ( v 1 ) ≥ 5 a + 1 \operatorname{ecc}_{G_v}(s) = 1 + \operatorname{ecc}_G(v_1) \ge5a + 1 ecc G v ( s ) = 1 + ecc G ( v 1 ) ≥ 5 a + 1 by 9.3. If no such pair exists, then after every update ecc ( s ) ≤ 3 a + 1 \operatorname{ecc}(s) \le3a + 1 ecc ( s ) ≤ 3 a + 1 . It remains to analyze the runtime. By the OV hypothesis, we can take the dimension of the OV instance to be polylog(N N N ). It follows that the number of edges m m m in G G G is O ( a ⋅ N ⋅ polylog N ) = O ~ ( N ) O(a \cdot N \cdot\operatorname{polylog} N) = \widetilde{O}(N) O ( a ⋅ N ⋅ polylog N ) = O ( N ) if we take a a a to be a constant dependent on ε \varepsilon ε . We make N N N queries to the eccentricity algorithm. Therefore, if there exists a data structure for ( 5 / 3 − ε ) (5/3-\varepsilon) ( 5/3 − ε ) -approximate incremental eccentricity with O ( m 2 − δ ) O(m^{2-\delta}) O ( m 2 − δ ) preprocessing time and O ( m 1 − δ ) O(m^{1-\delta}) O ( m 1 − δ ) query time, then OV can be solved in time O ~ ( N 2 − δ ) \widetilde{O}(N^{2-\delta}) O ( N 2 − δ ) .
Proof of Theorem 9.2(ii). Here is our construction. We create two copies of G G G , called G ( 1 ) G^{(1)} G ( 1 ) and G ( 2 ) G^{(2)} G ( 2 ) . Let V i ( 1 ) V_i^{(1)} V i ( 1 ) and V i ( 2 ) V_i^{(2)} V i ( 2 ) denote the copies of V i V_i V i in G ( 1 ) G^{(1)} G ( 1 ) and G ( 2 ) G^{(2)} G ( 2 ) , respectively. We make the following updates: for each v ( 1 ) ∈ V 1 ( 1 ) v^{(1)} \in V_1^{(1)} v ( 1 ) ∈ V 1 ( 1 ) and corresponding v ( 2 ) ∈ V 1 ( 2 ) v^{(2)} \in V_1^{(2)} v ( 2 ) ∈ V 1 ( 2 ) , we add the edge ( v ( 1 ) , v ( 2 ) ) (v^{(1)},v^{(2)}) ( v ( 1 ) , v ( 2 ) ) . We call the graph after this update G v G_v G v .
Claim 9.4. If there is an orthogonal pair in V V V , then there exists a v v v so that diam ( G v ) ≥ 10 a + 1 \operatorname{diam}(G_v) \ge10a + 1 diam ( G v ) ≥ 10 a + 1 and radius ( G v ) ≥ 5 a + 1 \operatorname{radius}(G_v) \ge5a + 1 radius ( G v ) ≥ 5 a + 1 . Otherwise, for any v v v , diam ( G v ) ≤ 6 a + 1 \operatorname{diam}(G_v) \le6a + 1 diam ( G v ) ≤ 6 a + 1 and radius ( G v ) ≤ 3 a + 1 \operatorname{radius}(G_v) \le3a + 1 radius ( G v ) ≤ 3 a + 1 .
Proof. If v v v is in an orthogonal pair, then by 9.3 ecc G ( 1 ) ( v 1 ( 1 ) ) = ecc G ( 2 ) ( v 1 ( 2 ) ) ≥ 5 a \operatorname{ecc}_{G^{(1)}}(v_1^{(1)}) = \operatorname{ecc}_{G^{(2)}}(v_1^{(2)}) \ge5a ecc G ( 1 ) ( v 1 ( 1 ) ) = ecc G ( 2 ) ( v 1 ( 2 ) ) ≥ 5 a . Let w ( 1 ) w^{(1)} w ( 1 ) be the furthest node from v 1 ( 1 ) v_1^{(1)} v 1 ( 1 ) in G ( 1 ) G^{(1)} G ( 1 ) and w ( 2 ) w^{(2)} w ( 2 ) be the furthest node from v 1 ( 2 ) v_1^{(2)} v 1 ( 2 ) in G ( 2 ) G^{(2)} G ( 2 ) . In the graph G v G_v G v , the only path from w ( 1 ) w^{(1)} w ( 1 ) to w ( 2 ) w^{(2)} w ( 2 ) goes through the edge ( v 1 ( 1 ) , v 1 ( 2 ) ) (v_1^{(1)},v_1^{(2)}) ( v 1 ( 1 ) , v 1 ( 2 ) ) . Therefore, diam ( G v ) ≥ 10 a + 1 \operatorname{diam}(G_v) \ge10a + 1 diam ( G v ) ≥ 10 a + 1 and, moreover, radius ( G v ) ≥ 5 a + 1 \operatorname{radius}(G_v) \ge5a + 1 radius ( G v ) ≥ 5 a + 1 .
Otherwise, suppose there is no orthogonal pair in the OV instance. Then for any graph G v G_v G v , the node v 1 ( 1 ) ∈ V 1 ( 1 ) v_1^{(1)} \in V_1^{(1)} v 1 ( 1 ) ∈ V 1 ( 1 ) has eccentricity at most 3 a + 1 3a + 1 3 a + 1 , so diam ( G v ) ≤ 6 a + 1 \operatorname{diam}(G_v) \le6a + 1 diam ( G v ) ≤ 6 a + 1 and radius ( G v ) ≤ 3 a + 1 \operatorname{radius}(G_v) \le3a + 1 radius ( G v ) ≤ 3 a + 1 .
Following the eccentricity construction, the graph consists of O ~ ( N ) \widetilde{O}(N) O ( N ) edges, and we perform N N N queries. Consequently, the existence of a data structure as described in the statement would yield a contradiction of the OV conjecture.
Lower Bounds for Incremental Algorithms in Directed Graphs
Base graph
As in the undirected case, we set a ≔ ⌈ 1 / ε ⌉ a \coloneqq\lceil1/\varepsilon\rceil a : = ⌈ 1/ ε ⌉ . We construct the base graph G G G as follows. As before, we create three node layers V 1 V_1 V 1 , V 2 V_2 V 2 , and V 3 V_3 V 3 which are copies of the vector set. We also have a layer C C C which is a copy of the coordinate set. For each v 1 ∈ V 1 v_1 \in V_1 v 1 ∈ V 1 , c ∈ C c \in C c ∈ C , we add an edge ( v , c ) (v,c) ( v , c ) if v [ c ] = 1 v[c] = 1 v [ c ] = 1 . For each u ∈ V 2 u \in V_2 u ∈ V 2 , we add a directed path of a a a edges from c c c to u u u if u [ c ] = 1 u[c] = 1 u [ c ] = 1 . For each edge ( x , y ) (x,y) ( x , y ) in this path, we add an additional edge ( y , x ) (y,x) ( y , x ) , so the path is directed in both directions. For any pair of nodes v 2 ∈ V 2 v_2 \in V_2 v 2 ∈ V 2 and v 3 ∈ V 3 v_3 \in V_3 v 3 ∈ V 3 which correspond to the same vector, we add a path of length a a a from v 2 v_2 v 2 to v 3 v_3 v 3 . Lastly, for each v ∈ V v \in V v ∈ V , we add a path of a a a edges from v 2 v_2 v 2 to v 1 v_1 v 1 .
Lemma 9.5. Let v ∈ V v \in V v ∈ V be in an orthogonal pair. Then ecc G ( v 1 ) ≥ 4 a + 1 \operatorname{ecc}_G(v_1) \ge4a + 1 ecc G ( v 1 ) ≥ 4 a + 1 . Otherwise, ecc G ( v 1 ) ≤ 2 a + 1 \operatorname{ecc}_G(v_1) \le2a + 1 ecc G ( v 1 ) ≤ 2 a + 1 .
Proof. Suppose ( v , u ) (v,u) ( v , u ) is an orthogonal pair. Observe that any path from v 1 v_1 v 1 to u 3 u_3 u 3 goes through a c ∈ C c \in C c ∈ C so that v [ c ] = 1 v[c] = 1 v [ c ] = 1 and a c ′ ∈ C c' \in C c ′ ∈ C so u [ c ′ ] = 1 u[c'] = 1 u [ c ′ ] = 1 . Because v v v and u u u are orthogonal, c ≠ c ′ c \ne c' c = c ′ . Moreover, the distance between any two nodes in C C C is 2 a 2a 2 a , as any such path must go through V 2 V_2 V 2 then back to C C C . Therefore, the shortest path from v 1 v_1 v 1 to u 3 u_3 u 3 consists of the edge ( v , c ) (v,c) ( v , c ) , then a path of length 2 a 2a 2 a to c ′ c' c ′ , then a path of length 2 a 2a 2 a to u 3 u_3 u 3 , so ecc G ( v 1 ) ≥ 4 a + 1 \operatorname{ecc}_G(v_1) \ge4a + 1 ecc G ( v 1 ) ≥ 4 a + 1 .
Otherwise, suppose v v v is not in an orthogonal pair. Let w w w be a node in G G G . If there is a u ∈ V u \in V u ∈ V so that w = u 1 ∈ V 1 w = u_1 \in V_1 w = u 1 ∈ V 1 , then there is a path of length 2 a + 1 2a + 1 2 a + 1 from v 1 v_1 v 1 to w w w that first goes to u 2 u_2 u 2 , then back to u 1 u_1 u 1 through the length a a a path from u 2 u_2 u 2 to u 1 u_1 u 1 . If w w w is in a path between C C C and V 2 V_2 V 2 , then there is a length at most 2 a + 1 2a + 1 2 a + 1 path from v 1 v_1 v 1 to w w w which goes through some u 2 ∈ V 2 u_2 \in V_2 u 2 ∈ V 2 so that u [ c ] = 1 u[c] = 1 u [ c ] = 1 . If w w w is a node in a path from some u 2 ∈ V 2 u_2 \in V_2 u 2 ∈ V 2 to u 1 ∈ V 1 u_1 \in V_1 u 1 ∈ V 1 , then there is a length at most 2 a + 1 2a + 1 2 a + 1 path from v 1 v_1 v 1 to w w w which goes through u 2 u_2 u 2 . Lastly, if w w w is a node in a path from u 2 ∈ V 2 u_2 \in V_2 u 2 ∈ V 2 to u 3 ∈ V 3 u_3 \in V_3 u 3 ∈ V 3 , then there is a length at most 2 a + 1 2a + 1 2 a + 1 path from v 1 v_1 v 1 to w w w which goes through u 2 u_2 u 2 . This exhausts all the cases, so ecc G ( v 1 ) ≤ 2 a + 1 \operatorname{ecc}_G(v_1) \le2a + 1 ecc G ( v 1 ) ≤ 2 a + 1 .
Reductions
Our first reduction gives us a lower bound for single-source eccentricity and radius.
Proof of Theorem 9.2(iii). We build our reduction from the graph G \mathbf{G} G defined above. We add a node s s s disconnected from the rest of the graph. We make N N N updates: for each v ∈ V v \in V v ∈ V , we add the edge ( s , v 1 ) (s,v_1) ( s , v 1 ) .
We observe that if v v v is in an orthogonal pair, then ecc G v ( s ) ≥ 4 a + 2 \operatorname{ecc}_{G_v}(s) \ge4a+2 ecc G v ( s ) ≥ 4 a + 2 . Otherwise, ecc G v ( s ) ≤ 2 a + 2 \operatorname{ecc}_{G_v}(s) \le2a+2 ecc G v ( s ) ≤ 2 a + 2 . This is because v 1 v_1 v 1 is the only out-neighbor of s s s in G v G_v G v , ecc G v ( s ) = ecc G ( v 1 ) + 1 \operatorname{ecc}_{G_v}(s) = \operatorname{ecc}_{G}(v_1)+1 ecc G v ( s ) = ecc G ( v 1 ) + 1 , so ecc G v ( s ) = 4 a + 2 \operatorname{ecc}_{G_v}(s) = 4a+2 ecc G v ( s ) = 4 a + 2 if v v v is in an orthogonal pair and ecc G v ( s ) = 2 a + 2 \operatorname{ecc}_{G_v}(s) = 2a+2 ecc G v ( s ) = 2 a + 2 otherwise.
The reduction gives us a lower bound for maintaining either the eccentricity or the radius of the graph. We get the radius lower-bound because s s s has in-degree 0 0 0 , so every node in G v G_v G v other than s s s has eccentricity ∞ \infty ∞ , so s s s is the center. Therefore, the radius of G v G_v G v is simply ecc G v ( s ) \operatorname{ecc}_{G_v}(s) ecc G v ( s ) . The runtime analysis is similar to that of the undirected case.
Proof of Theorem 9.2(iv). We create a copy of the graph G \mathbf{G} G with the edge orientations reversed, which we call G ( 1 ) G^{(1)} G ( 1 ) . We create a second copy of G \mathbf{G} G with the edge orientations in the original direction, which we call G ( 2 ) G^{(2)} G ( 2 ) . We add an additional node q q q to G \mathbf{G} G . For every x ∈ G ( 1 ) x \in G^{(1)} x ∈ G ( 1 ) , we add an edge ( q , x ) (q,x) ( q , x ) , and for every y ∈ G ( 2 ) y \in G^{(2)} y ∈ G ( 2 ) , we add the edge ( y , q ) (y,q) ( y , q ) . Let V i ( 1 ) V_i^{(1)} V i ( 1 ) be the copy of V i V_i V i in G ( 1 ) G^{(1)} G ( 1 ) , and V i ( 2 ) V_i^{(2)} V i ( 2 ) the copy of V i V_i V i in G ( 2 ) G^{(2)} G ( 2 ) .
The queries we make are as follows. For each v ( 1 ) ∈ V 1 ( 1 ) v^{(1)} \in V_1^{(1)} v ( 1 ) ∈ V 1 ( 1 ) and corresponding v ( 2 ) ∈ V 1 ( 2 ) v^{(2)} \in V_1^{(2)} v ( 2 ) ∈ V 1 ( 2 ) , we add the edge ( v ( 1 ) , v ( 2 ) ) (v^{(1)},v^{(2)}) ( v ( 1 ) , v ( 2 ) ) . We call the graph after this update G v G_v G v .
Claim 9.6. If v v v is in an orthogonal pair, then diam ( G v ) ≥ 8 a + 3 \operatorname{diam}(G_v) \ge8a+3 diam ( G v ) ≥ 8 a + 3 . Otherwise, diam ( G v ) ≤ 4 a + 3 \operatorname{diam}(G_v) \le4a+3 diam ( G v ) ≤ 4 a + 3 .
Proof. Suppose v v v is in an orthogonal pair. For any pair x ∈ G ( 1 ) x \in G^{(1)} x ∈ G ( 1 ) and y ∈ G ( 2 ) y \in G^{(2)} y ∈ G ( 2 ) , the only path from x x x to y y y in G v G_v G v goes through the edge ( v 1 ( 1 ) , v 1 ( 2 ) ) (v^{(1)}_1,v^{(2)}_1) ( v 1 ( 1 ) , v 1 ( 2 ) ) . By Lemma 9.5 , there is a choice of x ∈ G ( 1 ) x \in G^{(1)} x ∈ G ( 1 ) so that d ( x , v 1 ( 1 ) ) ≥ 4 a + 1 d(x,v^{(1)}_1) \ge4a+1 d ( x , v 1 ( 1 ) ) ≥ 4 a + 1 , and y ∈ G ( 2 ) y \in G^{(2)} y ∈ G ( 2 ) so that d ( v 1 ( 2 ) , y ) ≥ 4 a + 1 d(v^{(2)}_1,y) \ge4a+1 d ( v 1 ( 2 ) , y ) ≥ 4 a + 1 . It follows that d ( x , y ) ≥ 8 a + 3 d(x,y) \ge8a+3 d ( x , y ) ≥ 8 a + 3 .
Otherwise, suppose there is no orthogonal pair. Consider two nodes x x x and y y y . We consider four cases:
x ∈ G ( 1 ) x \in G^{(1)} x ∈ G ( 1 ) and y ∈ G ( 2 ) ∪ { q } y \in G^{(2)} \cup\{q\} y ∈ G ( 2 ) ∪ { q } . By Lemma 9.5 , there is a path from x x x to v 1 ( 1 ) v^{(1)}_1 v 1 ( 1 ) of length at most 2 a + 1 2a+1 2 a + 1 and a path from v 1 ( 2 ) v^{(2)}_1 v 1 ( 2 ) to y y y of length at most 2 a + 1 2a+1 2 a + 1 , so d ( x , y ) ≤ 4 a + 3 d(x,y) \le4a+3 d ( x , y ) ≤ 4 a + 3 .
x ∈ G ( 2 ) ∪ { q } x \in G^{(2)} \cup\{q\} x ∈ G ( 2 ) ∪ { q } and y ∈ G ( 1 ) y \in G^{(1)} y ∈ G ( 1 ) . Then there is a path of length at most 2 2 2 from x x x to y y y going through q q q .
x ∈ G ( 1 ) x \in G^{(1)} x ∈ G ( 1 ) and y ∈ G ( 1 ) y \in G^{(1)} y ∈ G ( 1 ) . By Lemma 9.5 , there is a path from x x x to v 1 ( 1 ) v^{(1)}_1 v 1 ( 1 ) of length at most 2 a + 1 2a+1 2 a + 1 . The distance from v 1 ( 1 ) v^{(1)}_1 v 1 ( 1 ) to any node in G ( 1 ) G^{(1)} G ( 1 ) is at most 3 3 3 , as there is a path going through v 1 ( 2 ) v^{(2)}_1 v 1 ( 2 ) , then q q q , so d ( x , y ) ≤ 2 a + 4 d(x,y) \le2a+4 d ( x , y ) ≤ 2 a + 4 .
x ∈ G ( 2 ) ∪ { q } x \in G^{(2)} \cup\{q\} x ∈ G ( 2 ) ∪ { q } and y ∈ G ( 2 ) ∪ { q } y \in G^{(2)} \cup\{q\} y ∈ G ( 2 ) ∪ { q } . Then d ( x , v 1 ( 2 ) ) ≤ 3 d(x,v^{(2)}_1) \le3 d ( x , v 1 ( 2 ) ) ≤ 3 , as there is a path going through q q q then v 1 ( 1 ) v^{(1)}_1 v 1 ( 1 ) . By Lemma 9.5 , d ( v 1 ( 2 ) , y ) ≤ 2 a + 1 d(v^{(2)}_1,y) \le2a+1 d ( v 1 ( 2 ) , y ) ≤ 2 a + 1 , so d ( x , y ) ≤ 2 a + 4 d(x,y) \le2a+4 d ( x , y ) ≤ 2 a + 4 .
The runtime analysis is again similar to that of the undirected case.
Bibliography
An Improved Reduction for Exact Decremental Eccentricities
In this appendix, we improve the preprocessing time of Theorem 1 (iii) for all-node exact decremental eccentricities from P + T + O ~ ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) \mathsf{P}+\mathsf{T}+\widetilde{O}(n^{2+(7-\omega)/(10-2\omega)})=\mathsf{P}+\mathsf{T}+O(n^{2.88}) P + T + O ( n 2 + ( 7 − ω ) / ( 10 − 2 ω ) ) = P + T + O ( n 2.88 ) to P + T + O ~ ( n 2 + ρ ) \mathsf{P}+\mathsf{T}+\widetilde{O}(n^{2+\rho}) P + T + O ( n 2 + ρ ) , where ρ ∈ [ 0 , 1 ] \rho\in[0,1] ρ ∈ [ 0 , 1 ] be a constant such that ω ( 1 , ρ , 1 ) ≤ 3 ρ \omega(1,\rho,1)\le3\rho ω ( 1 , ρ , 1 ) ≤ 3 ρ . With the current bounds on rectangular matrix multiplication, this yields P + T + O ( n 2.7228 ) \mathsf{P}+\mathsf{T}+O(n^{2.7228}) P + T + O ( n 2.7228 ) .
The improvement has two ingredients. First, we replace Lemma 4.7 by a lemma that computes the values max y ∈ R x , i d G ∖ e i ( x , y ) \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y) max y ∈ R x , i d G ∖ e i ( x , y ) (the bottleneck identified in § 5.1 ) with a single max-min product, instead of ⌈ h / Δ ⌉ \lceil h/\Delta\rceil ⌈ h /Δ ⌉ products together with O ( Δ ⋅ ∣ P ∣ ) O(\Delta\cdot|P|) O ( Δ ⋅ ∣ P ∣ ) additional DSO queries (Lemma A.2 ). This allows us to combine the exact computation of eccentricities with the priority-based decomposition used in the proof of Theorem 1 (i) and Theorem 1 (ii), instead of the single sampling rate used for (iii). Second, in order to profit from this decomposition, we need a bound on the max-min product of rectangular matrices that keeps track of the shape of the matrices (Lemma A.1 ), rather than the bound obtained by partitioning into square blocks that we used in § 6 .
AI Acknowledgment. The improvement described in this appendix has been found by OpenAI’s language model ChatGPT Astra. Since the improvements are simple and neat, we decided to report them here. Claude Opus 5.5 has been used to assist in the rewriting of the appendix.
Further Preliminaries. For positive integers p , q , r p,q,r p , q , r , let T M M ( p , q , r ) \mathrm{TMM}(p,q,r) TMM ( p , q , r ) denote the time to multiply a p × q p\times q p × q by a q × r q\times r q × r Boolean matrix, and for reals α , β , γ ≥ 0 \alpha,\beta,\gamma\ge0 α , β , γ ≥ 0 let ω ( α , β , γ ) \omega(\alpha,\beta,\gamma) ω ( α , β , γ ) be the corresponding exponent, i.e., T M M ( n α , n β , n γ ) = n ω ( α , β , γ ) + o ( 1 ) \mathrm{TMM}(n^\alpha,n^\beta,n^\gamma)=n^{\omega(\alpha,\beta,\gamma)+o(1)} TMM ( n α , n β , n γ ) = n ω ( α , β , γ ) + o ( 1 ) . Recall that ω ( α , β , γ ) \omega(\alpha,\beta,\gamma) ω ( α , β , γ ) is symmetric in its arguments, that ω = ω ( 1 , 1 , 1 ) \omega=\omega(1,1,1) ω = ω ( 1 , 1 , 1 ) , and that ω ( 1 , ρ , 1 ) ≥ 2 \omega(1,\rho,1)\ge2 ω ( 1 , ρ , 1 ) ≥ 2 for all ρ ≥ 0 \rho\ge0 ρ ≥ 0 . Instead of partitioning max-min products into square blocks as in § 6 , we use the following dimension-aware bound.
Lemma A.1 (Generalization of [DP09]). For all positive integers p , q , r p,q,r p , q , r , we have
\mathrm{T}_{\mathrm{max\mathchar`-min}}(p,q,r)=\widetilde{O}\left(pq+qr+pr+\sqrt{pqr\cdot\mathrm{TMM}(p,q,r)}\right).
Thus, for α , β , γ ∈ [ 0 , 1 ] \alpha,\beta,\gamma\in[0,1] α , β , γ ∈ [ 0 , 1 ] , we have \mathrm{T}_{\mathrm{max\mathchar`-min}}(n^\alpha,n^\beta,n^\gamma)=\widetilde{O}(n^{\alpha+\beta}+n^{\beta+\gamma}+n^{\alpha+\gamma}+n^{(\alpha+\beta+\gamma+\omega(\alpha,\beta,\gamma))/2}) .
The lemma follows from the algorithm of Duan and Pettie [DP09], which reduces the max-min product to O ( s ) O(s) O ( s ) Boolean products of O ( p ) × O ( q ) O(p)\times O(q) O ( p ) × O ( q ) and O ( q ) × r O(q)\times r O ( q ) × r matrices plus O ( p q r / s ) O(pqr/s) O ( pq r / s ) comparisons, by tracking the dimensions and choosing s = p q r / T M M ( p , q , r ) s=\sqrt{pqr/\mathrm{TMM}(p,q,r)} s = pq r / TMM ( p , q , r ) .
Improving Lemma 4.7 via a Single max-min Product
We first improve upon Lemma 4.7, which divides the edges of π G ( a , b ) \pi_G(a,b) π G ( a , b ) into blocks of Δ \Delta Δ edges, by noticing that we can use the lexicographic order cleverly to get by with a single max-min product.
Lemma A.2 (Compare with Lemma 4.7). Let P , a , b , X , Y , h P,a,b,X,Y,h P , a , b , X , Y , h be as in Definition 4.1 , and suppose that we are given the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) . Then, in time O(|P|\log n+h(|X|+|Y|)\log n+\mathrm{T}_{\mathrm{max\mathchar`-min}}(|X|,|Y|,h)) , we can compute for each x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] the value max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) .
Proof. Let ℓ ( x , y ) , r ( x , y ) \ell(x,y),r(x,y) ℓ ( x , y ) , r ( x , y ) be as in Corollary 4.3, let L x , i , C x , i L_{x,i},C_{x,i} L x , i , C x , i be as in Lemma 4.4, and let R x , i : = { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) . . h ] } R_{x,i}:=\{y:(x,y)\in P,i\in(r(x,y)..h]\} R x , i := { y : ( x , y ) ∈ P , i ∈ ( r ( x , y ) .. h ]} . As in the proof of Lemma 4.6, max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) \max_{y:(x,y)\in P}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P d G ∖ e i ( x , y ) is the maximum of the corresponding maxima over L x , i L_{x,i} L x , i , C x , i C_{x,i} C x , i and R x , i R_{x,i} R x , i . Using Lemma 4.2 , Corollary 4.3 and Lemma 4.4, we compute the values d ~ G ∖ e i ( ⋅ , ⋅ ) \widetilde d_{G\setminus e_i}(\cdot,\cdot) d G ∖ e i ( ⋅ , ⋅ ) , the indices ℓ ( x , y ) , r ( x , y ) \ell(x,y),r(x,y) ℓ ( x , y ) , r ( x , y ) for all ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P (by binary search over i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] ), and the maxima over L x , i L_{x,i} L x , i and C x , i C_{x,i} C x , i for all x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] , in time O ( ( ∣ P ∣ log n + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) O((|P|\log n+h(|X|+|Y|)\log n) O (( ∣ P ∣ log n + h ( ∣ X ∣ + ∣ Y ∣ ) log n ) . It remains to compute, for each x ∈ X x\in X x ∈ X and i ∈ [ 1.. h ] i\in[1..h] i ∈ [ 1.. h ] , the value
max y ∈ R x , i d G ∖ e i ( x , y ) = d G ( x , a ) + max y ∈ R x , i d G ∖ e i ( a , y ) , (13) \max_{y\in R_{x,i}}d_{G\setminus e_i}(x,y)=d_G(x,a)+\max_{y\in R_{x,i}}d_{G\setminus e_i}(a,y), \tag*{(13)} y ∈ R x , i max d G ∖ e i ( x , y ) = d G ( x , a ) + y ∈ R x , i max d G ∖ e i ( a , y ) , (13)
where the equality is by Corollary 4.3 and the maximum is − ∞ -\infty − ∞ if R x , i = ∅ R_{x,i}=\varnothing R x , i = ∅ . For ( x , y ) ∈ P (x,y) \in P ( x , y ) ∈ P , let t ( x , y ) : = r ( x , y ) + 1 t(x,y) := r(x,y) + 1 t ( x , y ) := r ( x , y ) + 1 be the smallest index i i i with y ∈ R x , i y \in R_{x,i} y ∈ R x , i . We consider pairs ( α , β ) (\alpha,\beta) ( α , β ) with α ∈ Z ∪ { − ∞ } \alpha\in\mathbb{Z} \cup\{-\infty\} α ∈ Z ∪ { − ∞ } and β ∈ R ∪ { − ∞ , + ∞ } \beta\in\mathbb{R} \cup\{-\infty,+\infty\} β ∈ R ∪ { − ∞ , + ∞ } , ordered lexicographically, and let ⊥ : = ( − ∞ , − ∞ ) \perp:= (-\infty,-\infty) ⊥:= ( − ∞ , − ∞ ) be the smallest such pair. We define the ∣ X ∣ × ∣ Y ∣ |X| \times|Y| ∣ X ∣ × ∣ Y ∣ matrix A A A and the ∣ Y ∣ × h |Y| \times h ∣ Y ∣ × h matrix B B B with entries from this ordered set as
A [ x , y ] : = { ( − t ( x , y ) , + ∞ ) if ( x , y ) ∈ P , ⊥ otherwise ; for x ∈ X , y ∈ Y , A[x,y] := \begin{cases}
(-t(x,y),+\infty) & \text{if } (x,y) \in P,\\
\perp& \text{otherwise};
\end{cases}
\qquad\text{for } x \in X,y \in Y, A [ x , y ] := { ( − t ( x , y ) , + ∞ ) ⊥ if ( x , y ) ∈ P , otherwise ; for x ∈ X , y ∈ Y ,
B [ y , i ] : = ( − i , d G ∖ e i ( a , y ) ) for y ∈ Y , i ∈ [ 1 … h ] , B[y,i] := (-i,d_{G\setminus e_i}(a,y))
\qquad\text{for } y \in Y,i \in[1\ldots h], B [ y , i ] := ( − i , d G ∖ e i ( a , y )) for y ∈ Y , i ∈ [ 1 … h ] ,
and compute M : = A ∨ B M := A \mathbin{\mathop{\vee}} B M := A ∨ B , where minima and maxima are taken with respect to the lexicographic order.
Correctness: Fix x ∈ X x \in X x ∈ X and i ∈ [ 1 … h ] i \in[1\ldots h] i ∈ [ 1 … h ] , and let y ∈ Y y \in Y y ∈ Y . If y ∈ R x , i y \in R_{x,i} y ∈ R x , i , then ( x , y ) ∈ P (x,y) \in P ( x , y ) ∈ P and t ( x , y ) ≤ i t(x,y) \le i t ( x , y ) ≤ i , so the first coordinate of A [ x , y ] A[x,y] A [ x , y ] is at least − i -i − i , and thus min { A [ x , y ] , B [ y , i ] } = B [ y , i ] = ( − i , d G ∖ e i ( a , y ) ) \min\{A[x,y],B[y,i]\} = B[y,i] = (-i,d_{G\setminus e_i}(a,y)) min { A [ x , y ] , B [ y , i ]} = B [ y , i ] = ( − i , d G ∖ e i ( a , y )) (note that the second coordinate of A [ x , y ] A[x,y] A [ x , y ] is + ∞ +\infty + ∞ , which settles the case t ( x , y ) = i t(x,y)=i t ( x , y ) = i ). If y ∉ R x , i y \notin R_{x,i} y ∈ / R x , i , then either ( x , y ) ∉ P (x,y) \notin P ( x , y ) ∈ / P and min { A [ x , y ] , B [ y , i ] } = ⊥ \min\{A[x,y],B[y,i]\} = \perp min { A [ x , y ] , B [ y , i ]} =⊥ , or t ( x , y ) > i t(x,y)>i t ( x , y ) > i and min { A [ x , y ] , B [ y , i ] } = A [ x , y ] \min\{A[x,y],B[y,i]\}=A[x,y] min { A [ x , y ] , B [ y , i ]} = A [ x , y ] ; in both cases, the first coordinate of the minimum is smaller than − i -i − i . Consequently, M [ x , i ] = ( − i , max y ∈ R x , i d G ∖ e i ( a , y ) ) M[x,i] = (-i,\max_{y\in R_{x,i}} d_{G\setminus e_i}(a,y)) M [ x , i ] = ( − i , max y ∈ R x , i d G ∖ e i ( a , y )) if R x , i ≠ ∅ R_{x,i} \ne\emptyset R x , i = ∅ and the first coordinate of M [ x , i ] M[x,i] M [ x , i ] is smaller than − i -i − i otherwise. Hence, we can read off Equation (13) from M [ x , i ] M[x,i] M [ x , i ] in O ( 1 ) O(1) O ( 1 ) time.
Runtime: A max-min product only compares entries with each other. Therefore, we can sort the at most ∣ P ∣ + h ∣ Y ∣ + 1 |P|+h|Y|+1 ∣ P ∣ + h ∣ Y ∣ + 1 distinct pairs appearing in A A A and B B B in time O ( ( ∣ P ∣ + h ∣ Y ∣ ) log n ) O((|P|+h|Y|)\log n) O (( ∣ P ∣ + h ∣ Y ∣ ) log n ) , replace every entry by its rank in the sorted order, compute the max-min product of the resulting integer matrices in time T m a x - m i n ( ∣ X ∣ , ∣ Y ∣ , h ) T_{\mathrm{max\text{-}min}}(|X|,|Y|,h) T max - min ( ∣ X ∣ , ∣ Y ∣ , h ) , and translate the ranks in the result back into pairs.
The Improved Reduction
Theorem A.3. Let G G G be a graph (directed or undirected, weighted or unweighted) with n n n nodes. Suppose it takes time P P P to construct a DSO for G G G with query time O ( 1 ) O(1) O ( 1 ) , and it takes time T T T to compute a set of canonical shortest paths on G G G . Let ρ ∈ [ 0 , 1 ] \rho\in[0,1] ρ ∈ [ 0 , 1 ] be a constant such that ω ( 1 , ρ , 1 ) ≤ 3 ρ \omega(1,\rho,1) \le3\rho ω ( 1 , ρ , 1 ) ≤ 3 ρ . Then, we can solve all-node decremental eccentricities on G G G with P + T + O ~ ( n 2 + ρ ) P+T+\tilde{O}(n^{2+\rho}) P + T + O ~ ( n 2 + ρ ) preprocessing and O ( 1 ) O(1) O ( 1 ) query time. In particular, the current bounds on rectangular matrix multiplication [ADV+25] allow ρ = 0.7228 \rho= 0.7228 ρ = 0.7228 , which gives P + T + O ~ ( n 2.7228 ) P+T+\tilde{O}(n^{2.7228}) P + T + O ~ ( n 2.7228 ) preprocessing time.
Proof. We first note that the hypothesis ω ( 1 , ρ , 1 ) ≤ 3 ρ \omega(1,\rho,1) \le3\rho ω ( 1 , ρ , 1 ) ≤ 3 ρ implies ρ ≥ 2 / 3 \rho\ge2/3 ρ ≥ 2/3 , since ω ( 1 , ρ , 1 ) ≥ 2 \omega(1,\rho,1) \ge2 ω ( 1 , ρ , 1 ) ≥ 2 .
We use the priority-based decomposition from the proof of Theorem 1 (i) and (ii): every vertex receives a priority k ∈ [ 1 … p ] k \in[1\ldots p] k ∈ [ 1 … p ] with p = Θ ( log n ) p=\Theta(\log n) p = Θ ( log n ) , every pair ( x , y ) ∈ V × V (x,y) \in V \times V ( x , y ) ∈ V × V is assigned to O ( log n ) O(\log n) O ( log n ) pairs ( a , b ) (a,b) ( a , b ) of consecutive centers on π G ( x , y ) \pi_G(x,y) π G ( x , y ) , and for every ( a , b ) ∈ V × V (a,b) \in V \times V ( a , b ) ∈ V × V the sets P ( a , b ) , X ( a , b ) , Y ( a , b ) P(a,b),X(a,b),Y(a,b) P ( a , b ) , X ( a , b ) , Y ( a , b ) and the number h ( a , b ) h(a,b) h ( a , b ) are defined as there. Whenever P ( a , b ) ≠ ∅ P(a,b) \ne\emptyset P ( a , b ) = ∅ , the triple ( P ( a , b ) , a , b ) (P(a,b),a,b) ( P ( a , b ) , a , b ) satisfies the assumptions of Definition 4.1 . Recall from the runtime analysis of Theorem 1 (i) that h ( a , b ) = O ( 2 k log n ) h(a,b)=O(2^k\log n) h ( a , b ) = O ( 2 k log n ) whenever a a a or b b b has priority k k k and P ( a , b ) ≠ ∅ P(a,b) \ne\emptyset P ( a , b ) = ∅ , that for fixed a ∈ V a \in V a ∈ V the sets Y ( a , b ) Y(a,b) Y ( a , b ) with b ∈ V b \in V b ∈ V are pairwise disjoint, and that for fixed b ∈ V b \in V b ∈ V the sets X ( a , b ) X(a,b) X ( a , b ) with a ∈ V a \in V a ∈ V are pairwise disjoint. Together with ∣ R k ∣ = O ( n / 2 k ⋅ log n ) |R_k|=O(n/2^k\cdot\log n) ∣ R k ∣ = O ( n / 2 k ⋅ log n ) , exactly as there, these facts imply
∑ ( a , b ) ∣ P ( a , b ) ∣ = O ~ ( n 2 ) , ∑ ( a , b ) h ( a , b ) ⋅ ∣ X ( a , b ) ∣ = O ~ ( n 2 ) , ∑ ( a , b ) h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ = O ~ ( n 2 ) , (14) \sum_{(a,b)} |P(a,b)| = \widetilde{O}(n^2), \qquad
\sum_{(a,b)} h(a,b)\cdot|X(a,b)| = \widetilde{O}(n^2), \qquad
\sum_{(a,b)} h(a,b)\cdot|Y(a,b)| = \widetilde{O}(n^2), \tag*{(14)} ( a , b ) ∑ ∣ P ( a , b ) ∣ = O ( n 2 ) , ( a , b ) ∑ h ( a , b ) ⋅ ∣ X ( a , b ) ∣ = O ( n 2 ) , ( a , b ) ∑ h ( a , b ) ⋅ ∣ Y ( a , b ) ∣ = O ( n 2 ) , (14)
where the sums range over all ( a , b ) ∈ V × V (a,b) \in V \times V ( a , b ) ∈ V × V with P ( a , b ) ≠ ∅ P(a,b) \ne\emptyset P ( a , b ) = ∅ .
Algorithm: For every x ∈ V x \in V x ∈ V and every edge e e e that lies on some canonical shortest path π G ( x , y ) \pi_G(x,y) π G ( x , y ) , we compute ecc G ∖ e ( x ) \operatorname{ecc}_{G\setminus e}(x) ecc G ∖ e ( x ) as the maximum of ecc G ( x ) \operatorname{ecc}_G(x) ecc G ( x ) and the values
max y : ( x , y ) ∈ P ( a , b ) d G ∖ e ( x , y ) for all ( a , b ) ∈ V × V with x ∈ X ( a , b ) and e ∈ π G ( a , b ) . \max_{\substack{y:(x,y)\in P(a,b)}} d_{G\setminus e}(x,y)
\qquad\text{for all } (a,b) \in V \times V \text{ with } x \in X(a,b) \text{ and } e \in\pi_G(a,b). y : ( x , y ) ∈ P ( a , b ) max d G ∖ e ( x , y ) for all ( a , b ) ∈ V × V with x ∈ X ( a , b ) and e ∈ π G ( a , b ) .
This is correct: If e ∉ π G ( x , y ) e \notin\pi_G(x,y) e ∈ / π G ( x , y ) , then d G ∖ e ( x , y ) = d G ( x , y ) ≤ ecc G ( x ) d_{G\setminus e}(x,y)=d_G(x,y)\leq\operatorname{ecc}_G(x) d G ∖ e ( x , y ) = d G ( x , y ) ≤ ecc G ( x ) . Otherwise, e e e lies on exactly one of the segments π G ( a , b ) \pi_G(a,b) π G ( a , b ) to which ( x , y ) (x,y) ( x , y ) is assigned, and for this segment we have x ∈ X ( a , b ) x\in X(a,b) x ∈ X ( a , b ) and ( x , y ) ∈ P ( a , b ) (x,y)\in P(a,b) ( x , y ) ∈ P ( a , b ) . For all other edges e e e , we have ecc G ∖ e ( x ) = ecc G ( x ) \operatorname{ecc}_{G\setminus e}(x)=\operatorname{ecc}_G(x) ecc G ∖ e ( x ) = ecc G ( x ) . As the canonical shortest paths starting at x x x form a tree, we store O ( n ) O(n) O ( n ) values per node x x x , and a query ( x , e ) (x,e) ( x , e ) is answered in O ( 1 ) O(1) O ( 1 ) time.
It remains to compute, for every ( a , b ) ∈ V × V (a,b)\in V\times V ( a , b ) ∈ V × V with P ( a , b ) ≠ ∅ P(a,b)\neq\varnothing P ( a , b ) = ∅ , every x ∈ X ( a , b ) x\in X(a,b) x ∈ X ( a , b ) and every e i ∈ π G ( a , b ) e_i\in\pi_G(a,b) e i ∈ π G ( a , b ) , the value max y : ( x , y ) ∈ P ( a , b ) d G ∖ e i ( x , y ) \max_{y:(x,y)\in P(a,b)}d_{G\setminus e_i}(x,y) max y : ( x , y ) ∈ P ( a , b ) d G ∖ e i ( x , y ) . To simplify notation, we fix ( a , b ) (a,b) ( a , b ) and write P P P , X X X , Y Y Y , h h h for P ( a , b ) P(a,b) P ( a , b ) , X ( a , b ) X(a,b) X ( a , b ) , Y ( a , b ) Y(a,b) Y ( a , b ) , h ( a , b ) h(a,b) h ( a , b ) . We distinguish two cases.
If min { ∣ X ∣ , ∣ Y ∣ , h } ≤ n ρ \min\{|X|,|Y|,h\}\leq n^\rho min { ∣ X ∣ , ∣ Y ∣ , h } ≤ n ρ , we query d G ∖ e i ( x , y ) d_{G\setminus e_i}(x,y) d G ∖ e i ( x , y ) from the DSO for every ( x , y ) ∈ P (x,y)\in P ( x , y ) ∈ P and i ∈ [ 1 … h ] i\in[1\ldots h] i ∈ [ 1 … h ] , and take the maxima directly. This takes O ( h ⋅ ∣ P ∣ ) O(h\cdot|P|) O ( h ⋅ ∣ P ∣ ) time.
Otherwise, we obtain the relevant values w.r.t. ( P , a , b ) (P,a,b) ( P , a , b ) with O ~ ( ∣ P ~ ∣ + h ( ∣ X ∣ + ∣ Y ∣ ) ) \widetilde{O}(|\widetilde{P}|+h(|X|+|Y|)) O ( ∣ P ∣ + h ( ∣ X ∣ + ∣ Y ∣ )) DSO queries (see the discussion after Definition 4.1 ) and apply Lemma A.2 . This takes O ~ ( ∣ P ~ ∣ + h ( ∣ X ∣ + ∣ Y ∣ ) ) + T max - min ( ∣ X ∣ , ∣ Y ∣ , h ) \widetilde{O}(|\widetilde{P}|+h(|X|+|Y|))+\mathrm{T}_{\max\text{-}\min}(|X|,|Y|,h) O ( ∣ P ∣ + h ( ∣ X ∣ + ∣ Y ∣ )) + T m a x - m i n ( ∣ X ∣ , ∣ Y ∣ , h ) time.
Runtime: The total time spent in Case (1) is O ~ ( n 2 + ρ ) \widetilde{O}(n^{2+\rho}) O ( n 2 + ρ ) : For pairs ( a , b ) (a,b) ( a , b ) with h ≤ n ρ h\leq n^\rho h ≤ n ρ we bound h ⋅ ∣ P ∣ ≤ n ρ ⋅ ∣ P ∣ h\cdot|P|\leq n^\rho\cdot|P| h ⋅ ∣ P ∣ ≤ n ρ ⋅ ∣ P ∣ ; for pairs with ∣ Y ∣ ≤ n ρ |Y|\leq n^\rho ∣ Y ∣ ≤ n ρ we bound h ⋅ ∣ P ∣ ≤ h ⋅ ∣ X ∣ ⋅ ∣ Y ∣ ≤ n ρ ⋅ h ⋅ ∣ X ∣ h\cdot|P|\leq h\cdot|X|\cdot|Y|\leq n^\rho\cdot h\cdot|X| h ⋅ ∣ P ∣ ≤ h ⋅ ∣ X ∣ ⋅ ∣ Y ∣ ≤ n ρ ⋅ h ⋅ ∣ X ∣ ; and for pairs with ∣ X ∣ ≤ n ρ |X|\leq n^\rho ∣ X ∣ ≤ n ρ we bound h ⋅ ∣ P ∣ ≤ n ρ ⋅ h ⋅ ∣ Y ∣ h\cdot|P|\leq n^\rho\cdot h\cdot|Y| h ⋅ ∣ P ∣ ≤ n ρ ⋅ h ⋅ ∣ Y ∣ . In all three cases, the claim follows by summing over ( a , b ) (a,b) ( a , b ) and using Equation (14) .
In Case (2), the DSO queries and the first term of the running time sum up to O ~ ( n 2 ) \widetilde{O}(n^2) O ( n 2 ) by Equation (14) . For the max-min products, we use Lemma A.1 . The terms ∣ Y ∣ ⋅ h |Y|\cdot h ∣ Y ∣ ⋅ h and ∣ X ∣ ⋅ h |X|\cdot h ∣ X ∣ ⋅ h sum up to O ~ ( n 2 ) \widetilde{O}(n^2) O ( n 2 ) by Equation (14) . Since h > n ρ h>n^\rho h > n ρ and ∣ X ∣ ≤ n |X|\leq n ∣ X ∣ ≤ n in Case (2), the terms ∣ X ∣ ⋅ ∣ Y ∣ ≤ n 1 − ρ ⋅ h ⋅ ∣ Y ∣ |X|\cdot|Y|\leq n^{1-\rho}\cdot h\cdot|Y| ∣ X ∣ ⋅ ∣ Y ∣ ≤ n 1 − ρ ⋅ h ⋅ ∣ Y ∣ sum up to O ~ ( n 3 − ρ ) ≤ O ~ ( n 2 + ρ ) \widetilde{O}(n^{3-\rho})\leq\widetilde{O}(n^{2+\rho}) O ( n 3 − ρ ) ≤ O ( n 2 + ρ ) , using ρ ≥ 2 / 3 \rho\geq2/3 ρ ≥ 2/3 . To bound the remaining term ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ T M M ( ∣ X ∣ , ∣ Y ∣ , h ) \sqrt{|X|\cdot|Y|\cdot h\cdot\mathrm{T}_{\mathrm{MM}}(|X|,|Y|,h)} ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ T MM ( ∣ X ∣ , ∣ Y ∣ , h ) , let u : = min { ∣ X ∣ , ∣ Y ∣ } u:=\min\{|X|,|Y|\} u := min { ∣ X ∣ , ∣ Y ∣ } and note that ∣ X ∣ , ∣ Y ∣ ≥ u |X|,|Y|\geq u ∣ X ∣ , ∣ Y ∣ ≥ u and h > n ρ ≥ u ρ h>n^\rho\geq u^\rho h > n ρ ≥ u ρ . Hence, we can multiply an ∣ X ∣ × ∣ Y ∣ |X|\times|Y| ∣ X ∣ × ∣ Y ∣ matrix by a ∣ Y ∣ × h |Y|\times h ∣ Y ∣ × h matrix by partitioning the matrices into O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h / u 2 + ρ ) O(|X|\cdot|Y|\cdot h/u^{2+\rho}) O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h / u 2 + ρ ) pairs of blocks of dimensions u × u u\times u u × u and u × u ρ u\times u^\rho u × u ρ , multiplying each pair of blocks in time T M M ( u , u , u ρ ) = O ~ ( u ω ( 1 , 1 , ρ ) ) = O ~ ( u ω ( 1 , ρ , 1 ) ) = O ~ ( u ρ ) \mathrm{T}_{\mathrm{MM}}(u,u,u^\rho)=\widetilde{O}(u^{\omega(1,1,\rho)})=\widetilde{O}(u^{\omega(1,\rho,1)})=\widetilde{O}(u^{\rho}) T MM ( u , u , u ρ ) = O ( u ω ( 1 , 1 , ρ ) ) = O ( u ω ( 1 , ρ , 1 ) ) = O ( u ρ ) , and summing up the partial products in time O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h / u ) O(|X|\cdot|Y|\cdot h/u) O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h / u ) . As ρ ≥ 1 / 2 \rho\geq1/2 ρ ≥ 1/2 , this gives T M M ( ∣ X ∣ , ∣ Y ∣ , h ) = O ~ ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ u 2 ρ − 2 ) \mathrm{T}_{\mathrm{MM}}(|X|,|Y|,h)=\widetilde{O}(|X|\cdot|Y|\cdot h\cdot u^{2\rho-2}) T MM ( ∣ X ∣ , ∣ Y ∣ , h ) = O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ u 2 ρ − 2 ) , and thus
∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ T M M ( ∣ X ∣ , ∣ Y ∣ , h ) = O ~ ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ u ρ − 1 ) = O ~ ( max { ∣ X ∣ , ∣ Y ∣ } ⋅ u ρ ⋅ h ) = O ~ ( n ρ ⋅ ( ∣ X ∣ + ∣ Y ∣ ) ⋅ h ) . \sqrt{|X|\cdot|Y|\cdot h\cdot\mathrm{T}_{\mathrm{MM}}(|X|,|Y|,h)}=\widetilde{O}(|X|\cdot|Y|\cdot h\cdot u^{\rho-1})=\widetilde{O}(\max\{|X|,|Y|\}\cdot u^\rho\cdot h)=\widetilde{O}(n^\rho\cdot(|X|+|Y|)\cdot h). ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ T MM ( ∣ X ∣ , ∣ Y ∣ , h ) = O ( ∣ X ∣ ⋅ ∣ Y ∣ ⋅ h ⋅ u ρ − 1 ) = O ( max { ∣ X ∣ , ∣ Y ∣ } ⋅ u ρ ⋅ h ) = O ( n ρ ⋅ ( ∣ X ∣ + ∣ Y ∣ ) ⋅ h ) .
Summing over all ( a , b ) (a,b) ( a , b ) and using Equation (14) once more, the max-min products take O ~ ( n 2 + ρ ) \widetilde{O}(n^{2+\rho}) O ( n 2 + ρ ) time in total. Together with the time P + T P+T P + T for constructing the DSO and the canonical shortest paths, and O ~ ( n 2 ) \widetilde{O}(n^2) O ( n 2 ) time for computing the decomposition, this yields the claimed preprocessing time.
Choice of ρ \rho ρ : The bounds in [ADV+25, Table 1] give ω ( 1 , 0.7 , 1 ) ≤ 2.152770 \omega(1,0.7,1)\leq2.152770 ω ( 1 , 0.7 , 1 ) ≤ 2.152770 and ω ( 1 , 0.8 , 1 ) ≤ 2.220639 \omega(1,0.8,1)\leq2.220639 ω ( 1 , 0.8 , 1 ) ≤ 2.220639 . Since κ ↦ ω ( 1 , κ , 1 ) \kappa\mapsto\omega(1,\kappa,1) κ ↦ ω ( 1 , κ , 1 ) is convex, we obtain ω ( 1 , 0.7228 , 1 ) ≤ 2.152770 + 0.228 ⋅ ( 2.220639 − 2.152770 ) < 2.1683 < 3 ⋅ 0.7228 \omega(1,0.7228,1)\leq2.152770+0.228\cdot(2.220639-2.152770)<2.1683<3\cdot0.7228 ω ( 1 , 0.7228 , 1 ) ≤ 2.152770 + 0.228 ⋅ ( 2.220639 − 2.152770 ) < 2.1683 < 3 ⋅ 0.7228 .