A dynamic graph algorithm is a data structure that maintains information in a graph that is being modified by a sequence of edge insertion and deletion operations. For a variety of graph properties there exist dynamic graph algorithms for which amortized expected time bounds are known and the main challenge is to de-amortize and de-randomize these results. Our paper addresses the first challenge: de-amortizing dynamic data structures.
An amortized algorithm guarantees a small average update time for a “large enough” sequence of operations: dividing the total time for operations by leads to the amortized time per operation. If the dynamic graph algorithm is randomized, then the expected total time for a sequence of operations is analyzed, giving a bound on the amortized expected time per operation. But in real-time systems, where each individual operation has to be executed quickly, we need a stronger guarantee than amortized expected time for randomized algorithms. The strongest possible guarantee for a randomized algorithm is that it is always correct (Las Vegas), and has high-probability worst-case update time, which gives an upper bound on the time for every individual operation that holds with high probability. (The probability that the time bound is not achieved should be polynomially small in the problem size.) There are many recent results which provide randomized data structures with worst-case guarantees (see e.g. [Sankowski04, KapronKM13, GibbKKT15, AbrahamDKKP16, BodwinK16, AbrahamCK17, NanongkaiSW17, CharikarS18, ArarCCSW18]), often via a complex “deamortization” of previous results.
In this paper we present the first algorithms with worst-case polylog update time for two classical problems in the dynamic setting: dynamic spanner, and dynamic maximal matching. In both cases, polylog amortized results were already known, but the best worst-case results required polynomial update time.
Both results are based on a new de-amortization approach for randomized dynamic graph algorithms. We bring attention to a third possible type of guarantee: an algorithm is said to have worst-case expected update time if for every update , the expected time to process is at most . On it’s own this guarantee does not resolve the fundamental problem of amortization, since a worst-case expected update time of still allows for the possibility that every updates requires time to process, for arbitrarily high . But by using some relatively simple probabilistic bootstrapping techniques, we show a black-box reduction that converts any algorithm with a worst-case expected update time into one with a high-probability worst-case update time.
This leads to the following deamortization approach: rather than directly aiming for high-probability worst-case, first aim for the weaker worst-case expected guarantee, and then apply the black-box reduction. Achieving such a worst-case expected bound can involve serious technical challenges, in part because one cannot rely on the standard charging arguments used in amortized analysis. We nonetheless show how to achieve such a guarantee for both dynamic spanner and dynamic maximal matching, which leads to our improved results for both problems.
Details of the New Reduction.
We show a black-box conversion of an algorithm with worst-case expected update time into one with worst-case high-probability update time: the worst-case query time remains the same, while the update time increases by a factor. Our reduction is quite general, but with our applications to dynamic graph algorithms in mind, we restrict ourselves to dynamic data structures that support only two types of operations: (1) update operations, which manipulate the internal state of the data structure, but do not return any information, and (2) query operations, which return information about the internal state of the data structure, but do not manipulate it. We say the data structure has update time if the maximum update time of any type of update (e.g. insertion or deletion) is .
Let be an algorithm that maintains a dynamic data structure with worst-case expected update time for each update operation and let be a parameter such that the maximum number of items stored in the data structure at any point in time is polynomial in . We assume that for any set of elements such that is polynomial in , a new version of the data structure containing exactly the elements of can be constructed in polynomial time. If this assumption holds, then there exists an algorithm with the following properties:
For any sequence of updates processes each update in time with high probability. The amortized expected update time of is .
maintains data structures , as well as a pointer to some that is guaranteed to be correct at the current time. Query operations are answered with .
The theorem applies to any dynamic data structure, but we will apply it to dynamic graph algorithms. Due to its generality, however, we expect that the theorem will prove useful in other settings as well. When applied to a dynamic graph algorithm, denotes the number of vertices, and at most elements (the edges) are stored at any point in time. Note that our assumption about polynomial preprocessing time for any polynomial-size set of elements is satisfied by the vast majority of data structures, and is in particular satisfied by all dynamic graph algorithms that we know of.
Observe that a high-probability worst-case update time bound of allows us to stop the algorithm whenever its update time exceeds the bound and in this way obtain an algorithm that is correct with high probability.
By Item 2, the converted algorithm stores a slightly different data structure than the original algorithm , because it maintains copies of the data structure in . The data structure in is equally powerful to that in because it can answer all the same queries in the same asymptotic time: always has a pointer to some that is guaranteed to be fixed, so it can use to answer queries. The main difference is that the answers produced by may have less “continuity” then those produced by : for example, in a dynamic maximal matching algorithm, if each query outputs the entire maximal matching, then a single update may change the pointer in from some to some , and will then output a completely different maximal matching before and after the update. Note that this issue does not arise in our dynamic spanner algorithm, as the spanner is formed by the union of the spanners of all copies.
First Result: Dynamic Spanner Maintenance.
Given a graph , a spanner with stretch is a subgraph of such that for any pair of vertices , the distance between and in is at most an factor larger than their distance in . In the dynamic spanner problem the main goal is to maintain, for any given integer , a spanner of stretch with edges; we focus on these particular bounds because spanners of stretch and edges exist for every graph [Awerbuch85], and this trade-off is presumed tight under Erdős’s girth conjecture. The dynamic spanner problem was introduced by Ausiello, Franciosa, and Italiano [AusielloFI06] and has been improved upon by [Elkin11, BaswanaKS12, BodwinK16]. There currently exist near-optimal amortized expected bounds: a -spanners can be maintained with expected amortized update time [BaswanaKS12] or time [GoranciK18]. The state-of-the-art for high-probability worst-case lags far behind: update time for maintaining a 3-spanner, and for a 5-spanner [BodwinK16]; no worst-case update time was known for larger . All of these algorithms exhibit the stretch/space trade-off mentioned above, up to polylogarithmic factors in the size of the spanner111A standard assumption for the analysis of randomized dynamic graph algorithms is that the “adversary” who supplies the sequence of updates is assumed to have fixed this sequence before the dynamic algorithm starts to operate, and the random choices of the algorithm then define a distribution on the time to process each . This is called an oblivious adversary. Our dynamic algorithms for spanners and matching share this assumption, as does all prior work..
We give the first dynamic spanner algorithm with polylog worst-case update time for any constant , which significantly improves upon the result of [BodwinK16] both in update time and in range of . Our starting point is the earlier result of Baswana, Khurana, and Sarkar [BaswanaKS12] that maintains a spanner with edges with update time . We show that while their algorithm is amortized expected, it can be modified to yield worst-case expected bounds: this requires a few changes to the algorithm, as well as significant changes to the analysis. We then apply the reduction in Theorem 1.1.
There exists a fully dynamic (Las Vegas) algorithm for maintaining a spanner with edges that has worst-case expected update time .
There exists a fully dynamic (Las Vegas) algorithm for maintaining a spanner with edges that has high-probability worst-case update time .
The proof follows directly from Theorem 1.3 and Theorem 1.1. In the case of maintaining a spanner, the potential lack of continuity discussed in Remark 1.2 does not exist, as instead of switching between the spanners maintained by the conversion in Theorem 1.1, we can just let the final spanner be the union of all of them. This incurs an extra factor in the size of the spanner.
Second Result: Dynamic Maximal Matching.
A maximum cardinality matching can be maintained dynamically in amortized expected time per operation [Sankowski07]. Due to conditional lower bounds of on the time per operation for this problem [AbboudW14, HenzingerKNS15], there is a large body of work on the dynamic approximate matching problem [OnakR10, BaswanaGS18, NeimanS16, GuptaP13, BhattacharyaHI18, BhattacharyaHN16, Solomon16, BhattacharyaHN17, BhattacharyaCH17, GuptaK0P17, CharikarS18, ArarCCSW18]. Still the only algorithms with polylogarithmic (amortized or worst-case) time per operation require a 2 or larger approximation ratio.
A matching is said to be maximal if the graph contains no edges between unmatched vertices. A maximal matching is guaranteed to be a 2-approximation of the maximum matching, and is also a well-studied object in its own right (see e.g. [HanckowiakKP01, GrandoniKP08, LattanziMSV11, BaswanaGS18, NeimanS16, Solomon16, Fischer17]). The groundbreaking result of Baswana, Gupta, and Sen [BaswanaGS18] showed how to maintain a maximal matching (and so 2-approximation) with expected amortized update time. Solomon [Solomon16] improved the update time to expected amortized. There has been recent work on either deamortizing or derandomizing this result [BhattacharyaHN16, BhattacharyaCH17, BhattacharyaHN17, CharikarS18, ArarCCSW18]. Most notably, the two independent results in [CharikarS18] and [ArarCCSW18] both present algorithms with polylog high-probability worst-case update time that maintain a -approximate matching. Unfortunately, all these results comes at the price of increasing the approximation factor from to , and in particular no longer ensure that the matching is maximal. One of the central questions in this line of work is thus whether it is possible to maintain a maximal matching without having to use both randomization and amortization.
We present the first affirmative answer to this question by removing the amortization requirement, thus resolving an open question of [ArarCCSW18]. Much like for dynamic spanner, we use an existing amortized algorithm as our starting point: namely, the amortized algorithm of [BaswanaGS18]. We then show how the algorithm and analysis can be modified to achieve a worst-case expected guarantee, and then we apply our reduction.
There exists a fully dynamic (Las Vegas) algorithm for maintaining a maximal matching with worst-case expected update time .
There exists a fully dynamic (Las Vegas) algorithm that maintains a maximal matching with high-probability worst-case update time .
The proof follows directly from Theorem 1.5 and Theorem 1.1. As in Remark 1.2 above, we note that our worst-case algorithm in Theorem 1.6 stores the matching in a different data structure than the original amortized algorithm of Baswana et al. [BaswanaGS18]: while the latter stores the edges of the maximal matching in a single list , our algorithm stores lists , along with a pointer to some specific list that is guaranteed to contain the edges of a maximal matching. In particular, the algorithm always knows which is correct. The pointer to allows our algorithm to answer queries about the maximal matching in optimal time.
Discussion of Our Contribution.
We present the first dynamic algorithms with worst-case polylog update times for two classical graph problems: dynamic spanner, and dynamic maximal matching. Both results are achieved with a new de-amortization approach, which shows how the concept of worst-case expected time can be a very fruitful way of thinking about dynamic graph algorithms. From a technical perspective, the conversion from worst-case expected to high-probability worst-case (Theorem 1.1) is relatively simple. The main technical challenge lies in showing how the existing amortized algorithms for dynamic spanner and maximal matching can be modified to be worst-case expected. The changes to the algorithms themselves are not too major, but a very different analysis is required, because we can no longer rely on charging arguments and potential functions. We hope that our tools for proving worst-case expected guarantees can be used to de-amortize other existing dynamic algorithms. For example, the dynamic coloring algorithm of [BhattacharyaCHN18], the dynamic spectral sparsifier algorithm of [AbrahamDKKP16], the dynamic distributed maximal independent set algorithm of [Censor-HillelHK16], and the dynamic distributed spanner algorithm of [BaswanaKS12] (all amortized) seem like natural candidates for our approach.
2 Converting Worst-Case Expected to High-Probability Worst-Case
In this section we give the proof of Theorem 1.1. To do so, we first prove the following theorem that restricts the length of the update sequence and then show how to extend it.
Let be a algorithm that maintains a dynamic data structure with worst-case expected update time , let be a parameter such that the maximum number of items stored in the data structure at any point in time is polynomial in , and let be a parameter for the length of the update sequence to be considered. Then there exists an algorithm with the following properties:
For any sequence of updates processes each update in time with high probability. The amortized expected update time of is .
maintains data structures , as well as a pointer to some that is guaranteed to be correct at the current time. Query operations are answered with .
Let for a sufficiently large constant . The algorithm runs versions of the algorithm , denoted , each with their own independently chosen random bits. This results in data structures . Each maintains a possibly empty buffer of uncompleted updates. If is empty, is marked as fixed, otherwise as broken. The algorithm maintains a list of all the fixed data structures, and a pointer to the of smallest index that is fixed.
Let . Given an update the algorithm adds to the end of each and then allows each to run for steps. Each will work on the uncompleted updates in , continuing where it left off after the last update, and completing the first uncompleted update before starting the next one in the order in which they appear in . If within these steps all uncompleted updates in have been completed, marks itself as fixed; otherwise it marks itself as broken. If at the end of update all of the data structures are broken then the algorithm performs a Flush, which simply processes all the updates in all the versions : this could take much more than work, but our analysis will show that this event happens with extremely small probability. The Flush ensures Property 2 of Theorem 2.1: at the end of every update, some is fixed.
By linearity of expectation, the expected amortized update time is , and the worst-case update time is unless a Flush occurs. All we have left to show is that after every update the probability of a Flush is at most . We use the following counter analysis:
We define the dynamic counter problem with positive integer parameters
(for average), (for reduction), and (for length) as follows.
Given a finite sequence of possibly dependent random variables
as follows. Given a finite sequence of possibly dependent random variablessuch that for each , , we define a sequence of counters which changes over a finite sequence of time steps. Let and let .
Given a dynamic counter problem with parameters , , and , if and then for every we have .
Lemma 2.3 implies that for any version and any time , [ is fixed after time ] . To see this, note that each exactly mimics the dynamic counter of Definition 2.2: corresponds to the time it takes for to process update ; by the assumed properties of , we have . The counter then corresponds to the amount of work that has left to do after the -th update phase; in particular, corresponds to being fixed after time , which by Lemma 2.3 occurs with probability at least . Since all the versions have independent randomness, the probability that all the are broken and a Flush occurs is at most . ∎
Proof of Lemma 2.3.
Let us focus on some , and say that is the criticalmoment if it is the smallest index such that for all . Note that there is exactly one critical moment if (possibly ) and none otherwise. Define ( for bad) for to be the event that the critical moment occurs in interval . Thus,
We now need to bound . Note that if occurs, then for . Thus the counter reduces by at least times between the critical moment and time ( and not because the counter reduces at time as well). Furthermore, the counter is always non-negative. Thus,
meaning that the event implies the event . Plugging in for and recalling that if event implies then we have that
Now observe that, by linearity of expectation,
Note that the factor is necessary, even though intuitively should be enough, since at each step the counter only goes up by (in expectation) and goes down by , so we would expect it to be zero most of the time. And that is in fact true: with one could show that for any , the probability that for at least half the values of is at least . But this claim is not strong enough because it still leaves open the possibility that even if the counter is usually zero, there is some particular time at which is very small.
To exhibit this bad case, consider the following sequence , where each is chosen independently and is set to with probability and to otherwise. It is easy to see that for each we have . Now, what is ? For each if , the counter will reduce by from time to time , which still leaves us with . Let be the indicator variable for the event that . Then, . This probability is hard to bound exactly, but note that since the are independent random variables between and and we can apply the following Chernoff bound.
Lemma 2.4 (Chernoff Bound).
Let be a sequence of independent random variables such that for all . Let and . Then the following two properties hold for all :
Formulation 1 with yields that if , then
Thus, to have we certainly need Now observe that
Thus, to have , we indeed need .
Finally, we observe the restriction to an update sequence of finite length is mainly a technical constraint, which can easily be eliminated. This completes the proof of Theorem 1.1.
Proof of Theorem 1.1.
Note that if the data structure does not allow any updates then Theorem 2.1 gives the desired bound. Otherwise the data structure allows either insertions or deletions or both. In this case we use a standard technique to enhance the algorithm from Theorem 2.1 providing worst-case high probability update time for a finite number of updates to an algorithm providing worst-case high probability update time for an infinite number of updates. Recall that we assume that the maximum number of items that are stored in the data structure at any point in time as well as the preprocessing time to build the data structure for any set of size polynomial in is polynomial in . Let this polynomial be upper bounded by for some constant c. We break the infinite sequence of updates into non-overlapping phases, such that phase consists of all updates between update to update .
During each phase the algorithm uses two instances of algorithm , one of them being called active and one being called inactive. For each instance the algorithm has a pointer that points to the corresponding data structure. Our new algorithm always points to the data structures of the active instance. In particular it also points to the for which the active instance ensures correctness. At the end of a phase the inactive data structure of the current phase becomes the active data structure for the next phase and the active one becomes the inactive one.
Additionally, keeps a list of all items (e.g. edges in the graph) that are currently stored in the data structure, stored in a balanced binary search tree, such that adding and removing an item takes time and the set of items that are currently in the data structure can be listed in time linear in their number.
We now describe how each of the two instances is modified during a phase. In the following when we use the term update we mean an update in the (main) data structure.
(1) Active instance. All updates are executed in the active instance and these are the only modifications performed on the active data structure.
(2) Inactive instance. During the first updates in a phase, we do not allow any changes to , but record all these updates. Additionally during the first updates in the phase, we enumerate all items in and store them in an array by performing a constant amount of work of the enumeration and copy algorithm for each update. Let denote this set of items. During the next updates we run the preprocessing algorithm for to build the corresponding data structure, again by performing a constant amount of work per update. This data structure becomes our current version of the inactive instance.
We also record all updates of the second half of the phase. During the third updates in the phase, we forward to the inactive instance and to all updates of the first half of the current phase, by performing two recorded updates to the inactive instance and to per update in the second half of the phase. Finally, during the final updates, we forward to the inactive instance and to all updates of the second half of the current phase, again performing two recorded update per update. This process guarantees that at the end of a phase the items stored in the active and the inactive instance are identical.
The correctness of this approach is straightforward. To analyze the running time, observe that each update to the data structure will result in one update being processed by the active instance and at most two updates being processed in the inactive instance. Additionally maintaining increases the time per update by an additive amount of . By the union bound, our new algorithm spends worst-case time with probability . By linearity of expectation, has amortized expected update time . By initializing the instance in preparation with the modified probability parameter we obtain the desired formal guarantees. ∎
3 Dynamic Spanner with Worst-Case Expected Update Time
In this section, we give a dynamic spanner algorithm with with worst-case expected update time that, by our main reduction, can be converted to a dynamic spanner algorithm with high-probability worst-case update time with polylogarithmic overheads. We heavily build upon prior work of Baswana et al. [BaswanaKS12] and replace a crucial subroutine requiring deterministic amortization by a randomized counterpart with worst-case expected update time guarantee. In Subsection 3.1, we first give a high-level overview explaining where the approach of Baswana et al. [BaswanaKS12] requires (deterministic) amortization and how we circumvent it. We then, in Subsection 3.2, give a more formal review of the algorithm of Baswana et al. together with its guarantees and isolate the dynamic subproblem we improve upon. Finally, in Subsection 3.3, we give our new algorithm for this subproblem and work out its guarantees.
3.1 High-Level Overview
Recall that in the dynamic spanner problem, the goal is to maintain, for a graph with vertices that undergoes edge insertions and deletions, and a given integer , a subgraph of size such that for every edge there is a path from to in of length at most . If the latter condition holds, we also say that the spanner has stretch .
The algorithm of Baswana et al. emulates a “ball-growing” approach for maintaining hierarchical clusterings. In each “level” of the construction, we are given some clustering of the vertices and each cluster is sampled with probability. The sampled clusters are grown as follows: Each vertex in a non-sampled cluster that is incident on at least one sampled cluster, joins one of these neighboring sampled cluster. Thus, for each unclustered vertex, there might be a choice as to which of its neighboring sampled clusters to join. Furthermore, the algorithm distinguishes the edge that a non-sampled vertex uses to “hook” onto the sampled cluster it joins. All sampled clusters together with the edges between them move to the next level of the hierarchy and in this way the growing of clusters is repeated times. With the help of sophisticated data structures this hierarchy is more or less maintained in a straightforward way with some crucial applications of randomization to keep the expected update time low. In such a hierarchical approach, this in particular needs to take into account the potentially exponentially growing blow-up in the propagation of updates: updates to the input graph might lead to changes in the clustering of the first level of the hierarchy, which might have to be propagated as induced updates to the second level of the hierarchy, and so on. Baswana et al. show that the amortized expected number of induced updates at level per update to the input graph is at most . Our contribution in this section is to remove the amortization argument, i.e., to give a bound of with worst-case expected guarantee
In the first level of the hierarchy, each vertex is a singleton cluster and each non-sampled vertex picks, among all edges going to neighboring sampled vertices, one edge uniformly at random as its hook. Now consider the deletion of some edge . If was not the hook of , then the clustering does not need to be fixed. However, if was the hook, then the algorithm spends time up to for picking a new hook, possibly joining a different cluster, and if so informing all neighbors about the cluster change. If the adversary deleting is oblivious to the random choices of the algorithm, then one can argue that the probability of being the hook of is . Thus, the expected update time is .
The situation is more complex at higher levels, when the clusters are not singleton anymore. While the time spent upon deleting the hook is still , where is the degree of at level , one cannot argue that the probability of the deleted edge being the hook is
. To see why this could be the case, Baswana et al. provide the following example of a “skewed” distribution of edges to neighboring clusters: Supposehas has neighboring clusters such that there are edges from into the first neighboring cluster and each remaining neighboring cluster has only one edge incident on . Now there is a quite high probability (namely ) that the first cluster is not sampled and with high probability of the remaining clusters will be sampled, as follows from the Chernoff bound. Thus, if picked the hook uniformly at random from all edges into neighboring sampled clusters, it would join one of the single-edge clusters with high-probability. As there are edges incident on from these single-edge clusters, this gives a probability of approximately for some deleted edge being the hook, which is much larger than . This problem would not appear if among all edges going to neighboring clusters a -th fraction would be sampled ones. Then, intuitively speaking, one could argue that the probability of some edge being the hook edge of is at most , the probability that the cluster of is a sampled one times the probability that a particular edge among all edges to sampled clusters was selected.
This is why Baswana et al. introduce an edge filtering step to their algorithm. By making a sophisticated selection of edges going to the next level of the hierarchy, they can ensure that (a) among all such selected edges going to neighboring clusters a -th fraction go to sampled clusters and (b) to compensate for edges not being selected for going to the next level, each vertex only needs to add edges to neighboring clusters to the spanner. The filtering boils down to the following idea: For each vertex , group the neighboring non-sampled clusters into buckets such that clusters in the same bucket have approximately the same number of edges incident on . For buckets that are large enough (containing edges), a standard Chernoff bound for binary random variables guarantees that a -th fraction of all clusters in the respective range for the number of edges incident on go to sampled clusters. As all these clusters have roughly the same number of edges incident on , a Chernoff bound for positive random variables with bounded aspect ratio also guarantees that a -th fraction of the edges of these clusters will go to sampled clusters. Therefore, one gets the desired guarantee if all edges incident on clusters of small buckets are prevented from going to the next level in the hierarchy. To compensate for this filtering, it is sufficient to add one edge – picked arbitrarily – from to each cluster in a small bucket to the spanner. As there are at most small buckets containing clusters each, this step is affordable without blowing up the asymptotic size of the spanner too much.
Maintaining the bucketing is not trivial because whenever a cluster moves from one bucket to the other it might find itself in a small bucket coming from a large bucket, or vice versa. In order to enforce the filtering constraint, this might cause updates to the next level of the hierarchy. One way of controlling the number of induced updates is amortization: Baswana et al. use soft thresholds for the upper and lower bounds on the number of edges incident on for each bucket. This ensures that updates introduced to the next level can be charged to updates in the current level, and leads to an amortized bound of on the number of induced updates. Note that the filtering step is the only part in the spanner algorithm of Baswana et al. where this deterministic amortization technique is used. If it were not for this specific sub-problem, the dynamic spanner algorithm would have worst-case expected update time.
Our contribution is a new dynamic filtering algorithm with worst-case expected update time, which then gives a dynamic spanner algorithm with worst-case expected update time. Roughly speaking, we achieve this as follows: whenever the number of edges incident on for a cluster in some bucket (with ) exceeds a bucket-specific threshold of , we move up to the appropriate bucket with probability after each insertion of an edge between and . This ensures that, with high probability, the number of edges to for clusters in bucket is at most . Such a bound immediately implies that the expected number of induced updates to the next level per update to the current level is , which is already non-trivial but also unsatisfactory because it would lead to an overall update time of for a -spanner, instead of as in the case of Baswana et al. By a more careful analysis we do actually obtain the -bound. By taking into account the diminishing probability of not having moved up previously, we argue that the probability to exceed the threshold by a factor of is proportional to . This bounds the expected number of induced updates by , which converges to a constant. A similar, but slightly more sophisticated approach, is applied for clusters moving down to a lower-order bucket. Here we essentially need to adapt the sampling probability to the amount of deviation from the threshold because in the analysis we have fewer previous updates available for which the cluster has not moved, compared to the case of moving up.
3.2 The Algorithm of Baswana et al. at a Glance
In the following, we review the algorithm of Baswana et al. [BaswanaKS12] for completeness and isolate the filtering procedure we want to modify. We deviate from the original notation only when it is helpful for our purposes.
3.2.1 Spanner Construction
Given an integer parameter , their algorithm maintains clusterings of subgraphs , both to be specified below, where and, for each , is a subgraph of (i.e., and ). For each , a cluster of is a connected subset of vertices of and the clustering is a partition of into disjoint clusters. To control the size of the resulting spanner, the clusterings are guided by a hierarchy of randomly sampled subsets of vertices in the sense that each cluster in contains a designated vertex of called the center of . The sampling is performed a priori at the initialization of the algorithm by setting , , and, for , forming by selecting each vertex from independently with probability . The sets remain the same during the course of the algorithm. In addition to the clusterings, the algorithm will maintain for each cluster of a forest consisting of a spanning tree for each cluster of rooted at its center such that each vertex in the cluster has a path to the root of length at most . Additionally, the algorithm maintains edge sets and for every to be specified below. The spanner will consist of the edge set .222In [BaswanaKS12], the set was called and the sets did not have an explicit name. Informally, level of this hierarchy denotes all algorithms and data structures used to maintain the sets indexed with defined above. Initially, and the clustering consists of singleton clusters for all vertices .
We now review how to obtain, for every , the graph , the clustering of , and the edges sets , , and , based on the graph , the clustering , the edge set , and the sets and . Let be the set of all “sampled” clusters in the clustering i.e., all clusters in whose cluster center is contained in . Furthermore, let be the set consisting of all vertices of that belong to or are adjacent to clusters in and let be the set consisting all vertices of that are adjacent to, but do not belong to, clusters in . Finally, for every , let denote the set of edges of incident on and some other vertex in , and, for every and every , let denote the set of edges of incident on and any vertex of .
For each vertex , the algorithm maintains some edge as the hook of at level , called , guaranteeing the following “hook invariant”:
For every edge such that is contained in a cluster of , , where is the set of edges of incident on and any vertex in a cluster of .
Now, the clustering is obtained by adding each vertex to the cluster of the other endpoint of its hook and the forest is obtained from by extending the spanning trees of the clusters by the respective hooks. To compensate for vertices that cannot hook onto any cluster in , let be a set of edges containing for each vertex exactly one edge of – picked arbitrarily – for each non-sampled neighboring cluster .
Additionally, for each , the algorithm maintains, for certain parameters , and , a partition of the non-sampled neighboring clusters of into subsets called “buckets”, a set of edges and a set of clusters such that:333Here we slightly deviate from the original presentation of Baswana et al. by making the filtering process more explicit and also by giving the set a name.
For every and every cluster in bucket , .
For every edge , the bucket containing the cluster of contains at least clusters (where is a given constant).
For every edge , the (unique) cluster of in is contained in .
Intuitively, the set is a filter on the edges from to non-sampled neighboring clusters and only edges in will be passed on to the next level in the hierarchy. The clusters in are those for which not all edges incident on are contained in and thus the algorithm has to compensate for these missing edges to keep the spanner intact. In the following, we call an algorithm maintaining and satisfying (F1), (F2), and (F3) for a given vertex a dynamic filtering algorithm with parameters and . To compensate for the filtering of edges, let be a set of edges containing, for each vertex and each cluster , exactly one edge from – picked arbitrarily.
For every vertex , let (where the latter is the set of edges incident on from sampled clusters). Now, the edge set is defined as follows. Every edge with belongs to if and only if and belong to different clusters in and one of the following conditions holds:
At least one of and belongs to a sampled cluster (in ) at level , or
belongs to as well as .
As mentioned above, the spanner of Baswana et al. is the graph . It follows from standard arguments that for each . The stretch bound of follows from the clusters having radius at most together with an argument that for each edge not moving to the next level has an edge to the cluster of (or vice versa) in one of the ’s or one of the ’s. Finally, the fast amortized update time of the algorithm is obtained by the random choice of the hooks. Roughly speaking, the algorithm only has to perform significant work when the oblivious adversary hits a hook upon deleting some edge from ; this happens with probability and incurs a cost of , yielding constant expected cost per update to . More formally, the filtering performed by the algorithm together with invariant (HI) guarantees the following property.
Lemma 3.1 ([BaswanaKS12]).
For every and every edge , for any constant .
The main probabilistic tool for obtaining this guarantee is a Chernoff bound for positive random variables. Compared to the well-known Chernoff bound for binary random variables, the more general tail bound needs a longer sequence of random variables to guarantee a small deviation from the expectation with high probability: the overhead is a factor of , where is the ratio between the largest and the smallest value of the random variables.
Theorem 3.2 ([BaswanaKS12]).
Let be positive numbers such that the ratio of the largest to the smallest number is at most , and let be independent random variables such that takes value with probability and otherwise. Let and . There exists a constant such that if for any , , and a positive integer , then the following inequality holds:
The running-time argument sketched above only bounds the running time of each level “in isolation”. For every , one update to could lead to more than one induced update to . Thus, the hierarchical nature of the algorithm leads to an exponential blow-up in the number of induced updates and thus in the running time. Baswana et al. further argue that the hierarchy only has to be maintained up to level by using a slightly more sophisticated rule for edges to enter the spanner from the top level. Together with a careful choice of data structures that allows constant expected time per atomic change, this analysis gives the following guarantee.
Theorem 3.3 (Implicit in [BaswanaKS12]).
Assume there is a fully dynamic edge filtering algorithm that, in expectation, generates at most changes to per update to and, in expectation, has an update time of . Then, for every , there is a fully dynamic algorithm for maintaining a -spanner of expected size with expected update time . If the bounds on are amortized (worst-case), then so is the update time of .
3.2.3 Summary of Dynamic Filtering Problem
As we focus on the dynamic filtering in the rest of this section, we summarize the most important aspects of this problem in the following. In a dynamic filtering algorithm we focus on a specific vertex at a specific level of the hierarchy444As explained above, the spanner algorithm only applies the filtering to vertices , but we actually run a dynamic filtering algorithm for each vertex in . The arguments of Baswana et al. for Theorem 3.3 take into account the induced updates occurring whenever some vertex joins or leaves the set ., i.e., there will be a separate instance of the filtering algorithm for each vertex in . The algorithm takes parameters , and , and operates on the subset of edges of incident on and any vertex in a non-sampled cluster . These edges are given to the filtering algorithm as a partition , where , the set of non-sampled clusters at level , will never change over the course of the algorithm.555Note if vertices join or leave clusters the dynamic filtering algorithm only sees updates for the corresponding edges. The dynamic updates to be processed by the algorithm are of two types: insertion of some edge to some , and deletion of some edge from some . The goal of the algorithm is to maintain a partition of the clusters into buckets , a set of clusters and a set of edges such that conditions (F1), (F2) and (F3) are satisfied.
Condition (F1) states that clusters in the same bucket need to have approximately the same number of edges incident on . The “normal” size of for a cluster in bucket would be and the algorithm makes sure that . Thus, ratio between the largest and the smallest value of among clusters in the same bucket is at most . This value corresponds to the parameter in Theorem 3.2. The edges in serve as a filter for the dynamic spanner algorithm in the sense that only edges in this set are passed on to level in the hierarchy. Condition (F2) states that an edge may only be contained in if the bucket containing the cluster of contains at least clusters Here the choice of comes from Theorem 3.2; is a constant that controls the error probability, controls the amount of deviation from the mean in the Chernoff bound, and is a constant from the theorem. Condition (F3) states that clusters for which some edge incident on and is not contained in need to be contained in (called inactive clusters in [BaswanaKS12]). Intuitively this is the case because for such clusters the spanner algorithm cannot rely on all relevant edges being present at the next level and thus has to deal with these clusters in a special way.
The goal is to design a filtering algorithm with a small value of that has small update time. An additional goal in the algorithm is to keep the number of changes performed to small. A change to after processing an update to is also called an induced update as, in the overall dynamic spanner algorithm, such changes might appear as updates to level in the hierarchy, i.e., the insertion (deletion) of an edge to (from) might show up as an insertion (deletion) at level . As this update propagation takes place in all levels of the hierarchy, we would like have a dynamic filtering algorithm that only performs changes to per update to its input.
3.2.4 Filtering Algorithm with Amortized Update Time
The bound of Baswana et al. follows by providing a dynamic filtering algorithm with the following guarantees.
Lemma 3.4 (Implicit in [BaswanaKS12]).
For any and any , there is a dynamic filtering algorithm with amortized update time for which the amortized number of changes performed to per update to is at most such that , i.e., and .
Note that the dynamic filtering algorithm is the only part of the algorithm by Baswana et al. that requires amortization. Thus, if one could remove the amortization argument from the dynamic filtering algorithm, one would obtain a dynamic spanner algorithm with worst-case expected guarantee on the update time, which in turn could be strengthened to a worst-case high-probability guarantee. This is exactly how we proceed in the following.
To facilitate the comparison with our new filtering algorithm, we shortly review the amortized algorithm of Baswana et al. Their algorithm uses where is a constant that is optimized to give the fastest update time for the overall spanner algorithm. This leads to overlapping buckets such that all clusters in bucket have between and edges incident on .
The algorithm does the following: Every time the number of edges incident on of some cluster in bucket grows to , is moved to bucket , and every time this number falls to , is moved to bucket . The algorithm further distinguishes active and inactive buckets such that active buckets contain at least clusters and all inactive buckets contain at most clusters for some constant . An active bucket will be inactivated if its size falls to and an inactive bucket will be activated if its size grows to . Additionally, the algorithm makes sure that consists of all edges incident on clusters from active buckets and that consists of all clusters in inactive buckets.
By employing soft thresholds for maintaining the buckets and their activation status, Baswana et al. make sure that for each update to the running time and the number of changes made to is constant. For example, every time a cluster is moved from bucket to bucket with a different activation status, the algorithm incurs a cost of at most – i.e., proportional to – for adding or removing the edges of to . This cost can be amortized over at least insertions to , which results in an amortized cost of , i.e., constant when is constant. Similarly, the work connected to activation and de-activation is when amortized over clusters joining or leaving the bucket, respectively.
3.3 Modified Filtering Algorithm
In the following, we provide our new filtering algorithm with worst-case expected update time, i.e., we prove the following theorem.
For every and every , there is a filtering algorithm that has worst-case expected update time and per update performs at most changes to in expectation, i.e., and . The maximum size of is .
Together with Theorem 3.3 the promised result follows.
Corollary 3.6 (Restatement of Theorem 1.3).
For every , there is a fully dynamic algorithm for maintaining a -spanner of expected size that has expected worst-case expected update time .
We now apply the reduction of Theorem 1.1 to maintain instances of the dynamic spanner algorithm and use the union of the maintained subgraphs as the resulting spanner. The reduction guarantees that, at any time, one of the maintained subgraphs, and thus also their union, will indeed be a spanner and that the update-time bound holds with high probability.
Corollary 3.7 (Restatement of Theorem 1.4).
For every , there is a fully dynamic algorithm for maintaining a -spanner of expected size that has worst-case update time with high probability.
3.3.1 Design Principles
Our new algorithm uses the following two ideas. First, we observe that it is not necessary to keep only the edges incident from clusters of small buckets out of . We can also, somewhat more aggressively, keep away the edges incident from the first clusters of large buckets out of . This is a bit similar to the idea in [BodwinK16] of keeping the first edges of each vertex in the spanner. In this way, we avoid that many updates are induced if the size of a bucket changes from small to large or vice versa. Our modified filtering is done in a deterministic way based only on the current partitioning of the clusters into buckets and on an arbitrary, but fixed ordering of vertices, clusters, and edges.
Second, we employ a probabilistic threshold technique where, after exceeding a certain threshold on the size of the set , a cluster changes its bucket with probability roughly inverse to this size threshold. Moving a cluster is an expensive operation that generates changes to the set of filtered edges, which the next level in the spanner hierarchy has to process as induced updates. The idea behind the probabilistic threshold approach is that by taking a sampling probability that is roughly inverse to the number of updates induced by the move, there will only be a constant number of changes in expectation. A straightforward analysis of this approach shows that in each bucket the size threshold will not be exceeded by a factor of more than with high probability, which immediately bounds the expected number of changes to the set of filtered edges by . By a more sophisticated analysis, taking into account the diminishing probability of not having moved up previously, we can show that exceeding the size threshold by a factor of happens with probability . Thus, the expected number of induced updates is bounded by an exponentially decreasing series converging to a constant. A similar, but slightly more involved algorithm and analysis is employed for clusters changing buckets because of falling below a certain size threshold.
We remark that a deterministic deamortization of the filtering algorithm by Baswana et al. might be possible in principle without resorting to the probabilistic threshold technique, maybe using ideas similar to the deamortization in the dynamic matching algorithm of Bhattacharya et al. [BhattacharyaHN17]. However, such a deamortization needs to solve non-trivial challenges and we believe that the probabilistic threshold technique leads to a simpler algorithm. Similarly it might be possible to use the probabilistic threshold technique to emulate the less aggressive filtering of Baswana et al. that only filters away edges incident on large buckets. Here, not using the probabilistic threshold technique seems the simpler choice.
3.3.2 Setup of the Algorithm
In our algorithm, described below for a fixed vertex
, we work with an arbitrary, but fixed, order on the vertices of the graph. The order on the vertices induces an order on the edges, by lexicographically comparing the ordered pair of incident vertices of the edges, and an order on the clusters, by comparing the respective cluster centers. For eachand also for , we maintain a bucket by organizing the clusters in bucket in a binary search tree , employing the aforementioned order on the clusters. Similarly, for and also for , we organize the edges incident on and each bucket in a binary search tree , i.e., a search tree ordering the set of edges , where these edges are compared lexicographically as cluster-edge pairs. The bucket has the special role of organizing all clusters that currently have no edges incident on . In this section we will use the conventions and to minimize the effort for handling this special case in the description of the algorithm.
We set , and, for every we set and for we set . Our algorithm will maintain the following invariants for every :
For each cluster in b