The incorporation of numerical and optimization tools into graph algorithms has been a highly successful approach in algorithm design. It is key to the current best results for several fundamental problems in combinatorial optimization, such as approximate maximum flow [CKM11, She13, KLOS14, Pen16], multi-commodity flow [She17], shortest path and weighted matching [CMSV17]. For dynamic graphs undergoing edge modifications, core components from these algorithms such as graph partitioning, have also played an important role in recent developments on dynamic minimum spanning forest with worst-case guarantees [Wul17, NSW17, NS17]. The versatility of these tools in the static setting suggests that they can extend to wider ranges of problems on dynamic graphs.
Dynamic graph algorithms seek to maintain solutions to certain problems on graphs as they undergo edge insertions and deletions in time faster than recomputing the solution from scratch after each update. It is a subject that has been studied extensively in data structures, with problems being maintained including or connectivity [EGIN97, HDLT01, HRW15], shortest paths [HKN14, HKN16, BC16, ACK17], global minimum cut [Hen97, Tho07, LS11, GHT16], maximum matching [OR10, GP13, BHN16], and maximal matching [BGS15, NS16, Sol16]. On general graphs, these results give sub-linear time only under significant restrictions to the queries, e.g., global minimum cut, -edge connectivity, size of maximum matching (which equals to the value of a particular max-flow), and shortest paths from a fixed source. Relaxing such restrictions, specifically maintaining solutions to more general problems on dynamic graphs, is a major area of ongoing research in data structures.
A more unified view of these problems is through the optimization or the numerical algorithms perspective. In the undirected setting, where much work on dynamic graph algorithms has taken place, the maximum flow problem and the shortest path problem correspond to minimizing the and the
objectives of flows meeting a certain demand, respectively. A natural interpolation is theobjective, otherwise known as the electrical flow problem. In the static setting, primitives have been instrumental in recent works on faster graph algorithms [CKM11, Mad13, CMMP13, Mad16, ALdOW17, CMTV17]. The objective value of this flow, effective resistances, is also a well studied quantity, and has direct applications in random walks, spanning trees [MST15], and importance of graph edges [SS11]. An in-depth treatment of such connections can be found in the monograph by Doyle and Snell [DS84], and a short summary of the connection between norm flows and resistances is given in Appendix B.
The applications of effective resistances, and its broader connections with optimization problems on graphs make it arguably one of the most important primitives in algorithm design. However, in the dynamic setting, prior to our work, sub-linear time algorithms for maintaining effective resistances were only known in minor-free graphs [GHP17, GHP18].
In this paper, we show the first sub-linear time fully-dynamic algorithm for maintaining approximate effective resistances in general graphs. Our algorithm is randomized and the approximation guarantee holds with probability at least.
For any given error threshold , there is a data-structure for maintaining an unweighted, undirected multi-graph with up to edges that supports the following operations in expected amortized time:
Insert: Insert the edge with resistance in .
Delete: Delete the edge from .
EffectiveResistance: Return a -approximation to the effective resistance between and in the current graph .
If we restrict to simple graphs, and only maintain the effective resistances between a small number of vertex-pairs , our algorithm can also give a running time of per operation, which is truly sub-linear irrespective of graph density. We discuss such an improvement in Section 6.
Our algorithm is motivated by two sequences of recent results. For special family of graphs, e.g. planar graphs, recent works [GHP17, GHP18] showed data structures for maintaining approximate effective resistances with 444We use the notation of to hide polylog factors. Specifically, for a function , some error parameter , and some constant , we have . update and query time. On the other hand, concurrent results on generating random spanning trees [DKP17] and computing network centrality parameters [LZ18] implicitly rely on the ability to answer effective resistance queries along with edge deletions or contractions offline.
The key algorithmic component behind our result is the efficient maintenance of a graph reduction to a random subset of vertices, picked uniformly from the endpoints of edges. To this end, we leverage recent results based on vertex elimination schemes for solving linear systems in graph Laplacians [KLP16b, KS16] and generating random spanning trees [DPPR17]. Specifically, we combine random walk based methods for generating effective resistance preservers on terminals with results in combinatorics that bound the speed at which such walks spread among vertices [BF96]. By showing that these walks are sufficiently local, we conclude that each update only affects a small number of such walks, and those can in turn be resampled efficiently. To the best of our knowledge, we are the first to utilize the behavior of random walks in data structures for maintaining graphs that undergo edge insertions and deletions.
Finally, we remark that the effective resistance between a pair of vertices is finite only if they are connected. Thus, our data structure also provides the first scheme for maintaining connectivity in dynamic graphs that does not utilize data structures for maintaining trees under edge updates, such as link-cut trees [ST83, ST85], Euler-tour trees [HK95], or Top-trees [AHLT05]. The many extensions of ideas stemming from dynamic connectivity, and the wide range of applications of random walks make us optimistic that our algorithmic ideas could be useful for dynamically maintaining other important graph properties.
1.1 Related Works
The recent data structures for maintaining effective resistances in planar graphs [GHP17, GHP18] drew direct connections between Schur complements and data structures for maintaining them in dynamic graphs. This connection is due to the preservation of effective resistances under vertex eliminations (Fact 2.2). From this perspective, the Schur complement can be viewed as a vertex sparsifier for preserving resistances among a set of terminal vertices.
The power of vertex or edge graph sparsifiers, which preserve certain properties while reducing problem sizes, has long been studied in data structures [Epp91, EGIN97]. Ideas from these results are central to recent works on offline maintenance for -connectivity [PSS17], generating random spanning trees [DKP17], and new notions of centrality for networks [LZ18]. Our result is the first to maintain such vertex sparsifiers, specifically Schur complements, for general graphs in online settings.
While the ultimate goal is to dynamically maintain (approximate) minimum cuts and maximum flows, effective resistances represent a natural ‘first candidate’ for this direction of work due to them having perfect vertex sparsifiers. That is, for any subset of terminals, there is a sparse graph on them that approximately preserves the effective resistances among all pairs of terminals. This is in contrast to distances, where it’s not known whether such a graph can be made sparse, or in contrast to cuts, where the existence of such a dense graph is not known.
Dynamic Graph Algorithms.
The maintenance of properties related to paths in dynamic graphs is a well studied topic on data structures [Fre85, EGIN97, HDLT01, KKM13, Wul17, NSW17, NS17]. A key difficulty facing paths on graphs is that general graphs are not decomposable: piecing together connectivity information from an arbitrary partition of a graph is difficult, and there are classes of graphs such as expanders that are not partitionable.
Dynamic algorithms for evaluating algebraic functions such as matrix determinant and matrix inverse has also been considered [San04]. One application of such algorithms is that they can be used to dynamically maintain single-pair effective resistance. Specifically, using the dynamic matrix inversion algorithm, one can dynamically maintain exact -effective resistance in update time and query time.
Vertex sparsifiers have been studied in more general settings for preserving cuts and flows among terminal vertices [Moi09, CLLM10, KR13]. Efficient versions of such routines have direct applications in data structures, even when they only work in restricted settings: terminal sparsifiers on quasi-bipartite graphs [AGK14] were core routines in the data structure for maintaining flows in bipartite undirected graphs [ADK16].
Our data structure utilizes vertex sparsifiers, but in even more limited settings as we get to control the set of vertices to sparsify onto. Specifically, the local maintenance of this sparsifier under insertions and deletions hinges upon the choice of a random subset of terminals, while vertex sparsifiers usually need to work for any subset of terminals. Evidence from numerical algorithms [KLP16b, DPPR17] suggest this choice can significantly simplify interactions between algorithmic components. We hope this flexibility can motivate further studies of vertex sparsifiers in more restrictive, but still algorithmically useful settings.
The paper is organized as follows. We discuss preliminaries in Section 2, after which we present our data-structure in Section 3. The key properties of random walks that we use are given in Section 4, and we show the dynamic maintenance of approximate Schur complements in Section 5. In Section 6, we briefly discuss an alternate way of analyzing our data structure’s performances in terms of the number of vertices. In Appendix A, we provide details on the graph approximation guarantees that our random walk sampling routines rely on. Finally, in Appendix B we provide brief details on the norm flow formulations of shortest paths, maximum flows, and effective resistances.
In our dynamic setting, an undirected, unweighted multi-graph undergoes both insertions and deletions of edges. We let always refer to the current version of the graph. We will use and to denote bounds on the number of vertices and edges at any point, respectively.
A walk in is a sequence of vertices such that consecutive vertices are connected by edges. A random walk in is a walk that starts at a starting vertex , and at step , the vertex is chosen randomly among the neighbors of .
For an unweighted, undirected multi-graph , let denote its adjacency matrix and let its degree diagonal matrix (counting edge multiplicities for both matrices). The graph Laplacian of is then defined as . Let denote the Moore-Penrose pseudo-inverse of
. We also need to define the indicator vectorof a vertex such that if , and otherwise.
For our algorithm, it will be useful to define effective resistance using linear algebraic structures. Specifically, given any two vertices and in , if , then the effective resistance between and is given by
Linear systems in graph Laplacian matrices can be solved in nearly-linear time [ST14]. One prominent application of these solvers is the approximation of effective resistances.
Fix and let be any graph with two arbitrary distinguished vertices and . There is an algorithm that computes a value such that
in time with high probability.
Given a graph , we can think of the Schur complement as the partially eliminated state of . This relies on some partitioning of into two disjoint subset of vertices and , which in turn partition the Laplacian into blocks:
The Schur complement onto , denoted by is the matrix after eliminating the variables in . Its closed form is given by
It is well known that is a Laplacian matrix of a graph on vertices in . To simplify our exposition, we let denote both the Laplacian and its corresponding graph.
In this work, we will not utilize the above algebraic expression of Schur complement. Instead, our algorithm is built upon a view of the Schur complement as a collection of random walks. This particular view we be discussed in more details in Section 3.
The key role of Schur complements in our algorithms stems from the fact that they can be viewed as vertex sparsifiers that preserve pairwise effective resistances (see e.g., [GHP17]).
Fact 2.2 (Vertex Resistance Sparsifier).
For any graph , any subset of vertices , and any pair of vertices ,
Definition 2.3 (Spectral Sparsifier).
Given a graph and , we say that a graph is a -spectral sparsifier of (abbr. ) if , and for all
In the dynamic setting, Abraham et al. [ADK16] recently showed that -spectral sparsifiers of a dynamic graph can be maintained efficiently.
Lemma 2.4 ([Adk16], Theorem 4.1).555Version 1 https://arxiv.org/pdf/1604.02094v1.pdf.
Given a graph with polynomially bounded edge weights, with high probability, we can dynamically maintain a -spectral sparsifier of size of in expected amortized time per edge insertion or deletion. The running time guarantees hold against an oblivious adversary.
The above result is useful because matrix approximations also preserve approximations of their quadratic forms. As a consequence of this fact, we get the following lemma.
If is a -spectral sparsifier of , then for any pair of vertices and
3 Overview and Data Structure
In this section we start by discussing the key high level invariants that we maintain throughout our data structure. We then continue by describing how to use these invariants to dynamically maintain approximate Schur complements. Finally, we show that this leads to an algorithm for maintaining effective resistance, and thus proves our main result in Theorem 1.1.
We now review two natural attempts for addressing our problem.
Second, by the preservation of effective resistances under Schur complements (Fact 2.2), we could also utilize Schur complements to obtain a faster query time among a set of terminals, , for some reduction factor , at the expense of a slower update time. Specifically, after each edge update, we recompute an approximate Schur complement of the sparsifier onto in time [DKP17], after which each query takes time.
The first approach obtains sublinear update time, while the second approach gives sublinear query time. Our algorithm stems from combining these two methods, with the key additional observation being that adding more vertices to makes the Schur complement algorithm more local.
The running time bottleneck then becomes computing and maintaining under edge updates to . To speed up this process, we take a more local interpretation of a sparsifier of as a collection of random walks, each starting at an edge of and terminating in . In Appendix A
, we review the following result, which is implicit in previous works on block elimination based algorithms for estimating determinants[DPPR17].
Let be an undirected, unweighted multi-graph with a subset of vertices . Furthermore, let , and let be some parameter related to the concentration of sampling given by
Let be an initially empty graph, and for every edge of , repeat times the following procedure:
Simulate a random walk starting from until it hits at vertex ,
Simulate a random walk starting from until it hits at vertex ,
Let the total length of this combined walk (including edge ) be . Add the edge to with weight
The resulting graph satisfies with high probability.
The output approximate Schur complement onto has up to edges (that is, for each edge in ). However, as we will show, does not change too much upon inserting or deleting an edge in . Therefore, we can maintain these changes using a dynamic spectral sparsifier of , and whenever a query comes, we answer it on in time.
Thus the bulk of our effort is devoted to generating and maintaining the random walks described in Theorem 3.1. Specifically, upon insertion or deletion of an edge in , we only need to regenerate walks that pass through or . The cost of this depends on both the length of a walk, as well as the maximum number of walks that passes through a vertex (which we will refer to as the load of ). For picked arbitrarily, e.g., the leftmost vertices of a length path, both of these parameters can be large: a walk needs about steps to move across the path, and the load at the middle vertices is .
To shorten these random walks, we augment with a random subset of vertices. Coming back to the path example, uniformly random vertices will be roughly apart, and random walks will reach one of these vertices in about steps. Because could be a multi-graph, and we want to support queries involving any vertex, we pick as the end points of a uniform subset of edges. A case that illustrates the necessity of this choice is a path except one edge has parallel edges. In this case it takes steps in expectation for a random walk to move away from the end points of that edge. This choice of completes the definition of our data structure, which we summarize in Figure 1, and will discuss throughout the rest of this overview. A variant based on sampling vertices that obtains truly sublinear time per operation, but has more limitations on operations, is in Section 6.
The performance of our data structures hinge upon the properties of the random walks generated. We start by formalizing such a structure involving a set of augmented terminals, which we parameterize with a more general probability .
Definition 3.2 (-shorted walks).
Let be an unweighted, undirected multi-graph and a parameter. A collection of -shorted walks on is a set of random walks created as follows:
Choose a subset of terminal vertices , obtained by including the endpoints of each edge independently, with probability at least .
For each edge , generate walks from its endpoints either until steps have been taken, or they reach .
The main property of the collection is that its random walks are local. That is, with high probability all walks in are short, and only a small number of such walks pass through each vertex , i.e., the expected load of with respect to is small. These guarantees are summarized in the following theorem. Details on this behavior of random walks are deferred to Section 4.
Let be any undirected multi-graph, and a parameter such that . Any set of -shorted walks , as described in Definition 3.2, satisfies:
With high probability, any random walk in starting in a connected component containing a vertex from terminates at a vertex in .
For any edge , the expected load of with respect to is .
Note that Part 1 is conditioned upon the connected component having a vertex in : this is necessary because walks stay inside a connected component. However, this does not affect our queries: our data-structure has an operation for making any vertex a terminal, which we call during each query to ensure both and are terminal vertices. Such an operation interacts well with Theorem 3.3 because it can only increase the probability of an edge’s endpoints being chosen.
We now have all the necessary tools to present our dynamic algorithm for maintaining the collection of walks (equivalently, the approximate Schur complement ). We start by analyzing the update operations. Upon insertion or deletion of an edge in the current graph , the main idea is to regenerate all the walks that utilized . This ensures that the collection of walks that we maintain produces a valid approximate Schur Complement . Since we know that the length of these walks is (Definition 3.2), and Theorem 3.3 Part 2 also limits the load per edge, using a rejection sampling technique, we can regenerate these walks in time.
However, note that declaring to be a terminal forces us to truncate all the walks in at the first location they meet . Our key observation is that the cost of truncating these walks can be charged to the cost of constructing them during the pre-processing phase. Thus it follows that we can declare any vertex a terminal in amortized time. On the other hand, we need to avoid extending these truncated walk when these query vertices are no longer needed in the terminals. We address this by retraining the queried vertices in , but periodically rebuild the entire data structure (which which we resample the terminals completely) to limit the growth in .
The above discussion leads to the data-structure DynamicSC: Given an undirected multi-graph and a subset of terminals , maintain the collection of -shorted walks , and in turn the approximate Schur complement (as outlined in Figure 1) while supporting the following operations:
Initialize: Construct the collection and the sparsifier .
Insert: Insert the edge with resistance in .
Delete: Delete the edge from .
AddTerminal: Add the vertex to the set of terminals in .
We can now state the guarantees of the above data-structure using the defined operations. Specific implementation details are deferred to Section 5.
Given an undirected multi-graph a subset of terminal vertices , and a parameter such that , DynamicSC maintains the collection of -shorted walks , and in turn a graph that is with high probability a sparsifier of , in a dynamic graph with at most edges, while supporting its operations in the following running times:
Initialize in expected amortized time.
Insert in expected amortized time.
Delete in expected amortized time.
AddTerminal in amortized time.
Furthermore, each of these operations leads to an amortized number of changes to bounded by the corresponding amortized costs.
Putting together the bounds in the above lemma proves our main result, i.e., Theorem 1.1.
Proof of Theorem 1.1.
We present our two-level data-structure for dynamically maintaining all-pair effective resistances. Specifically, we keep the terminal set of size . This entails maintaining
and rebuilding our data-structure every operations due to the insertions into caused by handling queries.
We now describe the update and query operations. All updates in the graph are passed to the first data-structure (which handles them by Lemma 3.4 Parts 2 and 3). Those updates in turn will trigger other updates in , which are then handled by our second data-structure for . Next, upon receiving a query about the effective resistance, we declare both and terminals (by Lemma 3.4 Part 4), which ensures that they are now contained in . Finally, we compute the (approximate) effective resistance between and in the graph using Lemma 2.1.
We next analyze the performance of our data-structure. Let us start with the pre-processing time. First, observe that the cost for constructing on a graph with edges is bounded by . Next, since has edges, constructing takes time. Thus, the amortized time of our pre-processing is bounded by .
We now analyze the update operations. By construction, note that a single update in triggers updates in , and those updates can be handled in time using the dynamic spectral sparsifier . Thus, we get that the expected amortized update time per insertion or deletion is .
The cost of any query is dominated by (1) the cost of declaring and terminals and (2) the cost of computing the effective resistance to accuracy on the graph . Since (1) can be performed in time, we only need to analyze (2). We do so by first giving a bound on the size of . To this end, note that each of the edges in the current graph adds two vertices to with probability independently. By a Chernoff bound, the number of random augmentations added to is at most with high probability. In addition, since the data-structure in Lemma 3.4 is re-built every operations, the size of never exceeds with high probability. The latter also bounds the size of by and gives that the query cost is .
Finally, note that each rebuild can be performed in amortized time. Since we do rebuilds every operations, this leads to an amortized cost of
which is dominated by the update time.
Combining the above bounds on the update and query time, we obtain the following trade-off
which is minimized when , thus giving an expected amortized update and query time of
Our result raises several open questions for future works. Here we state those that we believe are closer to our results. (1) The most natural one is whether our update or query time bounds can be improved to . It is also interesting to investigate whether our update times can be made deterministic and/or worst-case. (2) As effective resistances can be interpreted in terms of electrical flows, we can ask whether the values in these flows, such as the flow value on edge when sending unit of current from to can be dynamically maintained. (3) Finally, the use of Schur complement as vertex sparsifiers raises the question of whether modifications of Schur complements can be used to maintain more combinatorial problems.
4 Properties of Random Walks
We start with the first property, which claims that we traversed sufficiently long to reach a vertex in with high probability. For this, we need the following result by Barnes and Feige [BF96].
Theorem 4.1 ([Bf96], Theorem 1.2).
There is an absolute constant such that for any undirected, unweighted, multi-graph with vertices and edges, any vertex and any value , the expected time for a random walk starting from to visit at least distinct edges is at most .
The above theorem can be amplified into a with high probability bound by repeating the walk times.
In any undirected unweighted multi-graph with edges, for any starting vertex , any length , and a parameter , a walk of length from visits at least distinct edges with probability at least .
We can view each such walk as a concatenation of sub-walks, each of length .
We call a sub-walk good if the number of distinct edges that it visits is at least . Applying Markov’s inequality to the result of Theorem 4.1, a walk takes more than steps to visit distinct edges with probability at most .
This means that each subwalk fails to be good with probability at most . Thus, the probability that all subwalks fail to be good is at most . The result then follows from an union bound over all starting vertices . ∎
This means that a walk of length is highly likely to visit at least distinct edges, among which at least one should be added to with high probability. If the connected component where the walk started in has fewer than edges, we get that the walk should have visited the entire component with high probability, and thus any (initial) vertex in that belongs to that component.
For any walk , we define (respectively, ) to be the set of distinct vertices (respectively, edges) that a walk visits. Consider a random walk that starts at of length
where is a constant related to the success probability.
If the connected component containing the walk has fewer than
vertices, then Corollary 4.2 gives that we have covered this entire component with high probability, and the guarantee follows from the assumption that this component contains a vertex of .
Otherwise, we will show that reached enough edges for one of them to be picked into with high probability. The key observation is that because is generated independently from , we can bound the probability of this walk not hitting by first generating , and then . Specifically, for any size threshold , we have
By Corollary 4.2 and the choice of , if we set
then the first term in Equation (4) is bounded by . For bounding the second term, we can now focus on a particular walk that visits at least distinct edges, i.e.,
Recall that we independently added the end points of each of these edges into with probability . If any of them is selected, we have a vertex that is both in and . Thus the probability that contains no vertices from is at most
which completes the proof. ∎
The bound on walk lengths also leads to a bound on the load of an edge, which is Part 2 of Theorem 3.3. We next show that this is the case. For the sake of simplicity, we will ignore the sampling overhead in our preliminary discussions.
First, we observe that instead of terminating walks once they hit (as described in Figure 1), we can run all the walks from all edges up to steps.
Note that the number of walks starting at each vertex is because we are starting one random walk per endpoint of each edge. For each , we let be the union over random walks of length starting from . Furthermore, recall that is the collection of -shorted walks that our sparsification routine maintains.
We want to obtain bounds on the load of any vertex (respectively, edge ) incurred by the random walks in
. For the purposes of the proof, it will be useful to introduce some random variables. Theload of (respectively, ), denoted by (respectively, ), is the number of walks that pass through vertex (respectively, edge ) from the random walks in . For , let be the set of vertices visited in a random walk starting at after steps.
The first quantity we are interested in is the contribution of random walks from each in the load of , which we denote by . Concretely, is the total number of walks that pass through , from the random walks in . Using the above random variables, we have that
Now, observing that , we can expand the expectation of as follows
It turns out that that the term contained in the brackets of Equation (2) equals . Formally, we have the following lemma.
Let be an undirected, unweighted graph. For any vertex and any length , we have
To prove this, we use the reversibility of random walks, along with the fact that the total probability over all edges of a walk starting at is at any time. Below we verify this fact in a more principled manner.
Proof of Lemma 4.3.
The proof is by induction on the length of the walks . When , we have
which gives a total of .
For the inductive case, assume the result is true for . The probability of a walk reaching after steps can then be written in terms of its location at time , the neighbor of , as well as the probability of reaching there:
Substituting this into the summation to get
which upon rearranging of the two summations gives:
By the inductive hypothesis, the term contained in the bracket is precisely , which cancels with the division, and leaves us with . Thus the inductive hypothesis holds for as well. ∎
Incorporating the sampling overhead , which we initially ignored, we get
thus proving the desired bound on the load of .
To get the bound on the load of any edge , we use the fact that
Plugging the bound from Equation (3) in the above equation, we get that
which proves the bound on the load of and completes the proof. ∎
5 Dynamic Schur Complement
In this section we show that the approximate Schur complement given in Figure 1 can be maintained dynamically. The primary difficulty here is dynamically maintaining the collection of -shorted walks (see Definition 3.2). We next show how to do this efficiently and combine it with an amortized cost analysis to prove Lemma 3.4. See 3.4
For our running time analysis, it is important to first note that each step in a random walk can be simulated in time. This is due to the fact that we can sample an integer in by drawing uniformly and taking . Therefore, we will only need to consider the length of the walks in our runtime. As we will later see, the initialization costs will then follow from our construction of the approximate Schur complement in Figure 1.
In addition, we note that there is always a one-to-one correspondence between the collection of -shorted walks and our approximate Schur complement . Accordingly, our primary concern will be supporting the Insert, Delete, and AddTerminal operations in the collection . However, as undergoes changes, we need to efficiently update the sparsifier . To handle these updates, we would ideally have efficient access to which walks in are affected by the corresponding updates.
To achieve this, we index into walks that utilize a vertex or an edge, and thus set up a reverse data structure pointing from vertices and edges to the walks that contain them. The following lemma says that we can modify this representation with minimal cost.
For the collection of -shorted walks , let and be the specific walks of that contain vertex and edge , respectively. We can maintain a data structure for such that for any vertex or edge it reports either
All walks in or in or time, respectively, or
The walk (in order of time generated) of or in time, for any value ,
with an additional overhead for any changes made to .
For every vertex (respectively, edge), we can maintain a balanced binary search tree consisting of all the walks that use it in time proportional to the number of vertices (respectively, edges) in the walks. Supporting rank and select operations on such trees then gives the claimed bound. ∎
As a result, any update made to the collection of walks can be updated in the approximate Schur complement generated from these walks in time. Thus, we can fully devote our attention to supporting the Insert, Delete, and AddTerminal operations in . The procedure AddTerminal will be straightforward and its cost will be incorporated into the amortized analysis. The pseudocode for this operation is summarized in Figure 2.
Procedures Insert and Delete are more involved. The primary difficulty is that an edge update in the current graph changes the random walk distribution in the new graph and our walks may no longer be sampled according to this distribution. Recomputing each walk would be far too costly, so we instead observe that a random walk is a localized procedure. In particular, if some edge is inserted or deleted, the only changes in the random walk procedure occur when the walk visits vertex or . This implies that all random walks in the original graph which did not visit vertex or have the same probability of occurring in the new graph with inserted or deleted. We will then use certain properties of our collection of random walks proven in the previous section, along with a rejection sampling technique, to give stronger bounds on the number of walks we need to regenerate when the graph undergoes an edge update.
As mentioned above, due to the localized nature of random walks, if we delete an edge , then all random walks in our collection that did not visit vertex or remain unaffected. A simple update procedure would then regenerate all walks that visit vertex or . However, a consequence of Theorem 3.3 Part 2 is that the expected number of walks visiting vertex is , which is too costly if is large. Ideally, we would then only deal with walks that use edge , and we will next show that this is in fact that case.
To this end, note that the only random walks whose probability is affected are those that visit vertex or . Consider a random walk that visits vertex and let be the degree of in the new graph. For every remaining edge incident to , the probability of it being used in the graph with deleted is . Note that in the original graph they were used with probability . However, if we condition upon the random walk not using the edge in the original graph, then it is easy to see that any other edge incident to is chosen with probability , exactly as desired. Consequently, the only random walk probabilities that are affected are the ones that utilize edge . In Figure 3, we give a routine which updates the walks that used the deleted edge . The running time guarantees of our update algorithm are given in the following lemma.
The operation takes expected amortized time, and updates edges in .
Handling insertions will be more involved because we now have to consider every random walk that visits or . However, to bound the number of these walks that need to be regenerated, we can use rejection sampling. This will utilize the fact that for any random walk that visits vertex or , the probability that it uses edge is proportional to the degree of and , respectively. In particular, if we let be the degree of in our new graph, then for each of our random walks that visit we instead use the edge with probability and generate the remaining random walk from that point on. Note that for any other edge incident to , the probability of that edge being used in the original random walk was and the probability that we keep the walk is , whose product gives the desired probability of .
However, if we run this sampling procedure for each walk incident to , the expected number of walks sampled will be , which is too costly if the degree is large. To address this, we implicitly run this sampling procedure on all walks by instead finding the instances in which we use in just time. More specifically, at each sample we use with probability , so the probability that we use for the first time in the -th sample will be
In order to efficiently find the value at which we first sample , we simply draw a uniformly random number . Using geometric series properties, we can compute the probability that for any value , and we binary search on by increasing and checking if is above or below this value. Our expected running time will then be . Iterating this procedure efficiently finds all walks that use edge .
Finally, note that we need to consider an additional case where the inserted edge causes both of its endpoints to be added to . If this occurs, we simply truncate all walks to those vertices. The above discussion is summarized in the pseudocode given in Figure 4
The operation takes expected amortized time, and updates edges in .
For now, let us assume that the AddTerminal operation takes amortized time. We next bound the expected amortized time for the remainder of the procedure.
Since, by the discussion above, each of these is updated with probability , the expected number of walks that we regenerate is , giving our bound on the number of edge updates. The total amortized cost then follows analogous to the proof of Lemma 5.2. ∎
5.3 Amortized Analysis
The overall bound requires amortizing the costs of shortening the walks caused by to the cost of creating these walks in the first place. This can be handled using a standard amortized analysis.
Proof of Lemma 3.4.
We first examine the operation . Forming requires generating walks from each edge of up to a length of at most , which with the overhead of maintaining reverse pointers from Lemma 5.1 gives a cost of
The expected amortized time of the operations and follow from Lemma 5.2 and 5.3, respectively, where we note that Lemma 5.3 assumed that only required amortized time. It then remains to show that this is the case.
Adding a vertex to only shortens the existing walks, and Lemma 5.1 allows us to find such walks in time proportional to the amount of edges deleted from the walk. Since this walk needed to be generated in either the Initialize, Insert, or Delete, then the deletion of these edges will take equivalent time to generating them. As a result, we can account for this amortized cost by just doubling the cost of Initialize, Insert, and Delete, which does not affect their asymptotic runtime.
6 Better Guarantees for -Resistance on Simple Dense Graphs
In this section we discuss a different parameterization of our data structure where we restrict to simple graphs and only maintain the effective resistance between a small number of fixed vertex-pairs . For the sake of exposition, we only consider the case where we want to maintain the effective resistance between a single pair. It is then easy to extend our data-structure to support up to fixed vertex-pairs.
For any given error threshold , and a vertex-pair , there is a data structure for maintaining a -vertex simple graph while supporting edge insertions and deletions in as well as -effective resistances queries in expected update and query time.
In the above theorem, the improvement on the running time (for sufficiently dense graphs) comes from a result by Barnes and Feige [BF96], who give a bound on the number of distinct vertices visited in a random walk of certain length. In what follows, we will describe how to modify both the data-structure and the algorithm for maintaining dynamic Schur complements, which in turn will prove the theorem.
We start with the modification of the data-structure. In comparison to the data-structure in Figure 1, the key difference here is that we directly sample vertices with some probability and include them in the set of terminals . This forces us to change the length of the random walks, as shown in Figure 5. However, we remark that the Theorem 3.1 holds for arbitrary , and thus it readily applies to our modification of the terminal set.
Now, for any parameter , similarly to Definition 3.2, we can define the collection of -shorted walks for the vertex version of our data-structure. Specifically, (1) we pick a subset of terminal vertices , obtained by including each vertex independently, with probability at least and (2) the length of the random walks we generate is replaced by .
We next review the result by Barnes and Feige [BF96].
Lemma 6.2 ([Bf96], Theorem 1.1).
There is an absolute constant such that for any undirected, unweighted, simple with vertices, any vertex and any value , the expected time for a random walk starting from to visit at least distinct vertices is at most .
Let be any undirected simple graph, and a parameter such that . Any set of -shorted walks , as described above, satisfies:
With high probability, any random walk in starting in a connected component containing a vertex from terminates at a vertex in .
For any edge , the expected load of with respect to is .
Following the ideas we presented in Section 3, we can use the above theorem to construct the data-structure that maintains a dynamic Schur complement, i.e., DynamicSC. However, one difference here is that the terminal additions are not supported, and the update times are no longer amortized. We implement the insertions and deletions of edges using Lemmas 5.2 and 5.3. Note that because we randomly pick vertex subsets, we do not need to regenerate augmentations to , i.e., Line 1 of Figure 4 is no longer useful in our Insert routine. The guarantees of these modifications are summarized in the lemma below.
Given an undirected multi-graph a subset of terminal vertices , and a parameter such that , DynamicSC maintains the collection of -shorted walks , and in turn a graph that is with high probability a sparsifier of , while supporting its operations in the following running times:
Initialize in expected time.
Insert in expected time.
Delete in expected time.
Furthermore, each of these operations leads to a number of changes to bounded by the corresponding costs.
Putting together the bounds in the above lemma proves our vertex based bounds, i.e., Theorem 6.1.
Proof of Theorem 6.1.
We present our two-level data-structure for dynamically maintaining -effective resistances. Specifically, we include both and to , and keep the terminal set of size . This entails maintaining
We now describe the update and query operations. Specifically, whenever an edge insertion or deletion is performed in the current graph, we pass the corresponding update to the first data-structure (which handles this by Lemma 6.4 Parts 2 and 3). This update in turn will trigger other updates in , which are then handled by our second data-structure for . Next, upon receiving a query about the effective resistance, we compute the (approximate) effective resistance between and in the graph using Lemma 2.1.
Similarly to the proof of Theorem 1.1, we can show that the pre-processing time is , the expected update time is , and the query time is .
Combining the bounds on the update and query time, we obtain the following trade-off
which is minimized when , thus giving an expected update and query time of
We thank Daniel D. Sleator for helpful comments on an earlier draft of the manuscript.
- [ACK17] Ittai Abraham, Shiri Chechik, and Sebastian Krinninger. Fully dynamic all-pairs shortest paths with worst-case update-time revisited. In Symposium on Discrete Algorithms (SODA), pages 440–452, 2017.
- [ADK16] Ittai Abraham, David Durfee, Ioannis Koutis, Sebastian Krinninger, and Richard Peng. On fully dynamic graph sparsifiers. In Symposium on Foundations of Computer Science (FOCS), pages 335–344, 2016.
- [AGK14] Alexandr Andoni, Anupam Gupta, and Robert Krauthgamer. Towards -approximate flow sparsifiers. In Symposium on Discrete algorithms (SODA), pages 279–293, 2014.
- [AHLT05] Stephen Alstrup, Jacob Holm, Kristian De Lichtenberg, and Mikkel Thorup. Maintaining information in fully dynamic trees with top trees. ACM Transactions on Algorithms, 1(2):243–264, 2005.
- [ALdOW17] Zeyuan Allen-Zhu, Yuanzhi Li, Rafael Mendes de Oliveira, and Avi Wigderson. Much faster algorithms for matrix scaling. In Symposium on Foundations of Computer Science (FOCS), pages 890–901, 2017. Available at: https://arxiv.org/abs/1704.02315.
Aaron Bernstein and Shiri Chechik.
Deterministic decremental single source shortest paths: beyond the
Symposium on Theory of Computing (STOC), pages 389–397, 2016.
- [BF96] Greg Barnes and Uriel Feige. Short random walks on graphs. SIAM Journal on Discrete Mathemathics, 9(1):19–28, 1996.
- [BGS15] Surender Baswana, Manoj Gupta, and Sandeep Sen. Fully dynamic maximal matching in update time. SIAM Journal on Computing, 44(1):88–113, 2015. Announced at FOCS’11.
- [BHN16] Sayan Bhattacharya, Monika Henzinger, and Danupon Nanongkai. New deterministic approximation algorithms for fully dynamic matching. In Symposium on Theory of Computing (STOC), pages 398–411, 2016.
- [CKM11] Paul Christiano, Jonathan A. Kelner, Aleksander Madry, Daniel A. Spielman, and Shang-Hua Teng. Electrical flows, laplacian systems, and faster approximation of maximum flow in undirected graphs. In Symposium on Theory of Computing (STOC), pages 273–282, 2011.
- [CLLM10] Moses Charikar, Tom Leighton, Shi Li, and Ankur Moitra. Vertex sparsifiers and abstract rounding algorithms. In Symposium on Foundations of Computer Science (FOCS), pages 265–274, 2010.
- [CMMP13] Hui Han Chin, Aleksander Madry, Gary L Miller, and Richard Peng. Runtime guarantees for regression problems. In Innovations in Theoretical Computer Science (ITCS), pages 269–282, 2013.
- [CMSV17] Michael B. Cohen, Aleksander Madry, Piotr Sankowski, and Adrian Vladu. Negative-weight shortest paths and unit capacity minimum cost flow in time (extended abstract). In Symposium on Discrete Algorithms (SODA), pages 752–771, 2017.
- [CMTV17] Michael B. Cohen, Aleksander Madry, Dimitris Tsipras, and Adrian Vladu. Matrix scaling and balancing via box constrained newton’s method and interior point methods. In Symposium on Foundations of Computer Science (FOCS), pages 902–913, 2017. Available at: https://arxiv.org/abs/1704.02310.
- [DKP17] David Durfee, Rasmus Kyng, John Peebles, Anup B Rao, and Sushant Sachdeva. Sampling random spanning trees faster than matrix multiplication. In Symposium on Theory of Computing (STOC), pages 730–742, 2017.
- [DPPR17] David Durfee, John Peebles, Richard Peng, and Anup B. Rao. Determinant-preserving sparsification of SDDM matrices with applications to counting and sampling spanning trees. In Symposium on Foundations of Computer Science (FOCS), pages 926–937, 2017.
- [DS84] Peter G. Doyle and J. Laurie Snell. Random Walks and Electric Networks, volume 22 of Carus Mathematical Monographs. Mathematical Association of America, 1984.
- [EGIN97] David Eppstein, Zvi Galil, Giuseppe F Italiano, and Amnon Nissenzweig. Sparsification: a technique for speeding up dynamic graph algorithms. Journal of the ACM, 44(5):669–696, 1997. Announced at FOCS’92.
- [Epp91] David Eppstein. Offline algorithms for dynamic minimum spanning tree problems. In Workshop on Algorithms and Data Structures (WADS), pages 392–399, 1991.
- [Fre85] Greg N Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. SIAM Journal on Computing, 14(4):781–798, 1985. Announced at STOC’84.
- [GHP17] Gramoz Goranci, Monika Henzinger, and Pan Peng. The power of vertex sparsifiers in dynamic graph algorithms. In European Symposium on Algorithms (SODA), pages 45:1–45:14, 2017.
- [GHP18] Gramoz Goranci, Monika Henzinger, and Pan Peng. Dynamic effective resistances and approximate schur complement on separable graphs. CoRR, abs/1802.09111, 2018. Available at: https://arxiv.org/abs/1802.09111.
- [GHT16] Gramoz Goranci, Monika Henzinger, and Mikkel Thorup. Incremental exact min-cut in poly-logarithmic amortized update time. In European Symposium on Algorithms (ESA), pages 46:1–46:17, 2016.
- [GP13] Manoj Gupta and Richard Peng. Fully dynamic -approximate matchings. In Symposium on Foundations of Computer Science (FOCS), pages 548–557, 2013.
- [HDLT01] Jacob Holm, Kristian De Lichtenberg, and Mikkel Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. Journal of the ACM, 48(4):723–760, 2001. Announced at STOC’98.
- [Hen97] Monika Rauch Henzinger. A static -approximation algorithm for vertex connectivity and incremental approximation algorithms for edge and vertex connectivity. Journal of Algorithms, 24(1):194–220, 1997.
- [HK95] Monika Rauch Henzinger and Valerie King. Randomized dynamic graph algorithms with polylogarithmic time per operation. In Symposium on Theory of Computing (STOC), pages 519–527, 1995.
- [HKN14] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. Decremental single-source shortest paths on undirected graphs in near-linear total update time. In Symposium on Foundations of Computer Science (FOCS), pages 146–155, 2014.
- [HKN16] Monika Henzinger, Sebastian Krinninger, and Danupon Nanongkai. Dynamic approximate all-pairs shortest paths: Breaking the O(mn) barrier and derandomization. SIAM Journal on Computing, 45(3):947–1006, 2016. Announced at FOCS’13.
- [HRW15] Jacob Holm, Eva Rotenberg, and Christian Wulff-Nilsen. Faster fully-dynamic minimum spanning forest. In European Symposium on Algorithms (ESA), pages 742–753, 2015.
- [JKPS17] Gorav Jindal, Pavel Kolev, Richard Peng, and Saurabh Sawlani. Density independent algorithms for sparsifying k-step random walks. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM, pages 14:1–14:17, 2017.
- [KKM13] Bruce M Kapron, Valerie King, and Ben Mountjoy. Dynamic graph connectivity in polylogarithmic worst case time. In Symposium on Discrete Algorithms (SODA), pages 1131–1142, 2013.
- [KLOS14] Jonathan A. Kelner, Yin Tat Lee, Lorenzo Orecchia, and Aaron Sidford. An almost-linear-time algorithm for approximate max flow in undirected graphs, and its multicommodity generalizations. In Symposium on Discrete Algorithms (SODA), pages 217–226, 2014.
- [KLP16a] Ioannis Koutis, Alex Levin, and Richard Peng. Faster spectral sparsification and numerical algorithms for SDD matrices. ACM Transactions on Algorithms, 12(2):17:1–17:16, 2016.
- [KLP16b] Rasmus Kyng, Yin Tat Lee, Richard Peng, Sushant Sachdeva, and Daniel A Spielman. Sparsified cholesky and multigrid solvers for connection laplacians. In Symposium on Theory of Computing (STOC), pages 842–850, 2016.