Reliable Hubs for Partially-Dynamic All-Pairs Shortest Paths in Directed Graphs
aa r X i v : . [ c s . D S ] J u l Reliable Hubs for Partially-DynamicAll-Pairs Shortest Paths in Directed Graphs
Adam Karczmarz ∗ and Jakub Łącki Institute of Informatics, University of Warsaw, Poland [email protected] Google Research, New York, USA [email protected]
Abstract
We give new partially-dynamic algorithms for the all-pairs shortest paths problem in weighteddirected graphs. Most importantly, we give a new deterministic incremental algorithm for the prob-lem that handles updates in e O ( mn / log W/ǫ ) total time (where the edge weights are from [1 , W ] )and explicitly maintains a (1 + ǫ ) -approximate distance matrix. For a fixed ǫ > , this is the firstdeterministic partially dynamic algorithm for all-pairs shortest paths in directed graphs, whose up-date time is o ( n ) regardless of the number of edges. Furthermore, we also show how to improvethe state-of-the-art partially dynamic randomized algorithms for all-pairs shortest paths [Baswana etal. STOC’02, Bernstein STOC’13] from Monte Carlo randomized to Las Vegas randomized withoutincreasing the running time bounds (with respect to the e O ( · ) notation).Our results are obtained by giving new algorithms for the problem of dynamically maintaining hubs , that is a set of e O ( n/d ) vertices which hit a shortest path between each pair of vertices, providedit has hop-length Ω( d ) . We give new subquadratic deterministic and Las Vegas algorithms formaintenance of hubs under either edge insertions or deletions. The sampling scheme of Ullman and Yannakakis [27] is a fundamental tool in designing dynamic algo-rithms for maintaining shortest path distances. Roughly speaking, the main idea is that if each vertex ofthe graph is sampled independently with probability Ω( d ln nn ) , then with high probability the set of thesampled vertices has the following property. If the shortest path between some vertices u and v containsmore than d edges, then this shortest path contains a sampled vertex . We call each set having thisproperty a set of hubs of that graph.The fact that one can easily obtain a set of hubs by random sampling is particularly useful for dynamicgraph algorithms, since, by tuning constants in the sampling probability, one can assure that the set ofhubs remains valid at each step (with high probability), while the graph is undergoing edge insertionsand deletions, assuming the total number of updates is polynomial. This property has been successfullyexploited to give a number of dynamic graph algorithms, e.g. [2, 4, 5, 9, 11, 12, 13, 20, 21, 22]. Atthe same time, the sampling approach also suffers from two drawbacks. First, it yields Monte Carloalgorithms, which with some nonzero probability can return incorrect answers. Second, it relies on the oblivious adversary assumption, that is, it requires that the updates to the graph are independent of the ∗ Supported by ERC Consolidator Grant 772346 TUgbOAT and the Polish National Science Centre2018/29/N/ST6/00757 grant. We say that a probabilistic statement holds with high (low) probability . abbreviated w.h.p., if it holds with probabilityat least − n − β (at most n − β , resp.), where β is a constant that can be fixed arbitrarily. For simplicity, in the introduction we assume that the shortest paths are unique. Zwick [29] uses the name bridging set for an analogous concept. Some works also use the term hitting set , but hittingset is a more general notion, which in our paper is used in multiple different contexts. (1 + ǫ ) -approximate distances or maintaining the shortestpaths themselves (i.e. not just their lengths). In a typical case, the choice of the specific answer to aquery depends on the randomness used for vertex sampling, which in turn means that in each answer to aquery the data structure is revealing its randomness. Hence, if the following updates to the data structuredepend on the specific values returned by the previous queries, the oblivious adversary assumption is notmet.In this paper we attempt to address both these issues. We study the dynamic maintenance of reliable hubs, that is we show how to maintain hubs using an algorithm that does not err, even withsmall probability. In addition, in the incremental setting we give an algorithm that maintains hubsdeterministically. While the algorithms are relatively straightforward for unweighted graphs, makingthem also work in the weighted setting is a major challenge, which we manage to overcome. We thenshow how to take advantage of our results on reliable hubs to obtain improved algorithms for the problemof maintaining all-pairs shortest paths in directed graphs. In particular, we give a faster deterministicincremental algorithm and show how to improve the state-of-the-art decremental algorithms from MonteCarlo to Las Vegas. We study the problem of maintaining reliable hub sets in the partially dynamic setting. For the descrip-tion, let us first assume the case when the graph is unweighted. Our first observation is that one candeterministically maintain the set of hubs H d under edge insertions in e O ( nmd ) total time. To that end,we observe that after an edge uw is inserted, we may ensure the set of hubs H d is valid by extending itwith both u and w . This increases the size of H d , and hence we have to periodically discard all the hubsand recompute them from scratch.The deterministic computation of hubs has been studied before. For unweighted digraphs, King [19]showed how to compute a hub set H d of size e O (cid:0) nd (cid:1) in ˜ O ( n ) time. The algorithm, given shortest pathtrees up to depth d from all vertices v ∈ V , computes a blocker-set [19] of these trees. (A blocker-set S of a rooted tree is a set such that, for each path from the root to a leaf of length d , that path containsa vertex of S distinct from the root.) Hence, if we work on unweighted graphs, in order to keep the set H d valid and relatively small, we can maintain shortest path trees up to depth d from all vertices usingthe Even-Shiloach algorithm [10] in O ( nmd ) total time, and recompute H d using King’s algorithm every e O ( nd ) insertions. The total time needed for maintaining the hubs is therefore e O ( nmd ) .Furthermore, we also show how to maintain reliable hubs in a decremental setting. Suppose our goalis to compute a set of hubs that is guaranteed to be valid, which clearly is not the case for the sampledhubs of [27]. We show that if shortest path trees up to depth d are maintained using dynamic tree data structures [24, 25], one can recompute a certainly-valid set H d in e O (cid:16) n d (cid:17) time using a Las Vegasalgorithm. To this end observe that one can deterministically verify if a set B ⊆ V is a blocker-set of n shortest path trees up to depth d in e O ( n · | B | ) time. Therefore, a hub set H d can be found by combiningthe approaches of [27] and [19]: we may sample candidate hub sets of size e O ( nd ) until a blocker-set ofthe trees is found. The number of trials is clearly constant with high probability.We further extend this idea and show that the information whether B is a blocker-set of a collectionof n shortest path trees up to depth d can be maintained subject to the changes to these trees with onlypolylogarithmic overhead. Consequently, we can detect when the sampled hub set H d (for any d ) ceasesto be a valid hub set in e O ( nmd ) total time. The algorithm may make one-sided error (i.e., say that H d isno longer a valid hub set when it is actually still good), but the probability of an error is low if we assumethat the update sequence does not depend on our random bits. Subsequently we show how to extend thisidea to improve the total update time to e O ( nm ) . Assume we are given a valid d -hub set H d . We provethat in order to verify whether H d is a valid d -hub set, it suffices to check whether it hits sufficientlylong paths between the elements of H d . We use this observation to maintain a family of reliable hub sets H , H , . . . , H i , . . . , H k (where k ≤ n ) under edge deletions (or under edge insertions) in e O ( nm ) totaltime. Using that, we immediately improve the state-of-the-art decremental APSP algorithms of Baswanaet al. [4] (for the exact unweighted case) and Bernstein [5] (for the (1 + ǫ ) -approximate case) from MonteCarlo to Las Vegas (but still assuming an oblivious adversary) by only adding a polylogarithmic factorto the total update time bound. 2 eneralization to weighted digraphs. Adapting the reliable hub sets maintenance (for both de-scribed approaches: the incremental one and sample/verify) to weighted digraphs turns out to be farfrom trivial. This is much different from the sampling approach of Ullman and Yannakakis [27], whichworks regardless of whether the input graph is weighted or not. The primary difficulty is maintaining allshortest paths consisting of up to d edges. While in the unweighted case the length of a path is equal tothe number of edges on this path, this is no longer true in the weighted case.To bypass this problem we first relax our definition of hubs. For each u, v ∈ V we require that some (1 + ǫ ) -approximate shortest u → v path contains a hub on each subpath consisting of at least d + 1 edges.Next, we show that running King’s blocker-set algorithm on a set of (1 + ǫ ) -approximate shortest pathtrees up to depth d from all vertices of the graph yields a hub set that hits paths approximating the trueshortest paths within a factor of (1 + ǫ ) Θ(log n ) . Note that a collection of such trees can be maintainedin e O ( nmd log W/ǫ ) total time subject to edge insertions, using Bernstein’s h -SSSP algorithm [5] with h = d .The Θ(log n ) exponent in the approximation ratio comes from the following difference between theweighted and unweighted case. In a (1 + ǫ ) -approximate shortest path tree up to depth d , the length ofa u → v path is no more than (1 + ǫ ) -times the length of the shortest u → v path in G that uses at most d edges. However, the u → v path in the tree might consist of any number of edges, in particular veryfew. Pessimistically, all these trees have depth o ( d ) and their blocker-set is empty, as there is no path ofhop-length Ω( d ) that we need to hit. Note that this is an inherent problem, as the fact that we can finda small blocker-set in the unweighted case relies on the property that we want it to hit paths of Ω( d ) edges.Luckily, a deeper analysis shows that our algorithm can still approximate the length of a s → v path.Roughly speaking, we split the s → v path P into two subpaths of d/ edges. If each of these twosubpaths are approximated in the h -SSSP data structures by paths of less than d/ edges, we replace the P by the concatenation of the two approximate paths from the h -SSSP data structures. This way, weget a path that can be longer by a factor of (1 + ǫ ) , but whose hop-length is twice smaller. By repeatingthis process O (log n ) times we obtain a path of constant hop-length whose length is at most (1 + ǫ ) Θ(log n ) larger than the length of P . The overall approximation ratio is reduced to (1 + ǫ ) by scaling ǫ by a factorof Θ(log n ) . Deterministic incremental all-pairs shortest paths.
We now show how to apply our results on re-liable hubs to obtain an improved algorithm for incremental all-pairs shortest paths problem in weighteddigraphs. We give a deterministic incremental algorithm maintaining all-pairs (1 + ǫ ) -approximate dis-tance estimates in e O ( mn / log W/ǫ ) total time.Let us now give a brief overview of our algorithm in the unweighted case. First, we maintain theset of hubs H d under edge insertions as described above in e O ( nmd ) total time. Second, since the set H d changes and each vertex of the graph may eventually end up in H d , we cannot afford maintainingshortest path trees from all the hubs (which is done in most algorithms that use hubs). Instead, weuse the folklore e O ( n /ǫ ) total time incremental (1 + ǫ ) -approximate APSP algorithm [5, 19] to computedistances between the hubs. Specifically, we run it on a graph whose vertex set is H d and whose edgesrepresent shortest paths between hubs of hop-lengths at most d . These shortest paths are taken fromthe shortest path trees up to depth d from all v ∈ V that are required for the hub set maintenance. Wereinitialize the algorithm each time the set H d is recomputed. This allows us to maintain approximatepairwise distances between the hubs at all times in e O (cid:16) m ( n/d ) /ǫ (cid:17) total time.Finally, we show how to run a dynamic algorithm on top of a changing set of hubs by adapting theshortcut edges technique of Bernstein [5]. Roughly speaking, the final estimates are maintained using (1 + ǫ ) -approximate shortest path trees [5] up to depth O ( d ) from all vertices v on graph G augmentedwith shortcuts from v to H d and from H d to v . This poses some technical difficulties as the set ofshortcuts is undergoing both insertions (when a hub is added) and deletions (when the entire set of hubsis recomputed from scratch). However, one can note that in the incremental setting the shortcuts thatno longer approximate the distances between their endpoints do not break the approximation guaranteeof our algorithm. Eventually, we use shortcuts between all pairs of vertices of G but only some of them In such a tree (see Definition 5.1), which is a subgraph of G , for all v ∈ V , the path from the source s to v has lengthnot exceeding (1 + ǫ ) times the length of a shortest out of s → v paths in G that use no more than d edges; however thetree path itself can have arbitrary number of edges. e O ( nmd/ǫ ) . Setting d = e O ( n / ) gives the best update time.It is natural to wonder if this approach could be made to work in the decremental setting. Thereare two major obstacles. First, it is unclear whether one can deterministically maintain a valid set ofhubs under deletions so that only O (1) vertices (in amortized sense) are added to the hub set after eachedge deletion. Note that in extreme cases, after a single edge deletion the set of hubs may have to beextended with polynomially many new vertices. Second, all algorithms using the above approach ofintroducing shortcuts from and to hubs also maintain a decremental shortest path data structure on agraph consisting of the edges of the original graph and shortcut edges representing distances between thehubs. If hubs were to be added, the graph maintained by the data structure would undergo both insertions(of shortcuts) and deletions (of edges of the original graph) which would make this a much harder, fullydynamic problem. Some earlier works dealt with a similar issue by ignoring some “inconvenient” edgeinsertions [14] or showing that the insertions are well-behaved [6]. However, these approaches cruciallydepended on the graph being undirected. The dynamic graph problems on digraphs are considerably harder than their counterparts on undirectedgraphs. An extreme example is the dynamic reachability problem, that is, transitive closure on directedgraphs, and connectivity on undirected graphs. While there exist algorithms for undirected graphs withpolylogarithmic query and update times [17, 28, 26, 16, 18], in the case of directed graphs the bestknown algorithm with polylogarithmic query time has an update time of O ( n ) [23, 7, 20]. In addition, acombinatorial algorithm with an update time of O ( n − ǫ ) is ruled out under Boolean matrix multiplicationconjecture [1].In 2003, in a breakthrough result Demetrescu and Italiano gave a fully dynamic, exact and deter-ministic algorithm for APSP in weighted directed graphs [8]. The algorithm handles updates in e O ( n ) amortized time and maintains the distance matrix explicitly. The bound of O ( n ) is a natural barrier asa single edge insertion or deletion may change up to Ω( n ) entries in the distance matrix. For dynamicAPSP in digraphs there exists faster algorithms with polylogarithmic query time, all of which work inincremental or decremental setting: • Ausiello et al. [3] gave a deterministic incremental algorithm for exact distances in unweighteddigraphs that handles updates in e O ( n ) total time. • Baswana et al. [4] solved the same problem in the decremental setting with a Monte Carlo algorithmwith e O ( n ) total update time. • Bernstein [5] gave a Monte Carlo algorithm for (1 + ǫ ) -approximate distances in weighted graphs(with weights in [1 , W ] ) with e O ( nm log W/ǫ ) total update time. The algorithm works both in theincremental and decremental setting. • Finally, deterministic partially-dynamic (both incremental and decremental) algorithms for APSPin directed graphs with e O ( n log W/ǫ ) total update time can be obtained by combining the resultsof [19] and [5].The algorithms of Baswana et al. [4] and Bernstein [5] both use sampled hubs and thus require the oblivious adversary assumption. We highlight that in the class of deterministic algorithms, the bestknown results have total update time e O ( n ) [3, 5], even if we only consider sparse unweighted graphs inincremental or decremental setting and allow (1 + ǫ ) approximation. In the incremental setting, for notvery dense graphs, when m = O ( n / − ǫ ) , our algorithm improves this bound to e O ( mn / ) . Organization of the paper.
In Section 2 we fix notation, review some of the existing tools that weuse and give a formal definition of hubs. Section 3 describes the hub set maintenance for incrementalunweighted digraphs and our (1 + ǫ ) -approximate incremental algorithm for sparse graphs. In Section 4we show a faster Las Vegas algorithm for computing reliable hubs and further extend it to maintainreliable hub sets in the partially dynamic setting. There we also sketch how to use it in order to toimprove the state-of-the-art decremental APSP algorithms from Monte Carlo to Las Vegas randomized.4inally, in Section 5 we show how to adapt the hub set maintenance algorithms of Sections 3 and 4, sothat they work on weighted graphs. In this paper we deal with directed graphs. We write V ( G ) and E ( G ) to denote the sets of vertices andedges of G , respectively. A graph H is a subgraph of G , which we denote by H ⊆ G , if and only if V ( H ) ⊆ V ( G ) and E ( H ) ⊆ E ( G ) . We write uv ∈ E ( G ) when referring to edges of G and use w G ( uv ) to denote the weight of uv . If G = ( V, E ) is unweighted, then w G ( e ) = 1 for each e ∈ E . For weightedgraphs, w G ( e ) can be any real number from the interval [1 , W ] . For simplicity, in this paper we assumethat W is an input parameter given beforehand. If uv / ∈ E , we assume w G ( uv ) = ∞ . We define the union G ∪ H to be the graph ( V ( G ) ∪ V ( H ) , E ( G ) ∪ E ( H )) with weights w G ∪ H ( uv ) = min( w G ( uv ) , w H ( uv )) for each uv ∈ E ( G ∪ H ) . For an edge e = uv , we write G + e to denote ( V ( G ) ∪ { u, v } , E ( G ) ∪ { e } ) . The reverse graph G R is defined as ( V ( G ) , { xy : yx ∈ E ( G ) } ) and w G R ( xy ) = w G ( yx ) .A sequence of edges P = e . . . e k , where k ≥ and e i = u i v i ∈ E ( G ) , is called a u → v path in G if u = u , v k = v and v i − = u i for each i = 2 , . . . , k . We sometimes view a path P in G as a subgraph of G with vertices { u , . . . , u k , v } and edges { e , . . . , e k } and write P ⊆ G . The hop-length | P | is definedas | P | = k . The length of the path ℓ ( P ) is defined as ℓ ( P ) = P ki =1 w G ( e i ) . If G is unweighted, then weclearly have | P | = ℓ ( P ) . For convenience, we sometimes consider a single edge uv a path of hop-length . It is also useful to define a length- u → u path to be the graph ( { u } , ∅ ) . If P is a u → v path and P is a v → w path, we denote by P · P (or simply P P ) a path P ∪ P obtained by concatenating P with P .A digraph T is called an out-tree over V rooted in r if v ∈ V ( T ) ⊆ V , | E ( T ) | = | V ( T ) | − and forall v ∈ V ( T ) there is a unique path T [ v ] from r to v . The depth dep T ( v ) of a vertex v ∈ V ( T ) is definedas | T [ v ] | . The depth of T is defined as max v ∈ V ( T ) { dep T ( v ) } . Each non-root vertex of an out-tree hasexactly one incoming edge. For v ∈ V ( T ) \ { r } we call the other endpoint of the incoming edge of v the parent v and write par T ( v ) when referring to it.The distance δ G ( u, v ) between the vertices u, v ∈ V ( G ) is the length of the shortest u → v path in G , or ∞ , if no u → v path exists in G . We define δ kG ( u, v ) to be the length of the shortest path from u to v among paths of at most k edges. Formally, δ kG ( u, v ) = min { ℓ ( P ) : u → v = P ⊆ G and | P | ≤ k } .We sometimes omit the subscript G and write w ( uv ) , δ ( u, v ) , δ k ( u, v ) etc. instead of w G ( u, v ) , δ G ( u, v ) , δ kG ( u, v ) , etc., respectively.We say that a graph G is incremental , if it only undergoes edge insertions and edge weight decreases.Similarly, we say that G is decremental if it undergoes only edge deletions and edge weight increases.We say that G is partially dynamic if it is either incremental or decremental. For a dynamic graph G we denote by n the maximum value of | V | and by m the maximum value of | E | throughout the wholesequence of updates.When analyzing (1 + ǫ ) -approximate algorithms, we assume < ǫ < and /ǫ = poly n . We denote by ∆ the total number of updates a dynamic graph G is subject to. If G is unweighted,then clearly ∆ ≤ m and in fact we assume ∆ = m , which allows us to simplify the analyses. Forweighted digraphs, on the other hand, since the total number of weight increases/decreases that an edgeis subject to is unlimited, ∆ may be much larger than m . As a result, it has to be taken into accountwhen analyzing the efficiency of our algorithms.We call a partially-dynamic (1 + ǫ ) -approximate APSP problem on weighted graphs restricted if theedge weights of G are of the form (1 + ǫ ) i for i ∈ [0 , ⌈ log ǫ W ⌉ ] ∩ N at all times and additionallyeach update is required to actually change the edge set or change the weight of some existing edge.Consequently, observe that in the restricted problem we have ∆ ≤ m · ( ⌈ log ǫ W ⌉ + 2) . In the followingwe concentrate on the restricted problem. This is without much loss of generality as proved below. Lemma 2.1.
Let A be an algorithm solving the restricted (1+ ǫ ) -approximate all-pairs shortest paths prob-lem on a weighted digraph in O ( T ( n, m, W, ǫ, ∆)) total time, where T ( n, m, W, ǫ, ∆) = poly ( n, m, W, ǫ, ∆) .Then, there exists an algorithm solving the corresponding general problem (i.e., with arbitrary real edge-weights from the range [1 , W ] ) in O ( T ( n, m, W, ǫ, m log W/ǫ ) + ∆) total time. If this was not the case, we had better use exact fully-dynamic APSP algorithm [8] instead. roof. Let ǫ ′ = ǫ/ . Let G ′ have the same vertices and edges as G and let w G ′ ( uv ) = expround (1+ ǫ ′ ) w G ( uv ) for each uv ∈ E , where expround a ( x ) := x ⌈ log a x ⌉ . Note that for any u, v ∈ V , δ G ′ ( u, v ) ≤ (1 + ǫ ′ ) δ G ( u, v ) .Let us run an instance A of the (1 + ǫ ′ ) -approximate algorithm A on G ′ . A yields (1 + ǫ ′ ) ≤ (1 + ǫ ) -approximate distances in G . However, not all updates to G are passed to A . if w G ′ ( uv ) does not changeas a result of an update to w G ( uv ) , it can be ignored from the point of view of A in O (1) time. On theother hand, if a change to w G ( uv ) makes w G ′ ( uv ) change, such an update is passed to A . However, foreach edge uv ∈ E this can clearly happen at most O (log ǫ ′ W ) = O (log W/ǫ ′ ) = O (log W/ǫ ) times.Hence, the total update time is indeed O ( T ( n, m, W, ǫ, m log W/ǫ ) + ∆) . Definition 2.2.
Let G = ( V, E ) be an unweighted digraph and let s ∈ V . Let d > be an integer. Wecall an out-tree T ⊆ G rooted in s a shortest path tree from s up to depth d if:1. for any v ∈ V , v ∈ V ( T ) iff δ G ( s, v ) ≤ d , and2. for any v ∈ V ( T ) , δ T ( s, v ) = δ G ( s, v ) . Theorem 2.3 (Even-Shiloach tree [10, 15]) . Let G = ( V, E ) be an unweighted graph subject to partiallydynamic edge updates. Let s ∈ V and let d ≥ be an integer. Then, a shortest path tree from s up todepth d can be explicitly maintained in O ( md ) total time. Theorem 2.4 ( h -SSSP [5]) . Let G = ( V, E ) be a weighted digraph. Let s ∈ V and let h ≥ be aninteger. There exists a partially dynamic algorithm explicitly maintaining (1 + ǫ ) -approximate distanceestimates δ ′ ( s, v ) satisfying δ G ( s, v ) ≤ δ ′ ( s, v ) ≤ (1 + ǫ ) δ hG ( s, v ) for all v ∈ V . The total update time of the algorithm O ( mh log n log( nW ) /ǫ + ∆) . We now define a blocker set, slightly modifying a definition by King [19].
Definition 2.5.
Let V be a vertex set and let d be a positive integer. Let B ⊆ V and let T be a rootedtree over V of depth no more than d . We call B a ( T, d ) -blocker set if for each v ∈ V ( T ) such that dep T ( v ) = d , either v or one of its ancestors in T belongs to B .Equivalently, B is a ( T, d ) -blocker set if the tree T ′ obtained from T by removing all subtrees rootedin vertices of B (possibly the entire T , if the root is in B ) has depth less than d .Let T be a collection of rooted trees over V of depth no more than d . We call B a ( T , d ) -blocker setif B is a ( T, d ) -blocker set for each T ∈ T . Lemma 2.6 ([19]) . Let V be a vertex set of size n . Let d be a positive integer. Let T be a collectionof rooted trees over V of depth at most d . Then, a ( T , d ) -blocker set of size O (cid:0) nd log n (cid:1) can be computeddeterministically in O ( n · ( |T | + n ) log n ) time.Proof. For each vertex v ∈ V , we maintain a score , defined as the sum, over all trees of T ∈ T that v participates in, of the number of descendants w of v such that dep T ( w ) = d . Clearly, the scores can beinitialized in O ( |T | · n ) time.The set B is constructed greedily by repeatedly picking a vertex v with maximum score, removingfrom each T ∈ T the subtree rooted at v (including v ), and updating the scores accordingly. To updatethe scores one needs to iterate through all vertices of the removed subtree, as well as all O ( d ) ancestorsof v in T . Thus, the time to spent on picking maximum-scoring vertices and updating the scores can bebounded by O ( | B | · ( n + |T | · d ) + |T | · n ) .As the maximum-scoring vertex participates in at least dn -fraction of the remaining d -edge root-leafpaths at each step, O ( nd log n ) vertices will end up being picked. Hence, the total running time is O ( n · ( |T | + n ) log n ) . By this we mean that the algorithm outputs all changes to the edge set of the maintained tree. efinition 2.7. Let G = ( V, E ) be a directed graph. Let B ⊆ V and let d > be an integer. We saythat a path P in G is ( B, d ) -covered if it can be expressed as P = P . . . P k , where P i = u i → v i , | P i | ≤ d for each i = 1 , . . . , k , and u i ∈ B for each i = 2 , . . . , k . Lemma 2.8.
Let G = ( V, E ) be a digraph and let B ⊆ V . Let P = P . . . P l be a u → v path and supposethat for any i , P i is ( B, d i ) -covered. Then, P is ( B, D ) -covered, where D = max { d x + . . . + d z : 1 ≤ x ≤ z ≤ l and V ( P y ) ∩ B = ∅ for all y ∈ ( x, z ) } . Proof.
Since P i is ( B, d i ) -covered, it can be expressed as P i = P i, . . . P i,k i , where for each j ∈ [1 , k i ] , | P i,j | ≤ d i , no vertices of P i,j other than its endpoints belong to B , and for each j ∈ [2 , k i ] , P i,j starts ina vertex of B . Hence, if V ( P i ) ∩ B = ∅ , then k i = 1 .Let z , . . . , z r be those indices i for which V ( P i ) ∩ B = ∅ holds, in ascending order. Assume that k z i ≥ (if k z i = 1 , we can set P z i , = v z i → v z i to be a path of length ). Set P l +1 , to be a -edge v → v path and let z r +1 = l + 1 . Observe that we can rewrite D as D = max (cid:0) d + . . . + d z , d z + . . . + d z , . . . , d z r + . . . + d z r +1 (cid:1) . For i = 1 , . . . , r , let P ′ i = ( P z i , ) . . . ( P z i ,k zi P z i +1 , P z i +2 , . . . P z i +1 , ) Let P = ( P , . . . P z , ) P ′ . . . P ′ r . Moreover, all the bracketed subpaths, except of ( P , . . . P z , ) , startwith a vertex of B . The maximum number of edges, over all the bracketed subpaths, is clearly no morethan D . Therefore, we conclude that P is ( B, D ) -covered. Definition 2.9.
Let G = ( V, E ) be a directed graph and let d > be an integer. A set H d ⊆ V is calleda d -hub set of G if for every u, v ∈ V such that δ G ( u, v ) < ∞ , there exists some shortest u → v path thatis ( H d , d ) -covered. Lemma 2.10.
Let G = ( V, E ) be a directed unweighted graph and let d > be an integer. Suppose weare given a collection T = { T v : v ∈ V } of shortest path trees up to depth d from all vertices of G . Let B be a ( T , d ) -blocker set. Then B is a d -hub set of G .Proof. Let u, v ∈ V be any vertices such that δ G ( u, v ) < ∞ . Let P be some shortest u → v path.Let P , . . . , P k , where k ≥ and P i = u i → v i , be such that P = P . . . P k , | P | = . . . = | P k − | = d and | P k | ≤ d . Then each P i is clearly a shortest u i → v i path. Since T u i is a shortest path treefrom u i containing all vertices w such that δ G ( u i , w ) ≤ d , δ T ui ( u i , v i ) = | P i | . Let P ′ i = T u i [ v i ] and set P ′ = P ′ . . . P ′ k . Clearly, | P ′ | = | P | and thus P ′ is a shortest u → v path. As | P ′ i | ≤ d for each i , each P ′ i is clearly ( B, d ) -covered. All paths P ′ , . . . , P ′ k − contain a vertex of B and thus, by Lemma 2.8, P ′ is ( B, d ) -covered. We conclude that B is indeed a d -hub set of G . Theorem 2.11 ([19]+[5]) . There exist an incremental algorithm maintaining (1 + ǫ ) -approximate all-pairs distance estimates of a digraph in O ( n log n log( nW ) /ǫ + ∆) total time. As mentioned before, the above theorem basically follows by combining the partially-dynamic transi-tive closure algorithm of King [19] with Bernstein’s h -SSSP algorithm (Theorem 2.4) for h = 2 . However,since the algorithm is not stated explicitly anywhere in the literature, we sketch it in Appendix A forcompleteness. In this section we present our deterministic incremental algorithm with e O ( mn / /ǫ ) total update time.We first observe that whenever an edge xy is added, the set of hubs may be “fixed” by extending it withboth x and y . In this paper we sometimes use the notation ( x, z ) when referring to the set of integers y satisfying x < y < z . emma 3.1. Let G = ( V, E ) be a directed unweighted graph. Let H d be a d -hub set of G . Let x, y ∈ V be such that xy / ∈ E . Then H ′ d = H d ∪ { x, y } is a d -hub set of G ′ = G + xy . In the proof we use Lemma 3.2, whose proof can be found above.
Lemma 3.2.
Let G = ( V, E ) be a directed graph and let B ⊆ V . Let b ∈ B . Let P be a u → b path in G that is ( B, d P ) -covered. Let Q be a b → v path in G that is ( B, d Q ) -covered. Then the path P Q = u → v is ( B, max( d P , d Q )) -covered.Proof. Let P = P . . . P k be such that for all i , | P i | ≤ d P and for all i ≥ , P i starts at a vertexof B . Similarly, let Q = Q . . . Q l be such that for all i , | Q i | ≤ d Q and for all i ≥ , Q i starts ata vertex of B . By b ∈ B , all paths P , . . . , P k , Q , . . . , Q l start with a vertex of B . Moreover, eachpath of P , . . . , P k , Q , . . . , Q l has length no more than max( d P , d Q ) . We conclude that the path P Q is ( B, max( d P , d Q )) -covered. Proof of Lemma 3.1.
Let u, v ∈ V be such that δ G ′ ( u, v ) < ∞ . We need to show that there exists ashortest path P = u → v in G ′ such that P is ( H ′ d , d ) -covered.Since G ⊆ G ′ , δ G ′ ( u, v ) ≤ δ G ( u, v ) If δ G ′ ( u, v ) = δ G ( u, v ) , then there exists a shortest path P = u → v such that P ⊆ G ⊆ G ′ . Hence, P is ( H d , d ) -covered and thus also ( H ′ d , d ) -covered.If δ G ′ ( u, v ) < δ G ( u, v ) , then all shortest u → v paths go through the edge xy . Let P = P ( xy ) P be any such path, where P = u → x and P = v → y are shortest paths in G . Hence, there also existshortest paths P ′ = u → x and P ′ = v → y , also contained in G , such that P ′ and P ′ are both ( H d , d ) -covered and hence also ( H ′ d , d ) -covered. Observe that the single-edge path ( x, y ) is ( H ′ d , -covered.By Lemma 3.2, since x ∈ H ′ d and d ≥ , the path P ′ ( x, y ) is ( H ′ d , d ) covered. Again by Lemma 3.2,since y ∈ H ′ d , and both paths P ′ ( x, y ) and P ′ are ( H ′ d , d ) -covered, P ′ ( x, y ) P ′ is ( H ′ d , d ) -covered as well.We conclude that H ′ d is indeed a d -hub set of G ′ . Let d > be an even integer and let ǫ , < ǫ < ǫ be a real number, both to be set later. Our datastructure consists of several components. Each subsequent component builds upon the previously definedcomponents only. Exact shortest paths between nearby vertices.
The data structure maintains two collections T from = { T from v : v ∈ V } and T to = { T to v : v ∈ V } of shortest path trees up to depth d in G and G R ,resp. By Theorem 2.3, each tree of T from ∪ T to can be maintained under edge insertions in O ( md ) totaltime. The total time spent in this component is hence O ( nmd ) . The hubs. A d -hub set H d of both G and G R such that | H d | = O (cid:0) nd log n (cid:1) is maintained at all times, asfollows. Initially, H d is computed in O ( n log n ) time using Lemma 2.6 and the trees of T from ∪ T to (seeLemma 2.10). Next, the data structure operates in phases. Each phase spans f = Θ( nd log n ) consecutiveedge insertions. When an edge xy is inserted, its endpoints are inserted into H d . By Lemma 3.1, thisguarantees that H d remains a d -hub set of both G and G R after the edge insertion. Once f edges areinserted in the current phase, the phase ends and the hub set H d is recomputed from scratch, again usingLemma 2.6. Observe that the size of | H d | may at most triple within each phase.The total time spent on maintaining the set H d is clearly O (cid:16) mf · n log n (cid:17) = O ( nmd ) . Approximate shortest paths between the hubs.
In each phase, we maintain a weighted graph A = ( H d , E A ) , where E A = { uv : u, v ∈ H d , δ G R ( u, v ) ≤ d } and w A ( uv ) = δ T to u ( u, v ) = δ G R ( u, v ) ≤ d .Observe that during each phase, the graph A is in fact incremental. We can thus maintain (1 + ǫ ) -approximate distance estimates δ ′ A ( u, v ) for all u, v ∈ H d in O ( | H d | log n/ǫ ) = O (cid:16)(cid:0) nd (cid:1) log n/ǫ (cid:17) total time per phase, using a data structure D A of Theorem 2.11. Technically speaking, the total update time of the data structure of Theorem 2.11 is O ( n log n/ǫ ′ ) + O (∆) . However,all updates to D A arise when some previous component updates its explicitly maintained estimates, so the ∆ term isasymptotically no more than the total update time of the previously defined components and can be charged to those. Inthe following, we omit ∆ terms like this without warnings. (1 + ǫ ′ ) -approximate distancesestimates of the graph A is O (cid:16) m (cid:0) nd (cid:1) log n/ǫ (cid:17) . Lemma 3.3.
For any u, v ∈ H d , δ G R ( u, v ) = δ A ( u, v ) .Proof. Let u, v ∈ H d . If δ G R ( u, v ) = ∞ , then clearly δ A ( u, v ) = ∞ as the edges of A correspond to pathsin G R . For the same reason, we have δ A ( u, v ) ≥ δ G R ( u, v ) .Suppose δ G R ( u, v ) < ∞ . By the definition of H d , there exists a shortest path P = u → v in G R such that P is ( H d , d ) -covered. Hence, P can be expressed as P . . . P k , where P i = u i → v i , u i , v i ∈ H d and | P i | ≤ d for all i . Since P i is a shortest u i → v i path in G R , the edge u i v i has length | P i | in A .Consequently, the path ( u v )( u v ) . . . ( u k v k ) = u → v has length | P | = δ G R ( u, v ) in A . We thus obtain δ A ( u, v ) ≤ δ G R ( u, v ) , which implies δ A ( u, v ) = δ G R ( u, v ) .By the above lemma, for each u, v ∈ H d we actually have δ ′ A ( u, v ) ≤ (1 + ǫ ) δ G R ( u, v ) . Shortcuts to hubs.
For each u ∈ V , let S u be a graph on V with exactly n edges { uv : v ∈ V } satisfying w S u ( u, v ) ≥ δ G R ( u, v ) for all v ∈ V , and additionally w S u ( u, v ) ≤ (1 + ǫ ) δ G R ( u, v ) if u, v bothcurrently belong to H d . The edges between vertices of H d are the only ones that our algorithm needsto compute approximate distances. For other edges we only need to make sure they will not cause thealgorithm to underestimate the distances.Observe that the graphs S u can be maintained using the previously defined components as follows.First, they are initialized so that their edges are all infinite-weight. Whenever the data structure D A changes (or initializes) some of its estimates δ ′ A ( u, v ) ≤ (1 + ǫ ) δ G R ( u, v ) , we perform w S u ( u, v ) :=min( w S u ( u, v ) , δ ′ A ( u, v )) . This guarantees that the invariants posed on S u are always satisfied and S u isincremental. The total number of updates to all graphs S u is equal to the number of estimate updatesmade by D A and thus can be neglected.For u ∈ V , we set up a h -SSSP data structure D u of Theorem 2.4 for the graph G R ∪ S u withsource vertex u and h = d + 1 . Hence, D u maintains distance estimates δ ′ ( u, v ) such that δ ′ ( u, v ) ≤ (1 + ǫ ′ ) δ d +1 G R ∪ S u ( u, v ) . As the graph G R ∪ S u is incremental and has O ( m ) edges, the total time that D u needs to operate is O ( md log n/ǫ + ∆ u ) , where ∆ u is the total number of updates to G R ∪ S u . Summingthe update times for all data structures D u , we obtain O ( nmd log n/ǫ + P v ∈ V ∆ u ) total time. Notethat P u ∈ V ∆ u equals nm plus the number of updates to the graphs S u , which can be charged to theoperating cost of data structure D A , as argued before. We conclude that the total update time of all D u is O ( nmd log n/ǫ ) .Observe that a shortest u → v path in G R , where u ∈ H d and v ∈ V is approximated by a path in G R ∪ S u consisting of at most d + 1 edges. The first edge belongs to S u and “jumps” to some hub. Thelatter (at most d ) edges belong to G R . This is formalized as follows. Lemma 3.4.
Let u ∈ H d and v ∈ V . Then δ d +1 G R ∪ S u ( u, v ) ≤ (1 + ǫ ) δ G R ( u, v ) .Proof. Recall that H d is a d -hub set of G R . It follows that there exists a shortest path P = P . . . P k = u → v such that for each i , P i = u i → v i , | P i | ≤ d and u i ∈ H d (since u = u ∈ H d ). Consider the edge e = uu k of S u . As u, u k ∈ H d , w S u ( e ) ≤ (1 + ǫ ) δ G R ( u, u k ) = (1 + ǫ ) ℓ ( P . . . P k − ) . Moreover, clearly P k ⊆ G R ∪ S u . The path P ′ = eP k = u → v thus has d + 1 edges and P ′ ⊆ G R ∪ S u . Consequently, weobtain δ d +1 G R ∪ S u ( u, v ) ≤ ℓ ( P ′ )= w S u ( e ) + ℓ ( P k ) ≤ (1 + ǫ ) ℓ ( P . . . P k − ) + ℓ ( P k ) ≤ (1 + ǫ ) ℓ ( P )= (1 + ǫ ) δ G R ( u, v ) . By the above lemma, we conclude that for u ∈ H d , v ∈ V , the estimate δ ′ ( u, v ) produced by the datastructure D v satisfies δ ′ ( u, v ) ≤ (1 + ǫ ) δ d +1 G R ∪ S u ( u, v ) ≤ (1 + ǫ ) δ G R ( u, v ) .9 ll-pairs approximate shortest paths. We maintain another set of shortcut graphs R u , for u ∈ V .Again R u has exactly n edges { uv : v ∈ V } whose weights satisfy w R u ( uv ) ≥ δ G ( u, v ) for all v and w R u ( uv ) ≤ (1 + ǫ ) δ G ( u, v ) if v ∈ H d . Each graph R u is maintained using the previously defined datastructures D v . Initially all weights of R u are infinite. Whenever some D v changes the estimate δ ′ ( v, u ) ,we set w R u ( uv ) := min( w R u ( uv ) , δ ′ ( v, u )) . Since for v ∈ H d we have δ ′ ( v, u ) ≤ (1 + ǫ ) δ G R ( v, u ) ,equivalently, δ ′ ( v, u ) ≤ (1 + ǫ ) δ G ( u, v ) and we obtain w R u ( uv ) ≤ (1 + ǫ ) δ G ( u, v ) . Therefore, thegraphs R u are all incremental and the total number of changes they are subject to is no more than thetotal number of estimate changes made by the data structures D v , v ∈ V . Thus, we may neglect thecost of actually performing these changes.Finally, for each u ∈ V we set up a h -SSSP data structure D ′ u of Theorem 2.4 on graph G ∪ R u withsource u and h = d +1 , maintaining (1+ ǫ ) -approximate estimates of the values δ d +1 G ∪ R u ( u, · ) . Similarly aswas the case for the data structures D u of the previous component, as the graphs G ∪ R u are incremental,the total operating time of the h -SSSP instances running on the graphs G ∪ R u is O ( nmd log n/ǫ ) . Lemma 3.5.
Let u, v ∈ V . Then δ d +1 G ∪ R u ( u, v ) ≤ (1 + ǫ ) δ G ( u, v ) .Proof. Recall that H d is a d -hub set of G . Hence, if δ G ( u, v ) < ∞ , there exists a shortest path P = P . . . P k = u → v , where P i = u i → v i , | P i | ≤ d and u i ∈ H d for all i ≥ . If k = 1 then | P | ≤ d and asa result δ d +1 G ∪ R u ( u, v ) ≤ δ dG ( u, v ) = δ G ( u, v ) .Suppose k ≥ . Then u k ∈ H d and consequently the weight of the edge e = uu k ∈ E ( R u ) satisfies w R u ( e ) ≤ (1 + ǫ ) δ G ( u, u k ) = (1 + ǫ ) | P . . . P k − | . The path P ′ = eP k ⊆ G ∪ R u satisfies ℓ ( P ′ ) ≤ (1 + ǫ ) ℓ ( P ) = (1 + ǫ ) δ G ( u, v ) and | P ′ | ≤ d + 1 . Hence, indeed δ d +1 G ∪ R u ( u, v ) ≤ ℓ ( P ′ ) ≤ (1 + ǫ ) δ G ( u, v ) .By the above lemma, the the distance estimates δ ′′ ( u, v ) maintained by the data structure D ′ u , ap-proximate the corresponding distances δ G ( u, v ) within a factor of (1 + ǫ ) . Theorem 3.6.
Let G be a directed unweighted graph. There exists a deterministic incremental algorithmmaintaining (1+ ǫ ) -approximate distance estimates between all pairs of vertices of G in O ( mn / log / n/ǫ ) total time.Proof. Let ǫ = ǫ/ . Then the estimates δ ′′ ( u, v ) produced by the data structures D ′ u approximate theactual distances within a factor of (cid:0) ǫ (cid:1) ≤ ǫ . The total time used by the data structure is clearly O (cid:16) nmd log n/ǫ + m (cid:0) nd (cid:1) log n/ǫ (cid:17) = O (cid:0) nm log n · (cid:0) d + nd log n (cid:1) /ǫ (cid:1) . By setting d = n / log / n , weobtain the desired bound. In this section we show how to maintain the information whether a sampled set remains a hub set of anunweighted digraph G subject to partially dynamic updates. For simplicity, assume that G is decremental(the incremental case, being somewhat easier, can be handled similarly). We start by showing how areliable hub set can be found if we are given shortest path trees up to depth d from all vertices of G ,stored in dynamic tree data structures. Lemma 4.1 ([27, 29]) . Let V be a vertex set of size n and let d > be an integer. Let T be a collectionof rooted trees of depth no more than d , whose vertex sets are subsets of V .Let c > be some positive constant. Let B be a random subset of V of size min (cid:0) ⌈ c nd ln n ⌉ , n (cid:1) . Then, B is a ( T , d ) -blocker set with probability at least max(0 , − |T | /n c − ) .Proof. If ⌈ c nd ln n ⌉ ≥ n , then B = V and the lemma obviously holds.Suppose ⌈ c nd ln n ⌉ < n . For each v ∈ V , Pr[ v / ∈ B ] ≤ − c ln nd . Hence, for a fixed T ∈ T and w ∈ T such that dep T ( w ) = d , the probability that neither w nor any of its ancestors in T belong to B is nomore than (cid:0) − c ln nd (cid:1) d +1 ≤ e − c ln n = n − c . Therefore, the probability that this happens for any T and w , is no more than |T | /n c − . 10 emma 4.2. Let V be some set of n vertices. Let F be a forest of (initially single-vertex) rooted out-treesover V such that the vertex sets of the individual trees of F form a partition of V . For v ∈ V , let T v ∈ F denote the unique tree of F containing v .There exists a data structure for dynamically maintaining F (initially consisting of n -vertex trees)and supporting the following operations in O (log n ) time each:1. parent ( v ) : if v is not the root of T v , return its parent. Otherwise return nil .2. link ( u, v ) : assuming T u = T v and that u is the root of T u , make u a child of v in T v .3. cut ( v ) : assuming v is not the root of T v , split T v into two trees by removing the edge between v and its parent.4. depth ( v ) : return the depth of the tree T v .Proof. We store our forest F as a collection of the Euler-tour based dynamic trees of Tarjan [25]. Thisdata structure is capable of maintaining a forest F ′ of unrooted and undirected trees over V such thateach v ∈ V is additionally associated a real value val ( v ) . Similarly, let us denote by T ′ v the unique treeof the forest containing v . The supported operations are as follows: • link ( u, v ) : if T ′ u = T ′ v , then combine T ′ u and T ′ v by adding the edge uv . • cut ( u, v ) : assuming T ′ u = T ′ v and uv ∈ E ( T ′ u ) , break the tree T ′ u into two by removing the edge uv . • change - val ( v, x ) : set val ( v ) := x . • f ind - val ( v ) : return val ( v ) . • add - val ( v, x ) : add x ∈ R to val ( w ) of every vertex w ∈ V ( T ′ v ) . • f ind - max - val ( v ) : return a vertex w with maximum val ( w ) in T ′ v .Even though the data structure of [25] maintains a forest of unrooted undirected trees, we showthat the above operations are sufficient to maintain the depth of each out-tree (which both rooted anddirected) of F .To be able to operate on out-trees, for each vertex v ∈ V , we explicitly store its parent par( v ) in atable (if v is the root of T v , par( v ) = nil ). Initially we set par( v ) = nil for all v ∈ V . parent ( v ) simplyreturns par( v ) . The forest F ′ stored in our data structure of [25] always consists of (undirected) edgesof the form par( v ) v , for v such that par( v ) = nil . Hence, F ′ is initially empty.For each v , we will guarantee that the value val ( v ) maintained by the data structure of [25] is equalto dep T v ( v ) . To this end, we initially perform change - val ( v, for each v ∈ V . By the invatiant posedon the values val ( v ) , and since the depth of any T v is the maximum depth over all its vertices, we canimplement depth ( v ) with f ind - max - val ( v ) . cut ( v ) is implemented as follows. We first record y := f ind - val ( v ) . Then we perform cut (par( v ) , v ) on F ′ and set par( v ) to nil . Afterwards, T v is a tree rooted in v . At this point the values val ( w ) for all w ∈ V ( T v ) exceed the respective depths in T v by exactly y . So, in order to update the vertex depths inthe new tree T v , we perform add - val ( v, − y ) . Clearly, the depths in the other obtained tree (the one thatdoes not contain v ) need not be updated.To implement link ( u, v ) , we first set par( u ) := v . Then, we update the depths in T u before it isconnected to T v by calling add - val ( u, f ind - val ( v ) + 1) . Finally, we call link ( u, v ) .Since each of the operations depth , cut and link translate into a constant number of operations onthe data structure of [25] storing F ′ , all operations run in O (log n ) time. Lemma 4.3.
Let V be a vertex set, n = | V | , and let d > be integral. Let T be a collection of rootedtrees over V of depth no more than d , where |T | = O (poly n ) . Suppose each T ∈ T is given as a separatedata structure of Lemma 4.2 and for each T ∈ T , root( T ) is known.Then, there exists a Las Vegas randomized algorithm computing a ( T , d ) -blocker set B of size O (cid:0) nd log n (cid:1) in O ( |T | · nd · log n ) time with high probability. roof. Let |T | = O ( n α ) for some α > . The algorithm is to simply repeatedly pick random subsets B of V of size min( ⌈ ( α + 2) nd ln n ⌉ , n ) until B succeeds in being a ( T , d ) -blocker set. By Lemma 4.1, fora random B , the probability that this is not the case is at most n . Hence, the probability that we failfinding a ( T , d ) -blocker set after k = O (1) trials is at most /n k .We thus only need to show how to verify whether a set B is actually a ( T , d ) -blocker set in O ( |T | ·| B | log n ) time. Recall that for a single T ∈ T , if the depth of T is no more than d , then B is a ( T, d ) -blocker set if the tree T ′ obtained from T by removing all subtrees rooted in vertices of B , has depthless than d . Consequently, to verify whether B is a ( T, d ) -blocker set, we take advantage of the fact that T is stored in a data structure of Lemma 4.2.We first check whether r = root( T ) ∈ B . If this is the case, B is a ( T, d ) -blocker set in a trivial way.Otherwise, for each b ∈ B , we store p b = parent ( b ) and perform cut ( b ) . Afterwards, one can see that B is a ( T, d ) -blocker set if and only if depth ( r ) < d . Finally, we revert all the performed cut operationsby running link ( b, p b ) for all b ∈ B .Clearly, the time needed to verify whether B is a ( T, d ) -blocker set for any T ∈ T , is O ( | B | log n ) .Hence, one can check whether B is a ( T , d ) -blocker set in O ( |T | · | B | log n ) time.Now we move on to the problem of detecting when a sampled set ceases to be a valid hub set of G .In fact, our algorithm will solve a bit more general problem (which is anyway needed for applications, aswe will see later), as follows.Let | V | = n = a > a > . . . > a q = 1 be some sequence of integers such that a i | a i − . For each i = 0 , . . . , q , let A i be a random a i -subset (a subset of size a i ) of V . By Lemmas 2.10 and 4.1, each A i is in fact an Θ(( n/a i ) ln n ) -hub set of G with high probability.We would like to detect when some A i ceases to be an Θ(( n/a i ) ln n ) -hub set of G while G undergoesedge deletions. Using this terminology, both state-of-the-art Monte-Carlo randomized algorithms fordecremental exact shortest paths [4] and partially-dynamic (1 + ǫ ) -approximate shortest paths [5] (forunweighted digraphs) use randomness only for constructing hub sets A , . . . , A q (they use a i = 2 q − i , butin fact any a i = c q − i , where c is a positive integer, would be sufficient for these algorithms to work),valid simultaneously for all versions of the input graph with high probability (the sets A i satisfy this, aswe will later show).Without loss of generality, we can assume that given the sets A , . . . , A q , the algorithms of [4, 5]proceed deterministically (we discuss these algorithms in a more detailed way in Appendix B). Supposewe develop an efficient partially dynamic algorithm A verifying whether each A i remains a Θ(( n/a i ) ln n ) -hub set of G (i.e., A is supposed to detect that some A i ceases to be a Θ(( n/a i ) ln n ) -hub set immediatelyafter this happens) and producing false negatives with low probability (the algorithm is guaranteed tobe correct if it says that all A i have the desired property but might be wrong saying that some A i is nolonger a hub set). Then, we could use A to convert the algorithms of [4, 5] into Las Vegas algorithmsby drawing new sets A , . . . , A q and restarting the respective algorithms whenever A detects (possiblyincorrectly) that any of these sets ceases to be a hub set. As this does not happen w.h.p., with highprobability the overall asymptotic running time remains unchanged. The remainder of this section isdevoted to describing such an algorithm A . Lemma 4.4.
Let d > be an integer. Let F be a forest of out-trees of depth no more than d over V .Denote by T v the unique tree of F containing v ∈ V . Let B ⊆ V be fixed.There exists a data structure with update time O (log n ) , maintaining the information whether B is a ( F, d ) -blocker set, subject to updates to F of the following types: • cut the subtree rooted in v out of T v where v ∈ V and v is not the root of T v , • make the tree T r a child of v ∈ T v where r ∈ V is the root of T r and v / ∈ T r ,Proof. We use the data structure of Lemma 4.2 to store F . However, each T ∈ F is represented inthis data structure as a collection F T of either | V ( T ) ∩ B | (if the root of T is in B ) or | V ( T ) ∩ B | + 1 (otherwise) trees: the maximal subtrees of T that intersect with B either only in their respective rootsor not at all.Recall that for a single T ∈ F , if the depth of T is no more than d , then B is a ( T, d ) -blocket setif the tree T ′ obtained from T by removing all subtrees rooted in vertices of B has depth less than d .Equivalently, B is a ( T, d ) -blocker set if the depth of all trees of F T is less than d . Consequently, B is a ( F, d ) -blocker set if the depth of all trees of S T ∈ F F T is less than d . This information is easy to maintain12sing the data structure of Lemma 4.2 if this data structure stores F ′ = S T ∈ F F T at all times. This isprecisely what our algorithm does.The first operation can be implemented simply as cut ( v ) on F ′ . To implement the second operation,we first check if r ∈ B . If so, we do nothing, as the vertices of B can only be roots in F ′ . Otherwise,we perform link ( r, v ) . After any link ( r, v ) operation, to update the information whether B is still a ( F, d ) -blocker set, it is sufficient to check whether depth ( v ) < d .The following technical lemma will prove useful. Lemma 4.5.
Let G = ( V, E ) be a directed graph and let B ⊆ V . Let d > be an integer. Let P be apath that is ( B, d ) -covered and | P | ≥ d . Then, one can represent P as P . . . P k such that: • | P i | ∈ [ d, d ] for each i = 1 , . . . , k , • P i starts with a vertex of B for each i = 2 , . . . , k .Proof. By the fact that P = u → v is ( B, d ) -covered, P can be expressed as P = P ′ . . . P ′ l , where P ′ i = u i → v i , | P ′ i | ≤ d for all i and u i ∈ B for all i ≥ . Let us partition the path P ′ . . . P ′ l into subpaths(blocks) P , . . . , P k using the following procedure.At each step P ′ j , . . . , P ′ l ( j ≥ ) will constitute the remaining part of P ′ , . . . , P ′ l to be partitioned and | P ′ j . . . P ′ l | ≥ d . Initially, j = 1 . If | P ′ j . . . P ′ l | ≤ d , the next block P i is set to P ′ j . . . P ′ l and the procedureends. Otherwise, let f be the minimum index such that | P ′ j . . . P ′ f | ≥ d . We set the next block P i to be P ′ j . . . P ′ f . By the definition of f and | P ′ f | ≤ d , we have | P i | = | P ′ j . . . P ′ f | ≤ d and | P ′ f +1 . . . P ′ l | ≥ d .The following lemma says that in order to test whether a given set of vertices is a d -hub set it sufficesto test the hub set property for paths starting in vertices of a d -hub set. Lemma 4.6.
Let G = ( V, E ) be a directed unweighted graph. Let H d be a d -hub set of G . Suppose weare given two collections T from = { T from v : v ∈ H d } , T to = { T to v : v ∈ H d } of shortest path trees up todepth d from all vertices of H d in G and G R , respectively.Let B be a ( T from ∪ T to , d ) -blocker set. Then B is a d -hub set of G .Proof. Let u, v ∈ V be any vertices such that δ G ( u, v ) < ∞ . If δ G ( u, v ) ≤ d , then any shortest u → v path is ( B, d ) -covered. Suppose δ G ( u, v ) > d .Let P be any shortest u → v path in G that is ( H d , d ) -covered. By Lemma 4.5, one can express P as P = P . . . P k where | P i | ∈ [ d, d ] and each P i for i ≥ starts with a vertex of H d . Now define P ′ , . . . , P ′ k as follows. If i ∈ [2 , k ] , then let P i = R i S i where R i = a i → b i , | R i | = d , and set P ′ i = T from a i [ b i ] · S i . For i = 1 , suppose P = R S where | S | = d and S = a → b . Then we set P ′ = R · ( T to b i [ a i ]) R . Clearly,for all i , P ′ i has the same endpoints as P i and | P ′ i | = | P i | . Therefore, P ′ = P ′ . . . P ′ k is also a shortest u → v path.Since | P ′ i | ≤ d , P ′ i is ( B, d ) -covered. Moreover, by the definition of B , for all i we have V ( P ′ i ) ∩ B = ∅ .Hence, by Lemma 2.8, we conclude that P ′ is ( B, d ) -covered.We have thus proved that for all u, v ∈ V , where δ G ( u, v ) < ∞ , some shortest u → v is ( B, d ) -covered.Equivalently, B is a d -hub set of G .Observe that by Lemma 4.1, there exists an integral constant z > , such that for any fixed collectionof trees T of depth no more than z · na i ⌈ ln n ⌉ , where |T | = O ( n ) , A i is a (cid:16) T , z · na i ⌈ ln n ⌉ (cid:17) -blocker setwith high probability. For i = 0 , . . . , q , set d i = z · na i +1 ⌈ ln n ⌉ where a q +1 = 1 . Suppose G undergoespartially dynamic updates. For each i = 1 , . . . , q , and v ∈ V let T from i,v ( T to i,v ) denote the shortest path treethat the algorithm of Theorem 2.3 would maintain for d = d i − and source v in G (in G R , respectively).Note that how the trees T from i,v and T to i,v evolve depends only on the sequence of updates to G (which,by the oblivious adversary assumption, does not depend on sets A , . . . , A q in any way) and the detailsof the deterministic algorithm of Theorem 2.3. Since only O ( mn ) = O ( n ) different trees appear in { T from i,v : v ∈ V } ∪ { T to i,v : v ∈ V } throughout all updates, A i remains a ( { T from i,v : v ∈ V } ∪ { T to i,v : v ∈ V } , d i − ) -blocker set throughout the whole sequence of updates with high probability, by Lemma 4.1.Let T from i = { T from i,v : v ∈ A i − } and T to i = { T to i,v : v ∈ A i − } , i.e., T from i ( T to i ) contains only treeswith roots from a subset A i − ⊆ V . However A i being a blocker set of such a collection of trees will turnout sufficient for our needs. Clearly, since we have T from i ∪ T to i ⊆ { T from i,v : v ∈ V } ∪ { T to i,v : v ∈ V } , by13he above claim, A i in fact remains a ( T from i ∪ T to i , d i − ) -blocker set throughout the whole sequence ofupdates with high probability.Now, let q = ⌈ log n ⌉ and for i = 1 , . . . , q set a i = 6 q − i . To verify whether each A i remains a d i -hubset subject to partially dynamic updates to G , we proceed as follows. We deterministically maintain thetrees S qi =1 ( T from i ∪ T to i ) subject to partially dynamic updates to G using Theorem 2.3. The total numberof changes these trees are subject to throughout the whole sequence of updates is O q X i =1 a i − · m · d i − ! = O q X i =1 a i − · m · na i ln n ! = O nm log n · q X i =1 a i − a i ! = O ( nm log n ) . We additionally store each tree T from i,v (and T to i,v ), for v ∈ A i − , in a data structure of Lemma 4.4with B = A i . Whenever the data structure of Theorem 2.3 updates some tree, the update is repeated inthe corresponding data structure of Lemma 4.4. Consequently, the total time needed to maintain theseadditional data structures is O (cid:16) nm log n · P qi =1 a i − a i (cid:17) = O ( nm log n ) .After each update we can detect whether each A i is still a ( T from i ∪ T to i , d i − ) -blocker set in O ( P qi | A i − | log n ) = O ( n log n ) time by querying the relevant data structures of Lemma 4.4 storing T from i ∪ T to i . By Lemma 4.6, a simple inductive argument shows that if this is the case, each A i is a d i -hub set of both G and G R . Hence, verifying all A , . . . , A q while G evolves takes O ( mn log n ) totaltime. The algorithm terminates when it turns out that some A i is no longer a ( T from i ∪ T to i , d i − ) -blockerset. However, recall that this happens only with low probability, regardless of whether A i actually ceasesto be a d i hub set or not. We have proved the following. Theorem 4.7.
Let G be an unweighted digraph. Let q = ⌈ log n ⌉ . For i = 0 , . . . , q , let A i be a random q − i -subset of V . One can maintain the information whether each A i is a Θ(6 i ln n ) -hub set of G , subjectedge deletions issued to G , in O ( nm log n ) total time.The algorithm might produce false negatives with low probability. By plugging in the hubs of Theorem 4.7 into the algorithms of [4, 5], we obtain the following.
Corollary 4.8.
Let G be an unweighted digraph. There exists a Las Vegas randomized decrementalalgorithm maintaining exact distance between all pairs of vertices of G with e O ( n ) total update timew.h.p. It assumes an adversary oblivious to the random bits used. Corollary 4.9.
Let G be an unweighted digraph. There exists a Las Vegas randomized decrementalalgorithm maintaining (1+ ǫ ) -approximate distance estimates between all pairs of vertices of G in e O ( nm/ǫ ) total time w.h.p. The algorithm assumes an oblivious adversary. In this section we generalize the reliable hub maintenance algorithms to weighted graphs, at the cost of (1 + ǫ ) -approximation. First we we give key definitions. Definition 5.1.
Let G = ( V, E ) be a weighted digraph and let s ∈ V be a source vertex. Let d be a positiveinteger. An out-tree T ⊆ G is called a (1 + ǫ ) -approximate shortest path tree from s up to depth d , if T isrooted at s and for any v ∈ V such that δ dG ( s, v ) < ∞ , we have v ∈ V ( T ) and δ T ( s, v ) ≤ (1 + ǫ ) δ dG ( s, v ) . Definition 5.2.
Let G = ( V, E ) be directed and let d > be an integer. A set H ǫd ⊆ V is called an (1 + ǫ ) -approximate d -hub set of G if for every u, v ∈ V such that δ G ( u, v ) < ∞ , there exists a path P = u → v in G such that ℓ ( P ) ≤ (1 + ǫ ) δ G ( u, v ) and P is ( H ǫd , d ) -covered. We also extend the definition of a ( T, d ) -blocker set to trees of depth more than d . The Even-Shiloach algorithm (Theorem 2.3), apart from maintaining distance labels for all v ∈ V , moves around entiresubtrees of the maintained tree T . Hence, in order to ensure that some set B remains a blocker-set of T , it is not sufficientto simply check whether B ∩ V ( T [ v ]) whenever the Even-Shiloach algorithm changes the distance label of v to d (and,consequently, use a data structure much simpler than that given in Lemma 4.4). efinition 5.3. Let V be a vertex set and let d > be an integer. Let T be a rooted tree over V . Define T d to be the set of all maximal subtrees of T of depth no more than d , rooted in non-leaf vertices x ∈ V ( T ) satisfying d | dep T ( x ) . In other words, the set T d can be obtained from the tree T be repeatedly taking adeepest non-leaf vertex x of T such that dep T ( x ) is divisible by d , inserting the subtree of T rooted in x into T d and consequently removing all the descendants of x out of T .Then, B is a ( T, d ) -blocker set if and only if it is a ( T d , d ) -blocker set (in terms of Definition 2.5). Let T be a collection of rooted trees over V . We call B a ( T , d ) -blocker set if and only if B is a ( T, d ) -blockerfor each T ∈ T . We now state the main theorem relating blocker sets in (1 + ǫ ) -approximate shortest path trees tothe approximate hub sets. The theorem is proved in Section 5.1. Theorem 5.4.
Let G = ( V, E ) be a directed graph and let d < n be an even integer. Let T from = { T from v : v ∈ V } ( T to = { T to v : v ∈ V } ) be a collection of (1 + ǫ ) -approximate shortest path trees up to depth- d from all vertices in G (in G R , resp.).Let B ⊆ V be a ( T from ∪ T to , d ) -blocker set. Then B is a (1 + ǫ ) p -approximate dp -hub set of G ,where p = ⌈ log n ⌉ + 1 . Finally, we explain how to incorporate these tools into our improved dynamic APSP algorithms inorder to generalize then to weighted graphs. Recall that our reliable hubs maintenance algorithms forunweighted graphs essentially maintained some shortest path trees up to depth d and either computedtheir blocker sets using King’s algorithm, or dynamically verified whether the sampled hub sets remainblocker sets of the shortest path trees.We first replace all shortest path trees up to depth d with (1 + ǫ ) -approximate shortest path trees upto depth d . We use the following extension of Bernstein’s h -SSSP algorithm. Lemma 5.5.
The h -SSSP algorithm of Theorem 2.4 can be extended so that it maintains a (1 + ǫ ) -approximate shortest path tree up to depth h from s within the same time bound.Proof. The h -SSSP data structure (see [5]) actually maintains O (log( nW )) h -SSSP k data structures,handling different ranges of the distances to be estimated. For each k = 0 , . . . , ⌊ log nW ⌋ , the h -SSSP k data structure maintains an out-tree T k ⊆ G rooted at s , such that for all v ∈ V , if k ≤ δ dG ( s, v ) ≤ k +1 ,then v ∈ V ( T k ) and δ G ( s, v ) ≤ δ T k ( s, v ) ≤ (1 + ǫ ) δ dG ( s, v ) . The final (1 + ǫ ) -approximate estimate δ ′ ( s, v ) of δ dG ( s, v ) produced by h -SSSP is defined as δ ′ ( s, v ) = min k { δ T k ( s, v ) : v ∈ V ( T k ) } . Even though each h -SSSP k has total update time O ( mh/ǫ + ∆) , Bernstein [5] uses additional data structures and tricks tomake different h -SSSP k components register only relevant edge updates and make the dependence on ∆ only O (∆) .Nevertheless, all h -SSSP k components maintain their trees T k explicitly in the stated O ( mh/ǫ log n log nW + ∆) total time. Having a single out-tree instead of ⌊ log nW ⌋ + 1 will simplify ourfurther developments considerably. Therefore, we combine these trees T k into a single (1+ ǫ ) -approximateshortest path tree T up to depth d from s , as follows.The h -SSSP algorithm [5] has an additional property that it explicitly maintains, for each vertex v = s ,both the value δ ′ ( s, v ) and the index k v of the tree T k v such that δ ′ ( s, v ) = δ T kv ( s, v ) = min k { δ T k ( s, v ) : v ∈ V ( T k ) } . Whenever k v is updated for some v , we make par T kv ( v ) the new parent of v in T and theedge par T kv ( v ) v = e ∈ E ( T k v ) the only incoming edge of v in T . When δ ′ ( s, v ) becomes ∞ , v is removedfrom T .We first prove that by proceeding this way, T actually remains a tree, or, in other words, the edgesof the form par T ( v ) v , where v ∈ V ( T ) \ { s } , form an out-tree that is a subgraph of G . Since each vertexin T except of s (which has outgoing edges) has exactly one incoming edge, we only need to prove that T has no directed cycles. For contradiction, suppose there is a cycle e . . . e k in T , where e i = u i u i +1 , u k +1 = u and u i = par T ( u i +1 ) for all i = 1 , . . . k . Consider some edge e i . We have u i = par T ( u i +1 ) =par T kui +1 ( u i +1 ) and hence δ ′ ( s, u i +1 ) = δ T kui +1 ( s, u i +1 ) = δ T kui +1 ( s, u i ) + w T kui +1 ( u i u i +1 ) for some l .Recall that G has positive edge weights and T k ui +1 ⊆ G . As a result δ ′ ( s, u i +1 ) > δ T kui +1 ( s, u i ) ≥ δ ′ ( s, u i ) .This way we obtain δ ′ ( s, u ) = δ ′ ( s, u k +1 ) > δ ′ ( s, u k ) > . . . > δ ′ ( s, u ) , a contradiction.Second, we prove that for all v ∈ V ( T ) we have δ T ( s, v ) ≤ δ ′ ( s, v ) . We proceed by induction on dep T ( v ) . If s = v , this is clearly true. Otherwise, let dep T ( v ) > and suppose the claim holds for all15ertices of T of smaller depth. Let p = par T ( v ) . By the inductive hypothesis, we have δ T ( s, p ) ≤ δ ′ ( s, p ) .By the definition of T , we also have p = par T kv ( v ) and w T ( p, v ) = w T kv ( p, v ) . Hence, δ ′ ( s, v ) = δ T kv ( s, p ) + w T kv ( p, v ) ≥ δ ′ ( s, p ) + w T ( p, v ) ≥ δ T ( s, p ) + w T ( p, v ) = δ T ( s, v ) . Finally, note that as the h -SSSP algorithm guarantees that δ ′ ( s, v ) ≤ (1 + ǫ ) δ dG ( s, v ) , we also have δ T ( s, v ) ≤ (1 + ǫ ) δ dG ( s, v ) . Clearly, as T ⊆ G , for all v ∈ V ( T ) we have δ T ( s, v ) ≥ δ G ( s, v ) .By Theorem 5.4, by finding blocker sets of approximate shortest path trees (as in Definition 5.3), wecan compute/verify (1 + ǫ ′ ) Θ(log n ) -approximate Θ( d log n ) -hub sets as before.Given appropriate hub sets, all that both our deterministic incremental (1 + ǫ ) -approximate APSPalgorithm, and Bernstein’s randomized (1 + ǫ ) -approximate partially dynamic APSP algorithm do, isessentially set up and maintain a “circuit” (i.e., a collection of data structures whose outputs constitutethe inputs of other structures) of h -SSSP data structures from the hubs with different parameters h andappropriately set ǫ ′ . In order to make these algorithms work with our reliable approximate hub sets, webasically need to play with the parameters: increase all h ’s by a polylogarithmic factor, and decrease ǫ ′ by a polylogarithmic factor. We discuss the details in Appendix C. Lemma 5.6.
Let T be a rooted tree over V . Let d be a positive integer and suppose B ⊆ V is a ( T, d ) -blocker set (with respect to Definition 5.3). Then for any v ∈ V ( T ) , the path T [ v ] is ( B, d ) -covered.Proof. By the definition of B , T [ v ] can be expressed as P . . . P k , P i = u i → v i , where | P i | = d and V ( P i ) ∩ B = ∅ for i = 1 , . . . , k − and | P k | ≤ d . This is because each for such i we have d | dep T ( u i ) and P i is a root-leaf path in some tree of the set T d obtained from T using Definition 5.3. Since each P i is trivially ( B, d ) -covered and P k is the only subpath that may not contain a vertex of B , by Lemma 2.8we conclude that T [ v ] is indeed ( B, d ) -covered. Lemma 5.7.
Let G = ( V, E ) be a directed graph and let d > be an even integer. Let H ⊆ V . Let T from = { T from v : v ∈ H } ( T to = { T to v : v ∈ H } ) be a collection of (1 + ǫ ) -approximate shortest path treesup to depth- d from H in G (in G R , resp.).Let B ⊆ V be a ( T from ∪T to , d ) -blocker set. Then, for any path P = u → v in G that is ( H, d ) -coveredand integer j ≥ , if | P | ≤ j d , then there exists a path P ′ = u → v in G such that ℓ ( P ′ ) ≤ (1 + ǫ ) j · ℓ ( P ) and P ′ is ( B, d ( j + 1)) -covered.Proof. We proceed by induction on j . For j = 0 , j + 1 = 2 j so P ′ = P has the required properties since P has no more than d ≤ d edges.Let j > and suppose the lemma holds for all j ′ < j . If | P | ≤ d · j − , then P ′ exists by the inductivehypothesis. Assume | P | > d · j − = d .By Lemma 4.5, we can partition P into s ≥ subpaths P , . . . , P s , where P i = u i → v i , such that | P i | ∈ [ d, d ] for all i = 1 , . . . , s and u i ∈ H for all i = 2 , . . . , s .Since P i has no more than d edges, for each i ∈ { , . . . , s } we have ℓ ( T from u i [ v i ]) = δ T from ui ( u i , v i ) ≤ (1 + ǫ ) δ dG ( u i , v i ) ≤ (1 + ǫ ) ℓ ( P i ) , whereas for i = 1 we have ℓ ( T to v [ u ]) = δ T to v ( v , u ) ≤ (1 + ǫ ) δ dG ( u , v ) ≤ (1 + ǫ ) ℓ ( P ) . For i = 1 , let Q = ( T to v [ u ]) R , whereas for i = 2 , . . . , s , set Q i = T from u i [ v i ] . Then we clearly have ℓ ( Q i ) ≤ (1 + ǫ ) ℓ ( P i ) for all i .Let Q ′ , . . . , Q ′ r be a partition of Q . . . Q s into blocks, i.e., Q ′ i = Q t i Q t i +1 . . . Q t i +1 − , where t Let G = ( V, E ) be a directed graph and let d > be an even integer. Let H ǫd be a (1 + ǫ ) q -approximate d -hub set of G .Let T from = { T from v : v ∈ H ǫd } ( T to = { T to v : v ∈ H ǫd } ) be a collection of (1 + ǫ ) -approximate shortestpath trees up to depth- d from vertices of H ǫd in G (in G R , resp.).Let B ⊆ V be a ( T from ∪ T to , d ) -blocker set. Then B is a (1 + ǫ ) p + q − -approximate dp -hub set of G , where p = ⌈ log n ⌉ + 1 .Proof. To prove that B is in fact a (1 + ǫ ) p + q − -approximate dp -hub set for G , let u, v ∈ V be suchthat δ G ( u, v ) < ∞ and take any path P from u to v that is ( H ǫd , d ) -covered and ℓ ( P ) ≤ (1 + ǫ ) q δ G ( u, v ) .As | P | ≤ n and d ≥ , P clearly has less than d p − edges.Therefore, by Lemma 5.7 (for H = H ǫd ), there exists a path P ′ = u → v in G such that ℓ ( P ′ ) ≤ (1 + ǫ ) p − ℓ ( P ) ≤ (1 + ǫ ) p + q − δ G ( u, v ) and P ′ is ( B, dp ) -covered.In order to prove Theorem 5.4, just apply Corollary 5.8 with q = 1 .17 eferences [1] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lowerbounds for dynamic problems. In , pages 434–443, 2014. doi:10.1109/FOCS.2014.53 .[2] Ittai Abraham, Shiri Chechik, and Sebastian Krinninger. Fully dynamic all-pairs shortest pathswith worst-case update-time revisited. In Philip N. Klein, editor, Proceedings of the Twenty-EighthAnnual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel PortaFira, January 16-19 , pages 440–452. SIAM, 2017. doi:10.1137/1.9781611974782.28 .[3] Giorgio Ausiello, Giuseppe F. Italiano, Alberto Marchetti-Spaccamela, and Umberto Nanni. In-cremental algorithms for minimal length paths. In Proceedings of the First Annual ACM-SIAMSymposium on Discrete Algorithms, 22-24 January 1990, San Francisco, California, USA. , pages12–21, 1990.[4] Surender Baswana, Ramesh Hariharan, and Sandeep Sen. Improved decremental algorithms formaintaining transitive closure and all-pairs shortest paths. J. Algorithms , 62(2):74–92, 2007. doi:10.1016/j.jalgor.2004.08.004 .[5] Aaron Bernstein. Maintaining shortest paths under deletions in weighted directed graphs. SIAM J.Comput. , 45(2):548–574, 2016. doi:10.1137/130938670 .[6] Aaron Bernstein and Liam Roditty. Improved dynamic algorithms for maintaining approximateshortest paths under deletions. In Proceedings of the Twenty-Second Annual ACM-SIAM Symposiumon Discrete Algorithms, SODA 2011, San Francisco, California, USA, January 23-25, 2011 , pages1355–1365, 2011. doi:10.1137/1.9781611973082.104 .[7] Camil Demetrescu and Giuseppe F. Italiano. Fully dynamic transitive closure: Breakingthrough the O ( n ) barrier. In , pages 381–389, 2000. doi:10.1109/SFCS.2000.892126 .[8] Camil Demetrescu and Giuseppe F. Italiano. A new approach to dynamic all pairs shortest paths. J. ACM , 51(6):968–992, 2004. doi:10.1145/1039488.1039492 .[9] Camil Demetrescu and Giuseppe F. Italiano. Fully dynamic all pairs shortest paths with real edgeweights. J. Comput. Syst. Sci. , 72(5):813–837, 2006. doi:10.1016/j.jcss.2005.05.005 .[10] Shimon Even and Yossi Shiloach. An on-line edge-deletion problem. J. ACM , 28(1):1–4, 1981. doi:10.1145/322234.322235 .[11] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. Sublinear-time decrementalalgorithms for single-source reachability and shortest paths on directed graphs. In Symposium onTheory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014 , pages 674–683,2014. doi:10.1145/2591796.2591869 .[12] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. A subquadratic-time algorithmfor decremental single-source shortest paths. In Proceedings of the Twenty-Fifth Annual ACM-SIAMSymposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014 , pages1053–1072, 2014. doi:10.1137/1.9781611973402.79 .[13] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. Improved algorithms for decre-mental single-source reachability on directed graphs. In Automata, Languages, and Programming -42nd International Colloquium, ICALP 2015, Kyoto, Japan, July 6-10, 2015, Proceedings, Part I ,pages 725–736, 2015. doi:10.1007/978-3-662-47672-7\_59 .[14] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. Dynamic approximate all-pairsshortest paths: Breaking the O ( mn ) barrier and derandomization. SIAM J. Comput. , 45(3):947–1006, 2016. doi:10.1137/140957299 . 1815] Monika Rauch Henzinger and Valerie King. Fully dynamic biconnectivity and transitive closure. In , pages 664–672, 1995. doi:10.1109/SFCS.1995.492668 .[16] Monika Rauch Henzinger and Valerie King. Randomized dynamic graph algorithms with poly-logarithmic time per operation. In Proceedings of the Twenty-Seventh Annual ACM Symposiumon Theory of Computing, 29 May-1 June 1995, Las Vegas, Nevada, USA , pages 519–527, 1995. doi:10.1145/225058.225269 .[17] Jacob Holm, Kristian de Lichtenberg, and Mikkel Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM ,48(4):723–760, 2001. doi:10.1145/502090.502095 .[18] Bruce M. Kapron, Valerie King, and Ben Mountjoy. Dynamic graph connectivity in polylogarithmicworst case time. In Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on DiscreteAlgorithms, SODA 2013, New Orleans, Louisiana, USA, January 6-8, 2013 , pages 1131–1142, 2013. doi:10.1137/1.9781611973105.81 .[19] Valerie King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closurein digraphs. In , pages 81–91, 1999. doi:10.1109/SFFCS.1999.814580 .[20] Liam Roditty and Uri Zwick. Improved dynamic reachability algorithms for directed graphs. SIAMJ. Comput. , 37(5):1455–1471, 2008. doi:10.1137/060650271 .[21] Liam Roditty and Uri Zwick. On dynamic shortest paths problems. Algorithmica , 61(2):389–401,2011. doi:10.1007/s00453-010-9401-5 .[22] Liam Roditty and Uri Zwick. Dynamic approximate all-pairs shortest paths in undirected graphs. SIAM J. Comput. , 41(3):670–683, 2012. doi:10.1137/090776573 .[23] Piotr Sankowski. Dynamic transitive closure via dynamic matrix inverse (extended abstract). In , pages 509–517, 2004. doi:10.1109/FOCS.2004.25 .[24] Daniel Dominic Sleator and Robert Endre Tarjan. A data structure for dynamic trees. J. Comput.Syst. Sci. , 26(3):362–391, 1983. doi:10.1016/0022-0000(83)90006-5 .[25] Robert Endre Tarjan. Dynamic trees as search trees via euler tours, applied to the network simplexalgorithm. Math. Program. , 77:169–177, 1997. doi:10.1007/BF02614369 .[26] Mikkel Thorup. Near-optimal fully-dynamic graph connectivity. In Proceedings of the Thirty-SecondAnnual ACM Symposium on Theory of Computing, May 21-23, 2000, Portland, OR, USA , pages343–350, 2000. doi:10.1145/335305.335345 .[27] Jeffrey D. Ullman and Mihalis Yannakakis. High-probability parallel transitive-closure algorithms. SIAM J. Comput. , 20(1):100–125, 1991. doi:10.1137/0220006 .[28] Christian Wulff-Nilsen. Faster deterministic fully-dynamic graph connectivity. In Proceedings of theTwenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2013, New Orleans,Louisiana, USA, January 6-8, 2013 , pages 1757–1769, 2013. doi:10.1137/1.9781611973105.126 .[29] Uri Zwick. All pairs shortest paths using bridging sets and rectangular matrix multiplication. J.ACM , 49(3):289–317, 2002. doi:10.1145/567112.567114 .19 Deterministic Incremental Algorithm for Dense Graphs Let us focus on the restricted version of the problem – this assumption can be dropped by applyingLemma 2.1. So, ∆ = O ( n log W/ǫ ) .Let use k = ⌈ log n ⌉ layers of n h -SSSP data structures (see Theorem 2.4) with h = 2 . Let ǫ = ǫ/ k .For i = 1 , . . . , k , and v ∈ V the data structure D i,v will maintain distance estimates δ ′ i,v ( w ) , satisfying δ G ( v, w ) ≤ δ ′ i,v ( w ) ≤ (1 + ǫ ) i − δ i G ( v, w ) . (1)Clearly, since δ k G ( v, w ) = δ G ( v, w ) for all v, w ∈ V , data structures D k,v will maintain (1 + ǫ ) k ≤ (1 + ǫ ) approximate distances from v to all other vertices.We achieve that by making setting up D i,v to be a h -SSSP data structure with h = 2 run from v on: • either the input graph G if i = 1 , • or a complete graph G i on V with edge weights equal to the estimates produced by the previouslayer, i.e., w G i ( uv ) = δ ′ i − ,u ( v ) .Then, inequality (1) follows easily by induction.Recall that for dense graphs, the h -SSSP algorithm [5] runs in O ( n h log n log ( nW ) /ǫ + ∆) time andupdates some of its estimates O ( nh log ( nW ) /ǫ ) times. In our case, whenever D i − ,u updates δ ′ i − ,u ( v ) = w G i ( uv ) , we send that update to all data structures D i, · run on G i . Let ∆ i,v be the number of times D i,v updates some of its estimates. Then, ∆ i,v = O ( n log ( nW ) /ǫ ) and thus the total running time ofthe algorithm can be seen to be O X v ∈ V ∆ + k X i =1 X v ∈ V n log n log ( nW ) /ǫ + k X i =2 X v ∈ V X w ∈ V ∆ i − ,w ! = O ( n log n log ( nW ) /ǫ ) . B Details of the State-Of-the-Art Decremental APSP Algorithms B.1 The Algorithm of Baswana et al. [4] Given Hub Sets The algorithm of Baswana et al. [4] explicitly maintains the matrix of pairwise distances between thevertices of an unweighted digraph under edge deletions in O ( n log n ) total time. The algorithm isMonte Carlo randomized. Below we briefly describe how to turn it into a Las Vegas algorithm runningin time O ( n log n + nm log n ) = O ( n log n ) .Let the sets A , . . . , A q be defined as before (i.e., a i = 6 q − i ). The algorithm of Baswana et al. [4] canbe rephrased using our terminology as follows. The set A i is used to maintain the values δ ′ i ( u, v ) suchthat δ ′ i ( u, v ) ≥ δ ( u, v ) and additionally δ ′ i ( u, v ) = δ ( u, v ) if δ ( u, v ) ∈ [ t i + 1 , t i +1 ] . The thresholds t i aredefined as follows: t = − , t i = min( d i , n − for i = 1 , . . . , q and t q +1 = n − .Clearly, the intervals [ t i + 1 , t i +1 ] cover the entire range [0 , n − of possible distances, so for any u, v ∈ V we have min qi =0 { δ ′ i ( u, v ) } = δ ( u, v ) .It remains to show how to maintain the values δ ′ i ( u, v ) . For each i = 0 , . . . , q and v ∈ A i we maintainshortest path trees T from i,v and T to i,v up to depth t i +1 in G and G R , respectively. We keep each δ ′ i ( u, v ) equal to δ ′ i ( u, v ) = min a ∈ A i n δ T to i,a ( a, u ) + δ T from i,v ( a, v ) o . To see that this is correct, note that since A = V and A i is a d i -hub set, then for each u, v suchthat δ ( u, v ) ∈ [ t i + 1 , t i +1 ] , δ ( u, v ) > d i and hence there exists some shortest P = u → v path that goesthrough some vertex of a ∈ A i . Equivalently, P = P P , where P = u → a and P = a → v and both P and P are shortest and | P i | ≤ | P | ≤ t i +1 . Consequently, | P | = | P | ∪ | P | = δ T to i,a ( a, u ) + δ T from i,v ( a, v ) .To keep δ ′ i ( u, v ) updated, whenever some δ T to i,a ( a, u ) (or δ T from i,v ( a, v ) ) changes we go through all v ∈ V ( u ∈ V , resp.), and set δ ′ i ( u, v ) := min( δ ′ i ( u, v ) , δ T to i,a ( a, u ) + δ T from i,v ( a, v )) . Observe that each δ T to i,a ( a, u ) (similarly ( δ T from i,v ( a, v ) ) changes at most t i +1 = O ( d i ) times and each such changes is followed by a20omputation that runs in O ( n ) time. The total time needed for updating the values δ ′ i ( u, v ) (apart frommaintaining the trees themselves) is hence O q X i =1 | A i | · n · d i · n ! = O q X i =1 n log n ! = O ( n log n ) . The total time needed to maintain the needed shortest path trees is also O q X i =1 | A i | · md i ! = O q X i =1 mn log n ! = O ( mn log n ) = O ( n log n ) . Combining with our hub set verification procedure, we obtain a Las Vegas algorithm running in O ( n log n + mn log n ) time with high probability. B.2 The Algorithm of Bernstein [5] Given Hub Sets Bernstein [5] showed that (1 + ǫ ) -approximate distance estimates between all pairs of vertices of anunweighted digraph G subject to partially dynamic updates can be maintained in O ( mn log n/ǫ ) totaltime. The algorithm is Monte Carlo randomized and assumes an oblivious adversary.Given the sets A , . . . , A q , the algorithm works as follows. For each subsequent i = q, . . . , , for ( u, v ) ∈ ( A i × V ) ∪ ( V × A i ) it maintains estimates δ ′ i ( u, v ) satisfying δ G ( u, v ) ≤ δ ′ i ( u, v ) ≤ (1 + ǫ ′ ) q − i +1 δ G ( u, v ) . For i = q , the values δ ′ q ( u, v ) are maintained using h -SSSP data structures of Theorem 2.4 run on G and G R from the only vertex of A q for h = n . This takes O ( mn log n/ǫ ′ ) time.For i < q on the other hand, the distance estimates δ ′ i ( u, · ) and δ ′ i ( · , u ) , where u ∈ A i , are maintainedusing h -SSSP data structures of Theorem 2.4 run for h = d i +1 +1 on G i,u and G R i,u , where G i,u = G ∪ S i,u , S i,u = ( V, { uv : v ∈ A i +1 } ) , and w S i,u ( uv ) = δ ′ i +1 ( u, v ) . Using the assumption that δ ′ i +1 ( x, y ) ≤ (1 + ǫ ′ ) q − i δ G ( x, y ) which holds for x ∈ V and y ∈ A i +1 , one can show that δ d i +1 +1 G i,u ( u, v ) ≤ (1 + ǫ ′ ) q − i δ G ( u, v ) for v ∈ V and hence δ ′ i ( u, v ) ≤ (1+ ǫ ′ ) q − i +1 δ G ( v, u ) . Consequently, the total cost of maintaining estimates δ ′ i ( u, · ) and δ ′ i ( · , u ) is O ( a i · d i +1 m log n/ǫ ′ ) . As we set a i = 6 q − i and we have d i +1 = O ( n/a i ) , this totalcost is in fact O ( nm log n/ǫ ′ ) .In total, as q = O (log n ) and we set ǫ ′ = Θ( ǫ/ log n ) , the total update time is O ( nm log n/ǫ ) .Hence, combining Bernstein’s algorithm with our verification procedure yields a Las Vegas algorithmwith asymptotically the same running time with high probability. C Using Reliable Hubs in Algorithms for Weighted Digraphs C.1 Deterministic Incremental APSP In order to adjust the data structure of Section 3 so that it supports edge weights, we do the follow-ing. Assume wlog. that we solve the restricted problem (see Section 2). First, instead of maintainingexact shortest paths between nearby vertices in G , we maintain collections T from and T to of (1 + ǫ ′ ) -approximate shortest path trees up to depth- d from all vertices of V in G and G R respectively. Tothis end, we use data structures of Theorem 2.4. Consequently, the total time spent in this componentis O ( mnd log n log ( nW ) /ǫ ′ ) , as only O ( m log W/ǫ ′ ) updates are issued to any h -SSSP data structuremaintaining the approximate shortest path trees.Next, the d -hub set H d is replaced with a (1 + ǫ ′ ) p -approximate d ′ -hub set H d ′ , also of size O ( nd log n ) ,where d ′ = Θ( d log n ) and p = Θ(log n ) . By Theorem 5.4, such a hub set can be computed deterministi-cally at the beginning of each phase in O ( n log n ) time using Lemma 2.6. An analogue of Lemma 3.1also holds for approximate hub sets and therefore whenever uv is added to the graph of the weight of uv is decreased, { u, v } is added to H ǫd ′ . Bernstein [5] showed that even for weighted graphs, but in this section we concentrate on the unweighted case. Weexplain the modifications needed for the weighted version in Section 5. O (cid:16) mdn log n | H d ′ | log n log ( nW ) /ǫ ′ (cid:17) = O (cid:16) m (cid:0) nd (cid:1) log n log ( nW ) /ǫ ′ (cid:17) total time.However, since H d ′ is now only a (1 + ǫ ′ ) p -approximate d ′ -hub set, we need to explicitly maintain theestimates of distances δ d ′ G ( u, v ) for u, v ∈ H d ′ (the algorithm already maintains approximate shortestpath trees up to depth d , but d ′ = Θ( d log n ) .) For this, we need O ( n ) data structures of The-orem 2.4, run with h = d ′ . Throughout the whole update sequence, these data structures require O ( mnd ′ log n log ( nW ) /ǫ ′ ) = O ( mnd log n log ( nW ) /ǫ ′ ) time. Observe that this component produces (1 + ǫ ′ ) -approximate distance estimates between pairs of hubs H d ′ .The remaining two components producing the estimates between H d ′ × V and subsequently V × V , arealso analogous to those in Section 3. The only change is that H d ′ is now a (1+ ǫ ) p -approximate d ′ -hub set,instead of an (exact) d -hub set, so the parameter h in the used data structures of Theorem 2.4 needs tobe appropriately increased. The total time used by these components is again O ( mnd log n log ( nW ) /ǫ ′ ) .The final estimates are (1 + ǫ ′ ) p +4 -approximate, so we set ǫ ′ = ǫ/ (2 p + 8) in order to obtain (1 + ǫ ) -approximate distance estimates. Theorem C.1. Let G be a weighted directed graph. There exists a deterministic incremental algorithmmaintaining (1 + ǫ ) -approximate distance estimates between all pairs of vertices of G in O ( mn / log n log ( nW ) /ǫ + ∆) total time.Proof. The total update time is O (cid:18) m (cid:16) nd (cid:17) log n log( nW ) /ǫ ′ + mnd log n log( nW ) /ǫ ′ (cid:19) = O (cid:16) mn (cid:16) nd log n + d (cid:17) log n log( nW ) /ǫ (cid:17) . Hence, the described algorithm solving the restricted version of the problem is asymptotically the mostefficient if d = n / log n . By applying Lemma 2.1, we obtain the desired bound. C.2 Bernstein’s Partially-Dynamic APSP Let α = 2( ⌈ log n ⌉ + 1) and set q = ⌈ log α n ⌉ . Let a = n and a i = α q − i for i = 1 , . . . , q . By increasing n by at most a factor of , we may assume that a i +1 | a i for all i > . Again p = ⌈ log n ⌉ + 1 , so α = 2 p . Similarly as in Section 4, let A i be a random a i -subset of V and let d i = z · na i +1 ⌈ ln n ⌉ , where z is such a constant that, with high probability, A i is a ( T , z · n a i ⌈ ln n ⌉ ) = ( T , d i − ) -blocker set for anyfixed collection T of trees over V such that |T | = O ( mn/ǫ ′ ) , where ǫ ′ is to be set later.We proceed similarly as in Section 4, and maintain, for each i = 1 , . . . , q , collections T from i and T to i of depth- d i − (1 + ǫ ′ ) -approximate shortest path trees from all vertices of A i − in both G and G R . Wenow prove that as long as A i remains a ( T from i ∪ T to i , d i − ) -blocker set, it is a (1 + ǫ ′ ) ip -approximate d i -hub set of both G and G R .Clearly, since A = V , A is a (1 + ǫ ′ ) approximate d hub set of both G and G R . Now suppose i ≥ .We apply Corollary 5.8 with H ǫd = A i − , q = ( i − p , d = d i − , T from = T from i , T to = T to i , and B = A i ,and obtain that A i is a (1 + ǫ ′ ) p +( i − p = (1 + ǫ ′ ) ip -approximate d i − p = d i p · a i +1 a i = d i pα = d i -hubset of both G and G R .If we additionally store the individual trees of T from i ∪ T to i in data structures of Lemma 4.4 (firstsplitting the trees into maximal subtrees of depth d i − , as in Definition 5.3), then the hub sets A i canbe verified in O q X i =1 a i − · md i − log n log ( nW ) /ǫ ′ ! = O nm log n log ( nW ) q X i =1 a i − a i /ǫ ′ ! = O ( nm log n log ( nW ) /ǫ ′ ) total time.Let x i be such that Bernstein’s algorithm maintains the (1 + ǫ ′ ) x i -approximate distance estimates δ ′ i ( u, v ) for ( u, v ) ∈ ( A i × V ) ∪ ( V × A i ) using the (1 + ǫ ′ ) x i +1 -approximate distance estimates δ ′ i +1 ( · , · ) and the (1 + ǫ ′ ) ( i +1) p -approximate hub set A i +1 . One can easily show that the estimates δ ′ i ( · , · ) are infact (1 + ǫ ′ ) x i +1 +( i +1) p +1 -approximate. Hence, we have x q = 1 and x i = x i +1 + ( i + 1) p + 1 for all i < q ,22o we conclude that x i = 1 + P qj = i +1 jp and therefore x = Θ( q p ) . Consequently, the final estimatesare (1 + ǫ ′ ) Θ( q p ) = (1 + ǫ ′ ) Θ(log n ) -approximate.Recall from Section B.2, that given hub sets, Bernstein’s algorithm runs in O q − X i =0 a i · d i +1 m log n log ( nW ) /ǫ ′ ! = O nm log n log ( nW ) q − X i =0 a i a i +2 /ǫ ′ ! = O ( nm log n log ( nW ) /ǫ ′ ) total time. By setting ǫ ′ = Θ( ǫ/ log n ) , we get O ( nm log n log ( nW ) /ǫ + ∆) total update time withhigh probability. We have thus proved the following theorem. Theorem C.2. Let G be a weighted directed graph. There exists a partially-dynamic algorithm maintain-ing (1+ ǫ ) -approximate distance estimates between all pairs of vertices of G in O ( mn log n log ( nW ) /ǫ +∆) total time. The algorithm is Las Vegas randomized and assumes an oblivious adversary.total time. The algorithm is Las Vegas randomized and assumes an oblivious adversary.