Manuscript Offprint
arXiv:2611.03604Near-Optimal Space and Time Cut Sparsification in Turnstile Streams
Abstract
A seminal result of Ahn, Guha, and McGregor (PODS'12) showed that a cut sparsifier of an unweighted graph can be computed from a near-linear number of linear measurements. Later work extended this to spectral sparsifiers (Kapralov et al., FOCS'14) and to near-linear recovery time (Kapralov et al., SODA'20). For weighted graphs, these sketches rely on grouping edges by weight, which general turnstile streams do not allow. Chen, Khanna, and Li (FOCS'22) removed this limitation, using bits of space.
We improve the space to bits. Our algorithm makes one pass over a general turnstile stream of a weighted graph, processes each update in time, and recovers, in time, a reweighted subgraph with edges that preserves every cut within a factor of . Its space, update time, and recovery time are all optimal up to polylogarithmic factors.
1 Introduction
Cut sparsification, introduced by Benczúr and Karger [BK96], has been profoundly influential. Given a weighted graph with vertices, nonnegative edge weights , and an error parameter , a -cut sparsifier of is a reweighted subgraph on the same vertex set that approximates the weight of every cut of within a factor of . They proved that every undirected graph admits such a sparsifier with only edges. This breakthrough was later extended to the stronger notion of spectral sparsifiers [ST11], for which the edge bound was improved to [BSS12]. A rich line of follow-up work has given alternative constructions and refined bounds for both cut and spectral sparsifiers [FHHP19, KP12, ST04, SS11, LS17, CKST19]. Beyond its theoretical interest, sparsification has become a basic building block of modern graph algorithms, including algorithms for maximum flow and minimum cut [BK15, She13, KLOS14, Pen16], solvers for graph-structured linear systems [ST14, CKM14, JS25], and methods for graph clustering [CSWZ16].
Sparsifiers also serve as compact synopses of a graph, a viewpoint that is central to graph sketching and data streaming [AGM12, McG14]. A cut query asks for the total weight of the edges crossing a partition of the vertex set, a basic aggregate query over the edge set. A single cut sparsifier answers all such queries simultaneously up to a multiplicative error, using space nearly proportional to the number of vertices rather than the number of edges [BK96, BK15]. Downstream procedures for partitioning, connectivity, minimum cut, and flow can then work with this summary without materializing the full graph.
*Google Research
†Google Research
‡Google Research and Carnegie Mellon University
This perspective makes the streaming and linear-sketching models particularly natural. A streaming algorithm processes the edge set as a sequence of updates and maintains only a small summary of the graph. A linear sketch is a summary that is a linear function of the edge-weight vector, so it handles insertions and deletions alike. A seminal result of Ahn, Guha, and McGregor [AGM12] showed that a cut sparsifier of an unweighted undirected graph can be computed from only linear measurements. This line of work was subsequently extended to spectral sparsifiers [KLM+17] and to faster recovery algorithms [KMM+20]. On the lower-bound side, Andoni et al. [ACK+16] proved that, for , any data structure that preserves all cuts simultaneously needs bits, and Carlson et al. [CKST19] strengthened this to bits for .
The general turnstile model captures a more flexible form of dynamic graph data. Edge weights may represent aggregate quantities such as counts, frequencies, capacities, or affinities, and updates may both increase and decrease them. Such updates arise naturally when records are inserted or deleted, when late-arriving records correct earlier aggregates, or when transactions are rolled back. Prior linear sketches for weighted graphs handle a more restrictive dynamic model by grouping edges into geometric weight classes [AGM12, KLM+17, KMM+20]. This requires every deletion of an edge to reveal the weight used at its insertion, so that the edge stays in the same weight class throughout the stream.
Grouping edges by weight, however, is inherently nonlinear, so it cannot be implemented in the general turnstile model, where the input is an arbitrary sequence of edge-weight updates. To overcome this limitation, Chen, Khanna, and Li [CKL22] gave a linear sketch for weighted undirected graphs with measurements, yielding a turnstile streaming algorithm with the same space bound. The dependence on is central here: the offline sparsification bounds [BK96, BK15, BSS12] and the sketching lower bounds [ACK+16, CKST19] suggest that space is the right target. Improving this dependence matters most in high-accuracy regimes, where is small and the extra factor dominates the space. Time is the other resource. Ideally, each update takes polylogarithmic time and the sparsifier is recovered in time nearly linear in its size. For dynamic streams with weight grouping, Kapralov et al. [KMM+20] achieved such a recovery time. This leads to the following question:
Can we design a cut sparsifier algorithm for general turnstile streams that matches the near-optimal space bound of the offline setting and runs in near-linear time?
Theorem 1.1. Let and , and assume . There is a one-pass linear-sketch algorithm using bits of space, worst-case time per update, and worst-case recovery time that, with probability at least , returns a positive reweighting of edges of such that
The recovery time is the time from the end of the stream until is returned, so the total running time is . We have formally verified Theorem 1.1 in Lean, and the formalization is
The formalization takes the approximate Gomory–Hu tree algorithm of [LNPS23] (Theorem 2.7) as a hypothesis. All other results used in the paper are proved within the formalization.
available here. Theorem 1.1 improves the space bound of Chen, Khanna, and Li [CKL22] by a factor of ; Table 1 summarizes the comparison.
The space, update time, and recovery time of our algorithm are all optimal up to polylogarithmic factors. This is clear for the update time. For , Andoni et al. [ACK, Theorems 2.3 and 2.4] showed that any data structure that approximately preserves all cuts needs bits, and that some -vertex graphs require edges in every -cut sparsifier, so writing the output alone takes time. Carlson et al. [CKST19] strengthened the space lower bound to bits for . For smaller , storing the graph exactly is cheaper, and our algorithm does so whenever (Appendix A). Its space and recovery time are therefore for every , which is again optimal: for and , the lower bounds above, applied with accuracy , give .
| Reference | Input model | Space (bits) | Update time | Recovery time |
|---|---|---|---|---|
| [AGM12, KLM] | dynamic, weight grouping | — | poly(n) | |
| [KMM] | dynamic, weight grouping | |||
| [CKL22] | general turnstile | — | poly(n) | |
| This work | general turnstile | |||
| Lower bounds |
Table 1: Bounds for -cut sparsification of weighted -vertex graphs. A dash marks an update time that the cited works do not state. The space lower bound holds for [CKST19]; for , the weaker bound holds [ACK, Theorem 2.3]. The recovery-time lower bound is the output size [ACK, Theorem 2.4] and holds for .
Comparison with for-each cut sketching. Liu, Nguyen, Shah, and Woodruff [LNSW26b] recently gave an -bit for-each cut sketch in general turnstile streams, which yields -approximate global minimum cuts and fixed- partitions in space. Their data structure estimates the weight of a single fixed cut query and cannot output a sparse graph or preserve all cuts simultaneously, which require bits by the lower bounds above. It also cannot solve -approximate - minimum cut or Gomory–Hu tree. As they point out, the optimal space for preserving all cuts in general turnstile streams was not known, since the best bound, [CKL22], exceeds the lower bounds by a factor of . Theorem 1.1 closes this gap. Moreover, their minimum-cut and -partition algorithms use a constant-accuracy for-all cut sparsifier for general turnstile streams as a black box, for which they cite [CKL22]. As a result, their update time is plus a polylogarithmic term, where is the update time of this sparsifier, and the sparsifier takes polynomial time to recover. With Theorem 1.1 at constant , their algorithms run in worst-case time per update, and the sparsifier is recovered in time.
Presentation. For ease of exposition, Sections 3–6 present a simpler version of the algorithm, which runs in polynomial time and uses idealized randomness. Section 7 then implements every step in near-linear time and generates all randomness from short seeds, which gives Theorem 1.1.
1.2 Technical overview
We now describe the main ideas behind Theorem 1.1. For a vertex pair , let denote its connectivity, the minimum weight of a cut separating and .
Why the previous approach loses a factor of . The starting point is the linear sketching algorithm of [CKL22], which implements the Benczúr–Karger strength-based sampling scheme [BK96, BK15] in a general turnstile stream. In this scheme, each edge is sampled with probability and reweighted by , where . The strength is the largest such that both endpoints of lie in a vertex-induced subgraph whose minimum cut is at least . Intuitively, edges with smaller strength lie on sparser cuts and therefore need to be sampled with higher probability. Since , this sampling rule produces only sampled edges.
The challenge is that in a turnstile stream, after an edge is sampled, we also need to know its final weight and its inverse sampling probability , which together give its output weight . The algorithm of [CKL22] recovers sampled edges using samplers. However, to output a sparsifier with accuracy, their analysis estimates each sampled edge weight to multiplicative accuracy. This accuracy requirement costs an additional factor in the sampler. Since the sampling rate already contributes the factor , the total space becomes .
Constant-accuracy estimates suffice. Our goal is to avoid estimating each sampled weight to relative error . Intuitively, if the recovered weights are unbiased, their errors should average out across a cut, just as the sampling errors do. We use connectivity-based sampling (e.g., [AGM12, FHHP19]): each edge is sampled with probability and reweighted by , where is a sampling budget. Since , this samples edges in expectation. If , a sampled edge receives weight . The sampling error on a cut is therefore a sum of independent zero-mean terms, one per edge of the cut, each of magnitude at most when . For a cut of weight , every edge of the cut has , so these terms are at most and their variances sum to at most . With , Bernstein's inequality keeps the sampling error within , which is why connectivity sampling gives a -cut sparsifier. Now suppose that the weight of a sampled edge is estimated with an unbiased error of order , that is, only to constant relative accuracy. After reweighting by , this error is also of order , the same scale as the sampling terms. If these errors behaved like independent zero-mean terms, they would also sum to , and constant-accuracy estimates would still yield a -cut sparsifier, at the cost of only a constant factor in . This is what we prove. The difficulty is to show it for all cuts simultaneously: there are exponentially many cuts, so a direct union bound over them fails. Moreover, the estimation errors of different edges are not independent.
Implementing connectivity sampling in a turnstile stream. The final weights, and hence the sampling probabilities, are unknown while updates arrive. As is standard for linear sketches [AGM12, KLM, KMM], we maintain nested subsamples of all coordinates at rates , called layers: each coordinate survives from one layer to the next independently with probability , as determined by its random survival bits. We choose the layer of each edge after the stream. As in the improved algorithm of [AGM12], we read the sampled edges through cut queries on vertex sketches: summing the sketches of the signed incidence vectors over a vertex set cancels the edges inside and leaves a sketch of the sampled edges that cross . The query cuts come from a Gomory–Hu tree [GH61] of a constant-accuracy sparsifier , which we call the coarse sparsifier. It is computed from an independent sketch, either by [CKL22] in polynomial time or by our construction in Section 7.3 in near-linear time. For every pair , the tree supplies an estimate and a query cut that separates the endpoints of and has weight .
From recovering edges to estimating weights. In the unweighted setting of [AGM12], the sampled edges crossing a query cut can be recovered exactly. In a weighted turnstile stream, we must instead estimate their weights, and these estimates also determine the layers. At layer , the sampled edges crossing have total weight in expectation, so a hash table with buckets reads the sampled weight of up to an additive error that is small compared with the scale . The decoder takes at the first layer where this reading exceeds a constant multiple of ; for edges with , this happens when is of order , as desired.
In offline sampling, each is fixed in advance. Here the reading contains collision noise from the other sampled edges, so the layer of may depend on which other edges survived. When all readings are accurate, however, this noise only decides between two adjacent layers: is too light to pass below a baseline layer , which depends only on and , and it passes at layer whenever it survives. Moreover, whether is taken at layer instead of is determined by the sketch at layer , before the survival coin of at layer is used. The sampling error therefore splits into a baseline error, a sum of independent terms bounded by Bernstein's inequality, and an extra-layer error, a martingale whose increments are fresh fair coins times predetermined coefficients, bounded by Freedman's inequality.
Separating selection from estimation. If the reading that selects were also used to estimate , the estimate would be biased, because is selected exactly when its reading is large. We therefore keep the randomness used for estimation separate from the randomness used for selection. Each vertex stores three tables at every layer:
-
a selection table, which chooses the edge and its layer;
-
a diagnostic table, which finds a row in which the bucket of the selected edge has small collision noise; and
-
an estimation table, which estimates the selected weight with independent evaluation signs.
The selection and diagnostic tables do not involve the evaluation signs. The chosen edges, layers, and rows are therefore independent of these signs, and every weight estimate remains unbiased given these choices. However, the estimation errors of different edges are not independent, as we discuss next.
Estimation errors share random signs. Recall the estimation table. At each layer, it has independent rows; each row hashes the sampled edges into buckets, and each bucket keeps counters, which sum the same edges with independent evaluation signs. Thus every evaluation sign is indexed by an edge , a layer and row , and a repetition . For a selected edge , let be its layer and its layer together with the row chosen by the diagnostic; we fix these choices from now on. The estimate of multiplies the counters of its bucket at by its decoding signs and averages over , so
where the collision vector has an entry for every other sampled edge that crosses and lands in the bucket of , and zero elsewhere. We call the inner sum the collision noise of . The estimation error on a cut, the sum of over its selected edges, is therefore a quadratic form in the evaluation signs, and a decoding sign of one edge may appear in the collision noise of another. The key observation is a separation within each connectivity class , where : for selected edges of the same class, the sign with which enters the collision noise of is a decoding sign of only if , and in that case , because exceeds the bound on guaranteed by the diagnostic. Within a class, no decoding sign therefore appears in any collision noise. Conditioning on all other signs, the contribution of the class to the error on a cut is a linear form
in independent decoding signs, where ranges over the selected edges of the class that cross the cut, and a single event controls the energy for all cuts at once. Across classes, a decoding sign of one class may enter the collision noise of another, so we apply the conditional bound class by class and combine the classes by a union bound, which needs no independence between them.
From one cut to all cuts. On a fixed cut, the baseline, extra-layer, and estimation errors therefore all concentrate. To handle all cuts simultaneously, the standard tool is Karger's cut counting (see [Kar00] and [FHHP19, Theorem 2.1]): at most cuts have weight at most times the minimum cut, so a failure probability of per cut suffices. We apply this idea to each connectivity class separately. The projection of a cut onto is the set of edges of that cross the cut. Cuts with the same projection incur the same error from this class, so we take a union bound over the distinct projections. For a projection , let be the minimum weight of a cut with projection . Since every edge of has connectivity , the projection-counting theorem of [FHHP19] shows that at most projections have . We can therefore afford failure probability for .
A mass-sensitive union bound. A projection comes with two different weights. The weight of the lightest cut with projection determines how many such projections there are, and hence the failure probability we can afford. The mass of the projection itself, which may be much smaller, determines the variance: each error term on collects contributions of size from edges of total weight , so its variance is of order . Hence, except with probability , the error on is at most
Now consider a cut of weight . The masses of its projections onto the different classes sum to , and each projection satisfies , since the cut itself has projection . Summing the bounds over the at most classes and applying Cauchy–Schwarz gives a total error of , which is at most for . This yields the guarantee with output edges and bits of space. Had we bounded the variance by , using the cut weight in place of the mass, the total would be , and would need an extra logarithmic factor.
Near-linear time. The algorithm described so far runs in polynomial time: its decoder tests all vertex pairs, and the coarse sparsifier , the constant-accuracy sparsifier whose Gomory–Hu tree supplies the query cuts, is obtained from [CKL22] in polynomial time. Moreover, the analysis assumes fully independent survival bits and evaluation signs. Section 7 removes these obstacles. Two steps build on existing tools. First, since the analysis needs connectivity estimates only within constant factors, exact Gomory–Hu trees can be replaced by approximate ones [LNPS23]
(Section 7.2). Second, the pseudorandom generator of Kapralov et al. [KMM ] produces any requested survival bit or evaluation sign from a short seed in polylogarithmic time, which gives update time (Section 7.4). The two main obstacles, however, require new ideas, which we describe next.
Candidate discovery. At most pairs are selected, but finding them by testing all pairs is too slow. Instead, we read candidate pairs directly off the selection buckets (Section 7.1). If one pair dominates a bucket, the bucket has the sign of that pair's contribution. Next to each selection counter, we therefore store bit counters, where is the number of vertex pairs, and the th bit counter multiplies the contribution of each pair by according to the th bit of its identifier. Comparing the signs of the bit counters with the sign of the base counter reveals the identifier of the dominating pair bit by bit. This encoding is standard in sparse recovery; to keep the collision noise small in all counters of a bucket, we widen the selection table by a logarithmic factor. Scanning the buckets of the at most query cuts yields candidates.
The key property is that the candidates include every selected edge. A selected edge is taken at layer or , so it survives its baseline layer , where its weight is at least a constant fraction of the scale . With high probability, some row has small collision noise in the bucket of at its query cut , so dominates that bucket and is decoded there. Every candidate then goes through exactly the same selection test, diagnostic, and estimate as before, which also rejects candidates that pair enumeration would not select. Candidate discovery therefore returns exactly the output of pair enumeration. The analysis applies unchanged, while recovery from the tables takes time instead of selection queries.
A near-linear-time coarse sparsifier. Our algorithm needs, for every pair , a query cut that separates the endpoints of and whose weight is within a constant factor of , and it needs all of them in near-linear time. Such query cuts can be read off an approximate Gomory–Hu tree of any constant-accuracy sparsifier of . The sketch of [CKL22] gives such a sparsifier, but its recovery takes polynomial time. One could instead run our own algorithm with constant accuracy, since its recovery takes near-linear time. However, this is circular: our recovery procedure itself needs query cuts.
The key fact that breaks the circularity is that query cuts need to be accurate only within constant factors. If every cut of a graph is within a constant factor of the same cut of X, then so is every connectivity, and accurate query cuts for X remain accurate for . We therefore follow a path of graphs that starts at a graph whose query cuts are explicit, ends essentially at G, and changes every cut by only a constant factor per step. For each graph on the path, we run our own recovery procedure at constant accuracy, with query cuts computed from the sparsifier recovered for the previous graph (Section 7.3).
Concretely, write for the weight vector of , and let be the spanning star with center 1, whose edges have weight one. Let be a large scaling factor, and let with . The graphs
form a regularization path: the star acts as a regularizer that dominates and is negligible in . Consecutive graphs differ by at most a factor 65/64 in every coordinate, and hence in every cut. To lower the multiple from to , the path therefore takes steps. We recover constant-accuracy sparsifiers in turn; each is the output of our recovery procedure, run at accuracy 1/64 on a sketch of with accurate query cuts for .
-
Start. Let be a vertex set that does not contain the center. The star contributes to the cut of in , while contributes less than , which is at most for . Thus every cut of is within a factor of its star part. The minimum cuts of the star are explicit: the cheapest way to separate two vertices is to cut off a single leaf. These cuts are therefore accurate query cuts for , and we use them to recover .
-
Step. The graph is available only through its sketch, but is an explicit graph with edges, in which we can compute near-minimum cuts. Every cut of is within a constant factor of the same cut of , since approximates and differs from by at most a factor 65/64. Hence a near-minimum cut separating two vertices in is also a near-minimum cut separating them in , that is, an accurate query cut. We compute these cuts from an approximate Gomory–Hu tree of , and with them we run our recovery procedure on the sketch of to obtain . Errors do not accumulate along the path: has accuracy 1/64 with respect to , and only tells the recovery where to look.
-
End. The factor makes every cut of positive weight in at least , so the remaining star, of weight , is negligible on such cuts. Discarding the edges of that join different components of and dividing by gives a constant-factor approximation of . Its query cuts are accurate for itself, and a final run of our recovery procedure on a sketch of returns a sparsifier supported on edges of .
All these recoveries take place after the stream. Each needs a sketch whose randomness is independent of its query cuts, so we maintain independent copies of the three-table sketch of at constant accuracy, each with bits, in the same single pass. By linearity, the sketch of is times the sketch of plus times the sketch of , which we add after the stream. This proves Theorem 2.6: a one-pass sketch with bits of space, update time, and recovery time that returns a constant-accuracy sparsifier. The construction is self-contained: it uses only the recovery procedure of this paper and the tools above, and in particular does not rely on [CKL22].
1.3 Related work
Offline sparsification. Cut sparsifiers were introduced by Benczúr and Karger [BK96, BK15], who sample each edge with probability inversely proportional to its strength. Fung, Hariharan, Harvey, and Panigrahi [FHHP19] gave a general framework showing that sampling by connectivity, among other measures, also yields cut sparsifiers; our sampling rule and our projection counting both come from their work. Spectral sparsification was introduced by Spielman and Teng [ST04, ST11]. Spielman and Srivastava [SS11] sampled edges by effective resistances, and Batson, Spielman, and Srivastava [BSS12] obtained sparsifiers with edges, later constructed in nearly-linear time [LS17]. Further constructions and related sketches include [KP12, JS18, CGP+23].
Linear sketching and dynamic streams. Ahn, Guha, and McGregor [AGM12] gave linear sketches for cut sparsification in dynamic streams; see [McG14] for a survey of graph streaming. Kapralov et al. [KLM+17] extended this approach to spectral sparsifiers, and Kapralov et al. [KMM+20] reduced the recovery time to nearly linear. These algorithms handle weighted graphs by grouping edges into geometric weight classes, which requires each deletion to reveal the weight used at insertion. Chen, Khanna, and Li [CKL22] gave the first linear sketch for weighted cut sparsification in general turnstile streams, recovering strength-sampled edges with samplers; see [JW21, LNSW26a] for recent work on sampling. Like the improved algorithm of [AGM12], we read sampled edges through cut queries on vertex sketches, with query cuts from a Gomory–Hu tree of a coarse sparsifier. Unlike [AGM12], we must estimate the sampled weights, and we need only constant-accuracy estimates.
Gomory–Hu trees and pseudorandomness. Gomory and Hu [GH61] showed that the pairwise minimum cuts of an undirected graph are represented by a weighted tree, which can be computed with maximum-flow computations. Li and Panigrahi [LP21] computed approximate Gomory–Hu trees faster than maximum flows, and Li, Nanongkai, Panigrahi, and Saranurak [LNPS23] computed -approximate Gomory–Hu trees in near-linear time; our query cuts use the latter. Nisan [Nis92] gave pseudorandom generators for space-bounded computation, and Nisan and Zuckerman [NZ96] gave a generator whose seed length is linear in the space, for algorithms that use polynomially many random bits. Kapralov et al. [KMM+20] combined the latter with a locally computable extractor of De and Vidick [DV10], which lets every random bit of a dynamic-stream sketch be generated in polylogarithmic time. We use their generator for the same purpose.
Lower bounds. Andoni et al. [ACK+16, Theorem 2.3] showed that, for , any data structure that approximately preserves all cuts requires bits, and Carlson et al. [CKST19] strengthened this to bits for . These bounds apply in particular to linear sketches and turnstile streaming algorithms. Andoni et al. [ACK+16, Theorem 2.4] also showed that, for , cut sparsifiers may need edges. As explained in Section 1.1, these bounds make the space and the recovery time of Theorem 1.1 optimal up to polylogarithmic factors.
2 Preliminaries
Stream model and notation. We consider a fixed, oblivious turnstile stream on vertices. There are coordinates, one for each unordered vertex pair, in a fixed canonical order, which Section 7.1 makes explicit. The stream starts from zero and makes integer updates , each adding to coordinate , with for some . Intermediate weights may be negative; final weights belong to . Let be the final graph, with . For disjoint vertex sets , write
Thus is the set of positive-weight cut edges and is the cut weight. For an edge set , we also write . For another graph or weight vector on the pairs, and sum the weights of or over all pairs between and , including pairs outside ; for instance, is the cut weight in . A positive reweighting of edges of is a graph on with and positive weights.
We assume , with and , where is the target failure probability. Thus hides factors polylogarithmic in . We write . A Rademacher sign is uniform on .
Model of computation. Running times refer to the word RAM with -bit words; under our assumptions, every input number fits in words. The algorithm knows , and in advance. The update time is the worst-case time to process one stream update, and the recovery time is the worst-case time from the end of the stream until the output is produced.
Definition 2.1 (Cut sparsifier). For , a weighted graph on is a -cut sparsifier of if for every .
2.1 Connectivity and cut counting
For a pair , its connectivity is the weight of the smallest cut separating its endpoints:
This is defined for every pair, including pairs with . Every cut separating the endpoints of has weight at least , and a positive edge has . For another weighted graph or another weight vector on the pairs, and denote the same quantity computed in or in ; we also write . Thus . We use two facts from [FHHP19].
Lemma 2.2 ([FHHP19, Corollary 1.7]). .
Lemma 2.3 (Projection counting). Let be connected, let , and let be a set of edges with for every . For every , the sets , over all with , take at most distinct values.
Proof. We use two results of [FHHP19], which are stated for integer weights, an edge of weight being treated as parallel unit edges. This changes no cut value or connectivity, and parallel copies of a pair lie in the same cuts, so projections in the multigraph determine projections in . Let be the minimum cut of . By Karger's cut counting [FHHP19, Theorem 2.1], for every at most cuts have value at most . Call an edge -heavy if its connectivity is at least , and call the set of -heavy edges of a cut its -projection. By the -projection theorem [FHHP19, Theorem 2.3], for every and every , the cuts of value at most have at most distinct -projections.
If , every counted cut has value at most , so cut counting bounds even the number of these cuts by . If , put , so that . Connectivities are integers, so every edge of is -heavy, and is determined by the -projection of the cut. A counted cut has value at most , where lies in . The -projection theorem with and therefore gives at most distinct values.
2.2 Concentration inequalities
We use the following standard bounds; see, for example, [BLM13].
Lemma 2.4 (Chernoff bound). Let be a sum of independent -valued random variables, and let . For every , .
Lemma 2.5 (Freedman's inequality [Tro11, Theorem 1.1]). Let be a real-valued martingale with respect to a filtration , with . Assume that its differences satisfy almost surely for all , and let
be its predictable quadratic variation. Then for all and v > 0,
We use the lemma at a fixed time and for both tails. If for all , then applying the lemma to and to shows that and satisfy
For every , the choice makes the right-hand side at most . Because the event in (2) includes , a variance bound that holds only on a good event can be used without conditioning the increments on that event. For independent centered summands with their natural filtration, is deterministic and (2) is Bernstein's inequality. For , with -measurable and an -measurable Rademacher sign independent of , we simply have .
2.3 Gomory–Hu trees and a constant-accuracy sparsifier
Let be the vertex set of a connected component of a nonnegatively weighted graph . A Gomory–Hu tree [GH61] of on is a weighted tree on with the following property. Fix a root. For a tree edge , let be its weight, and let the fundamental cut be the vertex set of the component of the tree minus that contains the root. Then for every tree edge , and for every pair , the connectivity equals the minimum of over the edges on the tree path. In particular, if is a minimum-weight edge on that path, then is a minimum cut separating and .
To obtain query cuts, we give a constant-accuracy sparsification sketch with near-linear recovery time. The following theorem states its guarantee, and Section 7.3 proves it.
Theorem 2.6 (Constant-accuracy sparsification). In the stream model above, for with , there is a one-pass linear sketch that uses bits of space, including seeds and recovery workspace, worst-case time per update, and worst-case recovery time. It always returns a graph with edges, and with probability at least this graph is a positive reweighting of edges of with
At constant accuracy, a polynomial-time sketch with this guarantee is also available from Chen, Khanna, and Li [CKL22, Theorem I.1 and Corollary I.2]. Our proof uses only the recovery procedure of this paper and the tools of Section 7. The rest of the paper uses only the stated guarantee.
Approximate Gomory–Hu trees. Section 7.2 replaces exact Gomory–Hu trees by approximate ones. Following Li and Panigrahi [LP21], a -approximate Gomory–Hu tree of a connected graph is a weighted tree on the vertex set of with the following property. For all vertices , let be a minimum-weight edge on the path of . Then the component of that contains is a cut of of weight at most , and this weight equals the weight of . Such a cut separates and , since lies on their path.
Theorem 2.7 ([LNPS23, Theorem 1.2]). For every , there is a randomized algorithm that, given a connected undirected graph with edges and positive weights whose ratio is polynomially bounded, computes -approximate Gomory–Hu tree of in time with high probability.
In the full version of [LNPS23], this result is Theorem 1.4. As usual, with high probability means with probability at least , where is the number of vertices of and is any constant fixed in advance. We use only the tree, not its weights. Section 7.2 computes the weight of every fundamental cut that it needs directly in the graph.
2.4 Randomness
Our sketches use two kinds of randomness. Hash functions and most signs need only four-wise independence. We use the standard polynomial construction over a binary extension field; projecting field elements gives uniform power-of-two buckets and unbiased signs, each seed has bits, and each value takes polylogarithmic time to compute (Appendix A).
Two families, the survival bits and the evaluation signs of Section 3.2, are analyzed as fully independent, and storing them explicitly would take bits. Section 7.4 generates both from short seeds with the following pseudorandom generator for space-bounded computation. Kapralov et al. [KMM+20] built it from the generator of Nisan and Zuckerman [NZ96] and a locally computable extractor of De and Vidick [DV10]. As usual for such generators [Nis92, NZ96], an algorithm runs in space if it has bits of working memory and read-only access to its input, and it reads its random bits once, in a fixed order.
Proposition 2.8 ([KMM+20, Theorem 4.1]). For any constants and every , there is an explicit generator that stretches a seed of random bits into bits with the following property. If a randomized algorithm runs in space and reads at most random bits, then replacing these bits by the output of the generator on a uniformly random seed increases its failure probability by at most . Each output bit can be computed from the seed in time.
Throughout Sections 3–6, survival bits and evaluation signs are fully independent.
3 The algorithm
During the stream, we maintain the sketch of Theorem 2.6, which we call the coarse sketch, and, independently, three tables at each vertex. After the stream, we compute the coarse sparsifier , build its Gomory–Hu trees, and use their query cuts to select and reweight edges. This section presents the polynomial-time version of the algorithm, in which the decoder tests all vertex pairs and the query cuts come from exact Gomory–Hu trees. Section 7 replaces both steps by near-linear-time implementations and generates the random bits from short seeds.
3.1 Parameters and query cuts
We use sampling layers, independent rows per sketch, and buckets per row. Their roles are distinct: covers the weight range, makes local failures unlikely, and controls collision noise. Set
Let be the smallest odd integer at least , and let be the smallest power of two at least . We also use for the number of evaluation repetitions and diagnostic groups. Choose sufficiently large absolute constants and , and then . In particular, , , and . Table 2 summarizes these choices.
The coarse graph. Run the sketch of Theorem 2.6 independently of the three tables below, with . Let be its output, and write . By Theorem 2.6, on every run.
| Symbol | Value | Role |
|---|---|---|
| layers 0, ..., J cover the weight range | ||
| logarithmic confidence parameter | ||
| sampling budget | ||
| smallest odd integer | rows, sign repetitions, diagnostic groups | |
| smallest power of two | buckets per row; controls collision noise | |
| bits of a pair identifier | ||
| smallest power of two | selection buckets per row |
Table 2: Parameters of the main algorithm. The last two are used only from Section 7.1 on.
The query cuts. Build an exact Gomory–Hu tree in each nontrivial component of , with a fixed root. A tree edge has weight and fundamental cut as in Section 2.3. For a pair whose endpoints lie in a common nontrivial component, choose a minimum-weight edge on the path of its tree and set
We call the query cut of , its query weight, and its scale at layer . A pair is eligible if its endpoints belong to the same connected component of ; all other pairs are skipped. All ties are broken deterministically.
If satisfies (3), then a cut has weight zero in exactly when it has weight zero in , so and have the same connected components. For every eligible pair , the Gomory–Hu property gives , and together with (3) this yields
The middle condition says that separates the endpoints of , including when . The weight of is within a constant factor of . The trees provide at most distinct query cuts. Section 7.2 obtains query cuts with the same guarantees in near-linear time from an approximate Gomory–Hu tree.
3.2 The three tables maintained at each vertex
Because the query cuts are determined after the stream, we maintain sketches of signed incidence vectors at the vertices. Orient each pair from its smaller endpoint to its larger endpoint. The signed incidence vector of a vertex has if is the smaller endpoint of , if is the larger endpoint, and otherwise. Then
Summing vertex sketches cancels internal edges and leaves exactly a signed sketch of the cut. This cancellation requires all vertices to use the same hashes and signs for a given table, layer, and row. Write ; by (6), .
Choose fair bits independently over all coordinates and layers , and define the survival indicator
We say that survives to layer if . The samples are nested, and . Every update to a coordinate uses the same bits and sketch coefficients.
Each vertex maintains the following tables at each layer . Every table has rows and buckets per row.
| Table | Hash in row | Counters per bucket | Purpose |
|---|---|---|---|
| Selection S | 1 | choose the edge and layer | |
| Diagnostic D | 32R pairs | measure collision noise | |
| Estimation T | R | estimate the weight |
Different rows independently hash the same sampled edges into buckets. Counters within a row keep the buckets fixed and vary only the signs. We call the pair that the decoder currently queries the target; each target will choose its own row for estimation.
The selection hashes and estimation hashes are independent families. Let be the selection signs, the diagnostic signs (), and the evaluation signs (). The counters are
The diagnostic and estimation counters use the same hash, so they contain the same colliding edges. All three tables use the same survival indicators. The hashes, selection signs, and diagnostic signs are four-wise independent across coordinates, with independent seeds for distinct hash functions and sign families. These seeds are independent of the survival bits and of the coarse sketch. The evaluation signs are fully independent of one another and of all other randomness.
An update with and changes only the tables at and . At each layer with , add times the appropriate sign to the appropriate bucket at , and subtract it at , for every row and sign repetition. Hashes, signs, and survival bits are reused for every update to . Thus these are linear sketches throughout the stream, including when intermediate edge weights are negative.
3.3 Recovery: select, diagnose, and estimate
After computing and its trees, sum the vertex counters on each fundamental cut. For any table, replacing the vertex argument by a set means summing over ; for example, . These are sketches of the sampled cut edges, with internal edges cancelled. Tree aggregation takes one postorder traversal for all counter arrays; see Section 7.1.
Select the edge and layer. Enumerate eligible vertex pairs one at a time; Section 7.1 replaces this enumeration by candidate discovery. For a pair , the query
estimates . The decoder compares it with the scale and takes the first layer that passes:
An empty minimum is infinity. The floor 1/2 uses the fact that positive weights are at least one; it prevents tiny noisy queries from accepting zero coordinates. Let be the pairs with finite . Store only this list, and abort if it exceeds pairs.
Choose a row with small collision noise. For each , put . The estimation table at layer has rows with independent hashes, so meets different colliding edges in different rows. The decoder chooses one of these rows, separately for each selected edge, and uses only this row to estimate . It makes this choice without knowing the target weight or using the evaluation signs. In row , query the target bucket with each pair of diagnostic signs and subtract:
We call a difference query. Each signed query has the same target contribution , which cancels in the difference. Thus the squared difference query measures only collision noise. Partition the 32R difference queries into groups of size 32, and set
Break ties deterministically. Section 4.3 shows that estimates the collision energy of row within constant factors, so minimizing it finds a row with small collision noise.
Estimate the weight with independent signs. In the chosen row , read the estimation counters of the target bucket, average their signed queries, and undo the subsampling:
Here estimates the original weight; also compensates for sampling at rate . Return with edges and weights , aborting if any weight is nonpositive.
All edge, layer, and row choices, including the check on the number of selected pairs, precede the use of evaluation signs in recovery. Conditional on these choices, the estimate of a surviving target is unbiased, and its error has the quadratic-sign form analyzed in Section 5. The decoder chooses layers solely through sketch queries and never tests survival bits directly; this also permits the seed implementation in Section 7.4.
4 Local sketch guarantees
Sections 4–6 analyze the recovery procedure of Section 3.3 for fixed query cuts. Recall from Section 3.1 that every eligible pair has a query cut , which separates its endpoints, and a query weight , which estimates and sets the scales . The analysis uses only the following two properties, and not how the query cuts are computed.
Definition 4.1 (Accurate query cuts). The query cuts are accurate if the eligible pairs are exactly the pairs with , and every eligible pair satisfies (6).
Exact Gomory–Hu trees of give accurate query cuts whenever satisfies (3) (Section 3.1), and so do the query forests of Section 7.2. In both cases, the query cuts depend only on the coarse sketch and on randomness of their own, which are independent of the three tables. Throughout Sections 4–6, we therefore fix accurate query cuts, and all probabilities are over the randomness of the three tables.
We first show that the selection queries are accurate (Section 4.1) and that accurate selection queries restrict each positive edge to two possible layers (Section 4.2). We then show that the diagnostic finds a row with small collision noise (Section 4.3), which gives small, centered weight-estimation errors (Section 4.4). Each local failure probability is at most , with the constants in (4), conditional on the prerequisites stated in the corresponding lemma.
4.1 Uniform accuracy of the selection queries
For a query cut of weight , subsampling reduces the expected total weight to . Dividing by the scale leaves . The following load bound makes this observation uniform over all query cuts and layers.
Lemma 4.2 (Load and point queries). For accurate query cuts, with failure probability at most over the survival bits (the fair coins that determine which pairs survive to which layers; see Section 3.2),
for every eligible pair and every layer . Fix any survival bits satisfying this bound. Then, with additional failure probability at most over the selection seeds,
for every eligible pair and layer, including zero coordinates.
Proof. Each load is a sum of independent -valued variables. Since and , its mean is at most by (6). Lemma 2.4 and a union bound over the loads give (13).
Fix an eligible pair and a layer , and write . Edges that do not cross cancel. Call a surviving edge crossing heavy if its weight exceeds , and light otherwise. The load bound gives at most heavy survivors, and light survivors of total squared weight at most . In one row, the signed reading of the bucket of is plus the contributions of the other survivors in that bucket. The target collides with another heavy survivor with probability at most . The noise from other light survivors has second moment at most , so its probability of exceeding is at most . For large enough , a row is therefore accurate, that is, its reading is within of , with probability at least .95. Taking the median of independent rows and a union bound over the queries prove the claim.
We refer to (14), for all eligible pairs and layers, as selection success.
4.2 Reduction to two sampling layers
Recall from Section 3.3 that the decoder selects a pair at the first layer at which its selection query reaches the threshold , and that is the set of selected pairs, namely those with finite . This section shows that each positive edge can be selected at only one of two consecutive layers, and that the choice between them is made before the survival coin of that separates them is read.
The baseline layer. Associate each positive edge with the baseline layer
where is defined for all integers . The decoder does not compute : it depends on the unknown final weight. Once and the query cuts are fixed, however, is deterministic. Since and , we have .
The hypothetical query. As in the proof of Lemma 4.2, the signed reading of the bucket of e in one row is plus the contributions of the other surviving pairs in that bucket. A median commutes with adding a constant, so
where , the median over the R rows of these collision contributions, depends on the selection seeds and on the survival bits of the other pairs, but not on the survival bits of e. We call
the hypothetical query of e at layer k: it is the selection query that the decoder would see if e survived to layer k and all other pairs were unchanged. The decoder never computes it. We use it only to define
Thus records whether the hypothetical query fails at the baseline layer. Because does not involve the survival bits of , neither does . Defining by the actual query instead would make it equal to one whenever did not survive to layer , so the layer would depend on the survival of itself.
Lemma 4.3 (Two possible layers). Assume selection success (14). Then:
-
a nonedge is never selected;
-
a positive edge e is selected if and only if it survives to layer , and in that case it is selected at layer ; that is,
- if , then , that is, .
Proof. Fix a layer and write . By (14), , so . Moreover, the actual query satisfies if , and if . Hence the actual query passes at layer if and only if survives to layer and the hypothetical query passes there. For a nonedge, at every layer, so it is never selected.
Next, the hypothetical query of a positive edge first passes at layer . For , the definition of gives , so . At layer it passes if and only if , by definition. At layer , the scale has halved: writing , the definition of gives . The hypothetical query is therefore at least , and also at least , so it passes.
Now combine the two facts. At layers before the hypothetical query fails, so the actual query fails as well. If , the actual query passes at , so . If , then by nested survival for every , so the actual query never passes and .
Finally, suppose , and write . If , then and , contradicting . Hence , the threshold is , and failure gives , that is, .
The quantity is determined by the selection seeds and the survival bits of all pairs with . The coin , which decides whether survives from layer to layer , is independent of all of them. This is the only adaptivity property needed in the sampling analysis (Section 6.4).
4.3 The diagnostic finds a good row
For a pair , a layer , and a row , the collision vector records the other sampled edges that enter the target's estimation bucket:
The sign already removes pairs that do not cross . For a selected edge, write for the collision vector of the row chosen by (11).
Lemma 4.4 (Diagnostic). Fix accurate query cuts, and fix any survival bits and selection seeds such that (13) and (14) hold. Then, with failure probability at most over the estimation hashes and diagnostic signs, which are independent of the fixed choices, every selected edge satisfies .
The argument has two parts: independent hashes provide a good row, and the difference queries recognize one without knowing the target weight or inspecting the evaluation signs.
Proof. A good row exists. Fix an eligible pair and a layer , and write . The load bound gives at most heavy survivors crossing , and light survivors of total squared weight at most . For one estimation hash, the probability of a collision with another heavy survivor is at most . By Markov's inequality, the probability that the light collision squared mass exceeds is also . Thus, for sufficiently large , a row has with probability at least 9/10. The rows are independent, so the probability that none is good is at most . A union bound over the target-layer pairs gives a good row simultaneously for all of them.
Difference queries recognize a good row. Fix the hashes, fix , and , and write . Consider one difference query computed at layer , and suppress the indices of its signs. Since , the signed query with copy equals , where . Hence . The two copies are independent. Within a copy, four-wise independence gives , , and : the factor cancels in even powers, and . Consequently, the difference query satisfies
Distinct difference queries use independent sign families, so an average of 32 squared difference queries has variance at most . Cantelli's inequality bounds the probabilities of falling below and above by and , respectively. Taking the median over the independent groups and a union bound over all triples give
simultaneously, where is computed at layer . Zero vectors have zero diagnostics exactly.
Conclusion. By Lemma 4.3, a selected edge has , so its diagnostic is computed at layer . Minimizing then chooses a row whose squared collision norm is at most , that is, a norm at most twice the best row norm, and hence at most . Choosing large enough makes the combined failure probability of both parts at most .
4.4 Estimating a selected weight
Lemma 4.5 (Weight estimation). Fix accurate query cuts, and fix any survival bits, selection seeds, estimation hashes, and diagnostic signs such that (13), (14), and the conclusion of Lemma 4.4 hold. Conditional on these choices, every selected edge satisfies
With additional failure probability at most over the evaluation signs, for every selected edge.
Proof. By Lemma 4.3, a selected edge is a positive edge with and . Its self-contribution to (12) is therefore ; the other terms give (17). The evaluation signs remain independent, so the error is centered. Each repetition is subgaussian with variance proxy . Since , the baseline definition (15) gives , and hence . Averaging repetitions gives for all selected edges by a union bound.
Let denote the event that (13), (14), and the conclusion of Lemma 4.4 hold, for the fixed accurate query cuts. This event involves no evaluation signs. After fixing any realization in , the coefficients in (17) are deterministic. Errors for different edges still share signs; they are centered but need not be independent. The next two sections control their sum without requiring an -accurate estimate of any individual weight.
5 A conditional bound for shared random signs
By (17), the error of a selected edge is the average over of its own evaluation sign times its collision noise . The error on a cut is therefore a quadratic form in the evaluation signs, and the errors of different edges are not independent: the sign that decodes one edge may appear in the collision noise of another. This section proves a tail bound for such quadratic forms that holds simultaneously for exponentially many sets of edges. Section 6.5 applies it within each connectivity class, with the selected edges of the class as targets, , , and the projections of cuts onto the class (Section 6.1) as .
Lemma 5.1 (Conditional estimation bound). Let the evaluation signs , indexed by a pair , a layer and row , and a repetition , be independent Rademacher signs, and let all other quantities below be fixed. Let be a set of targets. Each target is decoded at a layer and row , with decoding signs for , and has a collision vector . Assume that targets decoded at the same layer and row do not appear in each other's collision vectors:
In particular, . Define the collision noise of in repetition and the error on a set by
Let be a family of subsets of , and for each let and . Then
Proof. A decoding sign of a target can occur only in the collision noise of targets with , and there its coefficient is by (18). Hence all collision noise depends only on the other signs, and we condition on them. We first show that a single event, which does not depend on , bounds the energy of every target. Given this event, each is a linear combination of independent decoding signs whose coefficients have bounded energy.
Step 1: energy of the collision noise. Fix a target with and write . Each is a sum of independent terms , and a Rademacher sign satisfies for every real . Hence for every real . With an independent standard Gaussian and the identity , this gives
The collision noises involve disjoint sets of signs and are therefore independent, so . By Markov's inequality,
If , every vanishes. A union bound over targets therefore shows that
fails with probability at most . This needs no independence between the collision noise of different targets.
Step 2: the decoding signs. Fix the other signs at any values for which (20) holds. The collision noise is then fixed, and is a linear combination of the decoding signs in which each sign appears at most once. Writing for expectation over the decoding signs, we have for every real
By Chernoff's method for both tails, with conditional probability at most . A union bound over , together with the failure probability of (20), proves (19).
The energy event does not depend on , so its failure probability is paid once for the whole family , while each pays only . This is what makes the lemma usable for exponentially many projections: in Section 6.5, the tail parameters (22) keep the sum of these terms small by (23), and Lemma 6.1 verifies the sign separation within each class.
6 Preserving all cuts
We keep the accurate query cuts fixed, so the only randomness is in the three tables. A cut of is the disjoint union of its restrictions to the connected components of , so it suffices to handle one component at a time. Fix a connected component of and let denote its positive edges. Cuts are taken within this component, while and still refer to the whole graph. We split each cut into its projections onto connectivity classes (Section 6.1), bound the error on all projections simultaneously (Sections 6.2–6.5), and then sum over classes and components (Section 6.6). Section 6.7 collects the resulting guarantee.
6.1 Connectivity classes and cut projections
Partition the positive edges by their connectivity estimates:
These classes are used only in the proof and are distinct from the sampling layers . By (6), every positive edge has , so it suffices to take , and there are at most classes. Fix one class. For a cut , its projection onto this class is . The error that this class contributes to the cut, namely the total estimated weight of the selected edges in minus the true weight , depends only on . Cuts with the same projection therefore have the same error from this class, and it suffices to union bound over the distinct nonempty projections rather than over all cuts. (An empty projection contributes no error.)
Two weights play different roles:
The projection mass controls the variance. The smallest realizing cut weight controls how many such projections there can be. Since lies in every cut that realizes it, . Neither quantity is computed by the decoder.
By (6), every edge of the class has true connectivity at least , and hence every nonempty projection has . Lemma 2.3, applied to the component (which has at most vertices) with and , gives
Group the nonempty projections by , with . Taking shows that group has at most members. Thus the choice
with a sufficiently large absolute constant ensures
Indeed, every member of group has , so the contribution of the group is at most . Moreover, there are at most component-class pairs. We will use this same union bound for each of the three errors.
6.2 Decomposing the error
Our goal for every nonempty projection is
For the calculations, abbreviate
The same scale will bound all three error terms.
Selection success depends on the survival bits at every layer, including the coins , so we do not condition on it. Instead, we clip the extra-layer decision:
The indicator is deterministic, so , like , is determined by the selection seeds and the survival bits through layer . Lemma 4.3 shows that on selection success, since . Unlike , however, keeps the coefficients of the extra-layer error bounded on every realization.
Define the three errors:
baseline sampling,
(25)
one extra layer,
(26)
weight estimation.
(27)
On selection success,
To see this, recall that . On selection success, Lemma 4.3 gives for selected edges and . Hence
The first sum splits into by the identity
applied with and . The identity is trivial for , and for it follows from nested survival, . The first term on the right is the error of sampling at its baseline layer. The second is the change caused by one more fair coin: if survives to layer , its rescaled indicator doubles or drops to zero with equal probability. Thus the adaptive choice of the layer enters only through the coefficients of .
It remains to bound each by a constant multiple of .
6.3 Baseline sampling: Bernstein's inequality
The baseline layers are fixed once the query cuts are fixed. Thus the summands of are independent and centered. Put . If , minimality in (15) and give
If , the summand is identically zero. It follows that the summands have magnitude at most and .
By Bernstein's inequality, in the form (2), we have except with probability at most . Since , this bound is . A union bound over all projections, using (23), shows that
holds simultaneously for all of them, with failure probability at most .
6.4 The extra layer: Freedman's inequality
Order the edges of as by increasing , with deterministic ties, and write
To view this sum as a martingale, reveal the randomness in the following order: first the selection seeds, and then the survival bits layer by layer, in increasing order of the layer. Within a layer, reveal the coins of the edges of in increasing order of , and the other coins in any order. Since the are nondecreasing, the coins are revealed in this order. For , let denote everything revealed before , and let denote everything revealed. The coefficient depends only on the selection seeds and the survival bits through layer (Section 4.2), so it is determined by . In contrast, is independent of everything revealed before it, so is a fresh Rademacher sign given . Hence the partial sums of form a martingale with respect to . The clipping ensures on every realization, including those where a sketch query is inaccurate. Therefore the predictable quadratic variation of , as in Lemma 2.5, satisfies
The increments are martingale differences, have conditional variance , and are bounded by on every realization. Whenever (29) holds, is at most the deterministic quantity . Inequality (2) bounds the joint event of this variance bound and a deviation exceeding . This threshold is : its linear term is , and
The last inequality uses . Inequality (23) now gives for all projections, with an additional failure probability at most . We do not condition on (29). Instead, if exceeds the threshold, then either (29) fails, which is already accounted for in Section 6.3, or the joint event bounded by (2) occurs.
6.5 Weight estimation: separating the signs within a class
Fix any survival bits, selection seeds, estimation hashes, and diagnostic signs such that and (29) hold. Then only the evaluation signs remain random. For a selected edge, define
Lemma 4.4 gives . Fix one connectivity class and put . Two targets in this class using the same layer and row cannot appear in one another's collision vectors: each is too heavy for the other's collision-norm bound.
Lemma 6.1 (Separation within a connectivity class). For with , we have . Consequently, no decoding sign of this class occurs in the collision noise of any target in this class.
Proof. The case follows from the definition of . Otherwise, the two targets use the same layer and row. Since , the baseline definition implies . Also within the class, so
A selected survives at layer . If , its magnitude would therefore be exactly , contradicting this inequality. Thus .
For the second statement, recall that the collision noise of uses only the signs . If , it therefore contains no decoding sign of . If , the coefficient of is by the first statement.
By (17), for a projection onto this class,
This is the quantity of Lemma 5.1, whose hypothesis is verified by Lemma 6.1. It remains to bound the energy of the collision noise.
Every selected edge survives its baseline layer, and by (15). Also in this class. Consequently,
Use the right side of (32) for and (22) for in Lemma 5.1. Its threshold is at most
This controls all projections within the fixed class.
Apply the lemma separately to each component and connectivity class, then union bound their failure probabilities. The target sets partition , so the failure terms for their common energy bounds sum to
Together with (23) and , this bounds the total estimation failure probability by .
The conditioning above is performed separately for each class: a decoding sign from one class may occur in another class's collision noise. The final union bound needs no independence between classes. Since this bound holds for every such choice of the other randomness, it also holds after averaging over these choices.
6.6 From projections to cuts
On selection success, (28) and the bounds of Sections 6.3–6.5 prove (24) for all nonempty projections simultaneously. Now consider a cut of the component, let be its weight, and let be its nonempty projections. The classes partition the edges, and itself realizes each , so
The error of on is the sum of the errors on its projections:
Apply (24) to each term and use the triangle inequality. Since there are at most classes, the Cauchy–Schwarz inequality bounds the square-root terms by
Each linear term is at most , so these terms sum to at most . Hence
Finally, by (4), so and . For large enough , the right-hand side is therefore at most . A cut of is the disjoint union of its restrictions to the components of , so summing over the components gives the same guarantee for every cut of . In particular, cuts of weight zero are preserved exactly.
Why the masses matter. The Cauchy–Schwarz step uses and therefore loses only a factor . If each mass were replaced by its upper bound , the square-root terms would sum to , which would require of order . Keeping the masses requires only of order . This saves one logarithmic factor in the sampling budget, the bucket width, and the output size. The dependence on remains quadratic.
Output size. Finally, we bound the number of selected edges. The baseline layers are deterministic, so the indicators are independent over all positive edges of , in all components. By the definition of , . Hence
where the last inequality uses from (6) and Lemma 2.2. By Lemma 2.4,
with failure probability at most . On selection success, Lemma 4.3 and give
Thus (33) implies . In particular, the list of selected pairs stays within the limit of Section 3.3.
6.7 Correctness for accurate query cuts
The following proposition collects the results of Sections 4–6.
Proposition 6.2 (Correctness for accurate query cuts). Fix accurate query cuts independent of the three tables, and let the survival bits and evaluation signs be fully independent. Outside eight events, each of probability at most , the decoder of Section 3.3 returns a positive reweighting of a set of at most edges, and is a -cut sparsifier of .
Proof. The eight events are the load bound and selection accuracy (Lemma 4.2), the diagnostic (Lemma 4.4), positivity of the estimates (Lemma 4.5), the baseline, extra-layer, and weight-estimation bounds (Sections 6.3–6.5), and the output-size bound (33). Outside these events, Lemma 4.3 shows that the selected pairs are positive edges, (33) gives , and Lemma 4.5 shows that all output weights are positive. Hence the decoder returns . Section 6.6 shows that every cut of is preserved within a factor of .
With the coarse sparsifier of Theorem 2.6 and exact Gomory–Hu trees, the query cuts are accurate whenever the coarse sketch succeeds, and they are independent of the three tables because the coarse sketch uses independent randomness. Proposition 6.2 therefore gives a polynomial-time algorithm that, with fully independent survival bits and evaluation signs, fails with probability at most . Section 7 implements this algorithm in near-linear time and with short seeds.
7 Near-linear-time implementation
To achieve the bounds of Theorem 1.1, we modify the algorithm of Sections 3–6 in three places. First, the decoder tests all vertex pairs. Second, the exact Gomory–Hu trees require maximum-flow computations. Third, the subsampling coins and evaluation signs, which the analysis treats as fully independent, must be generated from short seeds, quickly enough for every update and every recovery query. Sections 7.1, 7.2, and 7.4 address these three points in turn. Section 7.3 uses the same tools to prove Theorem 2.6, and Section 7.5 proves Theorem 1.1.
7.1 Fast candidate discovery
The decoder of Section 3.3 tests every eligible pair, which takes queries even though at most pairs are selected. We replace pair enumeration by a discovery step that reads candidate pairs directly off the selection buckets. The idea is simple. If one pair dominates a bucket, the bucket has the sign of that pair's contribution. If we also keep counters in which this contribution is multiplied by according to one bit of the pair's identifier, then comparing their signs with the sign of the base counter reveals the identifier bit by bit.
Identifiers and additional counters. We identify the pairs with through the bijection
Given , the pair is found in time by binary search for the largest with . Identifiers are written with bits, and denotes the th bit of . Next to the base selection counter , every selection bucket stores one bit counter for each :
A bit counter uses the same hash, survival indicators, and selection signs as the base counter. It only multiplies the contribution of each pair by a fixed sign determined by the pair's identifier. To leave room for the additional counters in the union bound below, we enlarge the selection width from to , the smallest power of two at least , and let the selection hashes map to . The diagnostic and estimation tables are unchanged. The enlarged selection table still satisfies Lemma 4.2, whose proof needs only a width of at least .
Decoding candidates. After the stream, we compute the cut sums of all counters on every fundamental cut , by the postorder aggregation described at the end of this section. For every fundamental cut , layer , row , and bucket with , we decode
In words, bit is set exactly when the bit counter and the base counter have opposite signs. We discard values and pairs that are not eligible, and we remove duplicates by sorting. The remaining pairs are the candidates. For each candidate we run the selection rule (10) at its own query cut , followed by the diagnostic and the estimate, exactly as in Section 3.3. A decoded identifier is therefore only a candidate: whether it enters is decided by the same test as in pair enumeration.
Proposition 7.1 (Candidate discovery). Fix accurate query cuts and any survival bits such that the load bound (13) holds. With failure probability at most over the selection seeds, every positive edge with is a candidate. If, in addition, (14) holds, then candidate discovery and pair enumeration return the same output.
Proof. A dominated bucket decodes correctly. Fix a positive edge with and a row , and write , , and . The query cut is a fundamental cut, so its buckets are decoded. In the cut , the base counter of bucket equals , and the th bit counter equals . Here is the contribution of , and collect the contributions of the other pairs in the bucket. By the definition of , . If for every , then exceeds every , so each counter is nonzero and has the sign of its term involving . The product of the th bit counter and the base counter is therefore negative exactly when bit of is one, and the bucket decodes to .
A good row exists. Call row good for if collides with no other surviving pair of weight above that crosses , and if the remaining collision noise in each of the counters has magnitude at most . As in the proof of Lemma 4.2, the load bound gives at most such heavy survivors and light squared mass at most . A heavy collision occurs with probability at most . Multiplying the contribution of each pair by a fixed sign does not change the second moment of the light noise, so by Chebyshev's inequality each of the counters has light noise above with probability at most . By a union bound, the row is good with probability at least for a large enough , since . Rows are independent, so all of them are bad with probability at most .05. A union bound over the pairs bounds the total failure probability by .
Same output as enumeration. Assume that both events hold. By Lemma 4.3, pair enumeration selects exactly the positive edges with , at layer . Since , each such edge also has and is therefore a candidate, even if its selection query first passes at layer . Conversely, every candidate undergoes the same selection test as in enumeration, so it is selected exactly when enumeration selects it. In particular, nonedges are rejected as before. The two decoders therefore select the same pairs at the same layers, and their diagnostics and estimates coincide.
The proposition is the only new ingredient for correctness: the selection and weight-estimation analyses apply unchanged.
Recovery time. Candidate discovery removes the enumeration of pairs, but the decoder must still form the counters of all query cuts and locate the query cut of every candidate. A naive implementation of either step takes quadratic time. We now show that all steps of recovery from the three tables take near-linear time. Suppose that the query cuts are induced through (5) by a rooted forest on , as for exact Gomory–Hu trees and for the query forests of Section 7.2. The selection table now has counters per bucket and buckets per row, so the three tables have
counters in total. Recovery from the tables consists of the following steps.
-
Preprocessing the forest. A depth-first traversal of each tree records entry and exit times. For the tree edge between a vertex and its parent, a vertex of the same tree lies in exactly when its entry time lies outside the interval of , which takes time to test. Binary lifting stores, for every vertex and every , the th ancestor of and a minimum-weight edge among the tree edges above . After preprocessing, a minimum-weight edge on the tree path of a pair is found in time.
-
Aggregation. In each tree, we replace every vertex counter, in place and in postorder, by the sum of the counters in its subtree. For the tree edge above , the counters of are then the differences between the aggregated counters of the root of the tree and those of . This takes operations.
-
Discovery. The at most fundamental cuts have selection buckets in total. Each nonzero bucket is decoded in operations, and its pair is recovered in time. The raw list therefore has entries, and sorting it takes operations.
-
Testing candidates. A candidate needs and , and then selection queries, each of which reads one aggregated counter and evaluates one hash value and one sign. Including the medians, this takes operations and coefficient evaluations.
-
Diagnostics and estimation. Each of the at most selected edges needs diagnostic and estimation counters with their signs, for operations and coefficient evaluations in total.
Altogether, recovery from the tables takes operations and coefficient evaluations. Section 7.4 and Appendix A compute every coefficient in polylogarithmic time, so this part of recovery takes time. By contrast, pair enumeration spends operations on selection queries alone.
7.2 Query forests from approximate Gomory–Hu trees
Exact Gomory–Hu trees give more than the analysis needs. By (6), a query cut only has to separate the endpoints of its pair and have weight within a constant factor of their connectivity, provided that the query weight is the exact weight of the cut in the coarse graph. Approximate Gomory–Hu trees (Theorem 2.7) provide such cuts in near-linear time: for every pair, a minimum-weight edge on its tree path has a fundamental cut of nearly minimum weight.
The difficulty is that Theorem 2.7 needs a connected graph, and its failure probability is polynomially small only in the number of vertices of its input, whereas the coarse graph may have many small components. Running the algorithm once on each component therefore does not give a small failure probability. One way around this is to boost: run the algorithm times on each component, and for each pair use the run that gives the smallest query weight. Every tree edge on the path between two vertices has a fundamental cut that separates them, so query weights never underestimate connectivities. Hence one successful run per component suffices, and each run succeeds with probability at least 1/2. The query cuts then come from forests, which costs an extra logarithmic factor in the recovery time.
Below we give a construction that needs only one call and yields a single forest, which saves this logarithmic factor. Specifically, we add a hub vertex and join it to every component of the coarse graph by an edge much lighter than any cut inside a component. The resulting padded graph is connected and has vertices, so it satisfies the hypotheses of Theorem 2.7, and a single call succeeds with high probability. The approximate tree of the padded graph may join different components. However, every tree path between different components contains an edge whose fundamental cut is light, whereas no tree path inside a component does. Deleting these edges therefore separates the components again and leaves a tree on each of them.
Lemma 7.2 (Query forest). Let be a graph on with edges, whose weights are positive multiples of and at most , where , and let with . Let be the connected components of with at least two vertices. There is a randomized algorithm that uses time and space and, with probability at least , returns for each a tree on , rooted at , with edge weights such that the following hold, where the fundamental cut of a tree edge is the side of that contains .
-
for every tree edge .
-
for all distinct and every minimum-weight edge on the path of .
In other words, is a 1.01-approximate Gomory–Hu tree of in which the weight of every tree edge is the exact weight of its fundamental cut.
Proof. Find the components of by breadth-first search, and return the empty forest if .
Fundamental cut weights. We use the following subroutine twice. Given a rooted tree and a weighted graph on the same vertices, it computes, for every tree edge , the weight in of the fundamental cut of , that is, the total weight of the edges of with exactly one endpoint in the subtree below . We keep a number at every vertex , initially zero. The idea is to record the weight of each edge at its two endpoints and to cancel both copies at their lowest common ancestor, so that the sum of over a subtree retains the weight of exactly those edges that leave the subtree. Concretely, for every edge of , add its weight to and to , and subtract twice its weight from , where is the lowest common ancestor of and . A subtree contains exactly when it contains both and , so the sum of over a subtree counts the weight of exactly when one of its endpoints lies in the subtree and the other does not. The desired weights are therefore the subtree sums of , which one postorder traversal computes. Lowest common ancestors take time after preprocessing with an Euler tour and a sparse table, so the subroutine takes time.
The padded graph. Multiply every weight of by , so that every weight becomes an integer between and . Add a hub vertex , and join it by an edge of weight one to the smallest vertex of every connected component of , including the isolated vertices. In particular, is joined to every root . Let be the resulting graph on , with weights and pair connectivities . It is connected and has vertices, edges, and integer weights between 1 and .
Connectivities in . Inside a component, the padding only rescales connectivities, while different components are joined only through light edges. More precisely, let . A cut of that separates and restricts to a cut of that separates them, and the edges of crossing it already have weight at least . Conversely, let be the side not containing of a minimum cut of separating and . Since is the only vertex of with neighbors outside , the cut crosses only edges of . Hence , where the last step uses . If instead and , then , because the only edge leaving is the hub edge at .
The approximate tree. Run the algorithm of Theorem 2.7 on with . Since and , a suitable constant in its high-probability guarantee makes its failure probability at most . We stop the algorithm and abort if it exceeds its time bound, and we also abort if its output is not a spanning tree of . Let be the tree, rooted arbitrarily, and let be the weight in of the fundamental cut of a tree edge , computed by the subroutine. On success, the definition of an approximate Gomory–Hu tree gives, for all , an edge on the path of with .
Splitting the tree. Keep the tree edges with . For , every edge on the path of separates and , so it has , and the whole path is kept. For and , on success some edge on the path has , and this edge is deleted. Hence the component of the kept forest that contains has vertex set exactly , and for the path of is the path of . We check that the components of have vertex sets , and abort otherwise.
Exact weights in . Root at , and compute for every tree edge by the subroutine, applied to and the edges of inside . No edge of leaves , so this counts every edge crossing . Moreover, , because is a nonempty proper subset of and is connected in . This gives property 1.
For property 2, let . Every edge on the path of separates and , so . Conversely, choose an edge on this path with . Deleting from splits into its intersections with the two sides of . Thus is the weight in of the edges inside that cross the fundamental cut of , which is at most . A minimum-weight edge of the path therefore has weight at most .
Time and space. Breadth-first search and padding take time, and the two uses of the subroutine take time in total. Theorem 2.7 takes time because is a constant. The space is bounded by the time.
Query cuts from the query forest. Lemma 7.2 needs weights that are positive multiples of and polynomially bounded. We may assume that has this form, with and weights at most , since rounding as in Appendix A.3 enforces it on every run. Moreover, by Lemma A.1, if satisfies (3) before rounding, then the rounded graph, which we still call , has the same components as and satisfies
We apply Lemma 7.2 to with and with randomness independent of the three tables, and we use the resulting trees and weights in place of the Gomory–Hu trees in (5). As before, a pair is eligible if its endpoints lie in a common nontrivial component of .
Now suppose that both Theorem 2.6 and Lemma 7.2 succeed, and let be an eligible pair. We check the three conditions of (6). By (35), , and so property 2 gives
The cut separates the endpoints of because lies on their tree path. Finally, by property 1 and (35), . Since and have the same components, the eligible pairs are exactly those with , so the query cuts are accurate. They are also independent of the three tables, as they depend only on the coarse sketch and on the independent randomness of Lemma 7.2.
7.3 A near-linear-time constant-accuracy sparsifier
In this section, we prove Theorem 2.6. For constant , our recovery procedure returns a constant-accuracy sparsifier in near-linear time, but only if it is given accurate query cuts. The difficulty is that, in the main algorithm, these query cuts come from a constant-accuracy sparsifier, which is exactly what we are trying to build. We escape this circularity using the fact that query cuts need to be correct only up to constant factors (see (6)). Let and be weight vectors on the pairs, viewed as graphs. If every cut of is within a factor close to one of the corresponding cut of , then a near-minimum cut separating two vertices in is also a near-minimum cut separating them in . Hence query cuts computed from a sparsifier of are accurate for .
Our construction therefore starts from a graph whose minimum cuts are explicit and moves toward in small steps, so that each step can take its query cuts from the sparsifier recovered in the previous one. Specifically, let be the indicator vector of the spanning star with center 1, whose edges are for . Set
and let be the first index with . We follow the regularization path
In , the star is so heavy that it dominates every cut, and its minimum cuts are explicit. Each step lowers the multiple of the star by a factor of about 65/64, so consecutive graphs differ by at most this factor in every coordinate. As a result, the sparsifier recovered for one graph supplies accurate query cuts for the next. Each stage runs our recovery procedure in the form of Lemma 7.3 below. At the end of the path, the star is negligible on every cut of positive weight in , so we remove it and divide by , which leaves a constant-factor cut approximation of . A final recovery on itself then produces a sparsifier supported on edges of . Each stage uses its own independent copy of the three-table sketch, and since the sketches are linear, all copies are maintained in the same single pass.
Outline. After the stream, the construction performs the following steps.
-
Stage 0. Run our recovery procedure (Lemma 7.3) on the sketch of , with the star as the query forest. This gives a sparsifier of .
-
Stages 1, ..., . Run our recovery procedure on the sketch of , with query cuts from a query forest of . This gives a sparsifier of .
-
Separating the components. Using a query forest of , discard the pairs of that join different components of , and divide the remaining weights by . This gives a graph that approximates every cut of within a constant factor.
-
The final recovery. Run our recovery procedure on the sketch of , with query cuts from a query forest of . This gives .
Recovery with given query cuts. The analysis in Sections 4–6 does not use the fact that the query cuts come from the coarse sparsifier. It uses only that they are accurate (Definition 4.1) and independent of the three tables. The next lemma records this observation for an arbitrary integer weight vector in place of . For query cuts induced by a rooted forest through (5), a pair is eligible if its endpoints lie in a common tree, and the query cuts are accurate for if Definition 4.1 holds with in place of .
Lemma 7.3 (Recovery with given query cuts). Let and , with . Consider the three-table sketch of , built with in place of and with the random tapes of Section 7.4, and its recovery with candidate discovery. Suppose that the query cuts are induced by a rooted forest with -bit weights, are accurate for , and are independent of the sketch. Then the sketch uses bits, and recovery takes time and returns edges. With probability at least , the output is a positive reweighting of pairs in that is a -cut sparsifier of .
Proof. Sections 4–6 use the query cuts only through their accuracy and their independence from the three tables. Otherwise, they use only that the input weights are integers in : this makes positive weights at least one, gives , and lets us apply Lemmas 2.2 and 2.3. All of this holds for with in place of . With fully independent tapes, Propositions 6.2 and 7.1, applied with the parameters , therefore bound the failure probability by . Implementing the tapes as in Section 7.4 adds at most , so the total is at most .
The remaining bounds hold on every run. The decoder returns at most pairs (Section 3.3), where the sampling budget is at accuracy 1/64. The tables and seeds take bits, and recovery takes time, by Sections 7.1 and 7.4.
Properties of the path. A nonempty set with has and
We use a star because its cut weight grows at the same rate as this bound on the cuts of . Hence , only a factor 128n larger than the largest weight of , already makes the star dominate every cut of . Scaling by , rather than lowering the multiple of the star below one, keeps every integral: each is an integer vector with all coordinates in , where . Its support contains the star, so is connected and all pairs have positive connectivity in it.
The schedule satisfies
and its length is . For (36), it suffices to show that . The second inequality holds because . For the first, gives , and also . For the length, if , then
because . Hence decreases geometrically until it is at most 129, and from 129 the next value is . Therefore .
Copies and the single pass. The length depends only on and , so all copies can be allocated before the stream begins. We use independent copies of the three-table sketch: one for each with , with weight bound , and one for , with weight bound . Every copy has accuracy , implements its random tapes as in Section 7.4, and has failure parameter , the largest power of two at most . All copies are maintained during the single pass over the original stream. Let be the linear map computed by the copy for . Once the randomness of the copy is fixed, is a fixed matrix. During the stream we maintain , applying each update to this copy exactly as in Section 3.2. After the stream, we form
by multiplying every counter of the copy by and then applying the updates () for . By linearity, the result is exactly the sketch that the copy would hold after a stream that produces directly. If any step below aborts, the construction returns the empty graph.
Stage 0: query cuts from the star. We say that stage succeeds if the copy for returns a graph with
For , the star dominates every cut. If is nonempty and , then , so
The same bounds hold when , by passing to the complement. We use the star itself as the query forest. Root it at 1, and give every edge the weight , so that its fundamental cut is . For a pair with , the minimum-weight edge on its tree path, with ties broken toward the smaller child, is if and otherwise. In either case for an endpoint of , so separates the endpoints of , , and
Every cut separating and leaves one of them on the side without vertex 1, so it has -weight at least one and -weight at least . Hence , which gives . The star spans , so all pairs are eligible, and all of them have positive connectivity because is connected. These query cuts are deterministic and accurate for , so Lemma 7.3 shows that stage 0 succeeds except with probability at most .
Stage : query cuts from the previous stage. The graph is available only through its sketch, whereas is an explicit graph with edges whose cuts are within a constant factor of those of . Its near-minimum cuts are therefore near-minimum cuts of , and we use them as query cuts. Formally, let , and suppose that stage succeeded. By (36), every cut satisfies . Combined with (38) for , this gives
Since 63/64 > 24/25 and , Lemma A.1 applies with , , and : the normalized graph approximates every cut of within , and it is connected because is. We check that is connected, aborting otherwise, and run Lemma 7.2 on it with failure parameter and fresh randomness. On success it returns a single tree on . As at the end of Section 7.2, with in place of and in place of , the induced query cuts satisfy and , so they satisfy (6) for . All pairs are eligible, and all have positive connectivity in the connected graph , so the query cuts are accurate for . They are a function of and the fresh randomness, and depends only on the copies for . Hence they are independent of the copy for . Conditional on the outcome of all earlier steps, Lemma 7.3 shows that stage succeeds except with probability at most .
Each stage recovers from its own exact sketch, and the previous output supplies only query cuts, that is, it only determines where the recovery looks. Errors therefore do not accumulate along the path: every successful stage has accuracy with respect to its own , no matter how many stages precede it.
Separating the components. After the last stage, approximates within [63/64, 65/64]. The star is now negligible on every cut of positive weight in : such a cut has -weight at least , while its star part is at most . The star still connects different components of , however, and these artificial connections must be removed before we divide by . Normalize , check that it is connected, and run Lemma 7.2 on it with failure parameter . Let be the query weight that the resulting tree assigns to a pair . For every pair in the support of , set
and set for all other pairs. If stage succeeded, then the argument of the previous paragraphs, now with and , gives for every pair on success of Lemma 7.2, and in particular . With these bounds, the threshold keeps exactly the pairs whose endpoints lie in the same component of :
-
If and lie in the same component of , every cut separating them has -weight at least one. Hence , and .
-
If and lie in different components, let be the component containing . Then and , so .
The discarded weight is small. Let be the components of , including isolated vertices. A discarded pair has its endpoints in two different components, so it crosses exactly two of the cuts , whereas a kept pair crosses none of them. Every has , so (38) gives
where the last step holds because each of the star edges crosses at most two of these cuts. Hence the discarded weight is at most .
approximates every cut of . Let . If , then is a union of components of , so every pair crossing is discarded and . Otherwise by integrality. The kept part of equals , and the discarded part is at most . Using and , we get
In the other direction, , and , so
Thus approximates every cut of w within [24/25, 26/25]. It may still contain pairs that are not edges of G, because Y is supported on arbitrary pairs. The final recovery removes them.
The final recovery. By Lemma A.1 with , , and , the normalized graph approximates every cut of within [.95, 1.04] and has the same components as . We run Lemma 7.2 on with failure parameter . If it succeeds, the argument at the end of Section 7.2, with in place of , shows that the resulting query cuts are accurate for . They depend only on the copies for and on the randomness of the query forests, so they are independent of the copy for . Lemma 7.3, applied to this copy, then returns a positive reweighting of edges of that is a -cut sparsifier of . Since , the graph satisfies (3).
Failure probability. The construction calls Lemma 7.3 times, once for each and once for , and Lemma 7.2 times, for stages , for , and for . Consider the first call that fails. Conditional on the success of all earlier calls, its inputs satisfy the hypotheses of its lemma and are independent of its own randomness, so it fails with probability at most . Summing over the calls, the construction fails with probability at most . The parameter of each copy already accounts for the replacement of its random tapes.
Space and time. Both and are polynomial in , as Lemma 7.3 requires, and there are copies. By Lemma 7.3, each copy, including its seeds, uses bits, and each recovered graph has edges. During recovery we keep only the graph that supplies the current query cuts, the graph under construction, and one query forest, so the workspace is also bits.
Each update is applied to all copies, in time per copy (Section 7.5), so the update time is . After the stream, each stage forms (37) by rescaling the counters of its copy and applying updates, normalizes a graph with edges, checks connectivity, and runs Lemmas 7.2 and 7.3. Each of these steps takes time, so recovery takes time over all stages. Appendix A bounds the bit lengths of all numbers.
These bounds hold on every run: the limits on the number of selected pairs, the counter widths, the loop bounds, and the time limit of Lemma 7.2 are enforced on every run, and a run that would exceed one of them aborts. Together with the approximation guarantee and the failure probability, this proves Theorem 2.6.
7.4 Locally computable random tapes
The analysis of Sections 4–6 assumes that the survival bits and the evaluation signs are fully independent, but storing them explicitly would take bits. We therefore generate both sequences, which we call the survival tape and the evaluation tape, from short seeds with the pseudorandom generator of Kapralov et al. [KMM+20] (Proposition 2.8). This generator builds on the generators for space-bounded computation of Nisan [Nis92] and of Nisan and Zuckerman [NZ96], and each of its output bits can be computed in polylogarithmic time. We describe the construction for a single copy of the three-table sketch, which sketches an integer vector with accuracy , failure parameter , and sampling budget . This covers both the main sketch and every copy in Section 7.3. Throughout, the query cuts are fixed. They come from the coarse sketch and the query forest, or, in Section 7.3, from earlier copies, so their randomness is independent of both tapes. The same holds for the four-wise seeds. Let be the number of bits of the three tables.
How the decoder uses the two tapes. On each tape, the bits are grouped into blocks, one per pair. Block of the survival tape consists of , and block of the evaluation tape consists of all signs . The decoder uses the two tapes differently. It never reads a survival bit, since the survival bits affect the output only through the counters of the three tables. In contrast, after selection and the diagnostic, it reads the evaluation signs , , of every selected edge. We therefore replace the evaluation tape first, while the survival tape is still truly random, and the survival tape second.
Success. Call a run of the decoder successful if it returns a graph with at most edges that assigns positive weights only to pairs of positive input weight and approximates every cut of within a factor of . Success captures the entire recovery guarantee, so it suffices to show that each replacement decreases the probability of success by at most . In particular, we do not need the intermediate good events of Sections 4–6 to keep their probabilities.
Algorithms for the analysis. Each replacement is justified by an algorithm that is used only in the analysis. It reads one tape once, in order, has read-only access to all other data, and finally decides whether the run is successful, enumerating all cuts if necessary. Its working memory holds the tables, the workspace of the decoder, and the signs stored in Step 1 below, so it runs in space . We apply Proposition 2.8 with and a constant such that . Such a constant exists because and , and suffices because each tape has at most bits. The two replacements use independent copies of the generator.
Step 1: the evaluation signs. Fix the query cuts, the survival tape, and all four-wise seeds. The selection and diagnostic counters involve no evaluation signs, so the candidates, the selected edges, their layers, and their rows are now fixed. If more than edges are selected, the run is unsuccessful regardless of the evaluation signs. Otherwise, consider the algorithm that visits the pairs in order and reads block of the evaluation tape. It adds the contribution of , whose weight it reads from its input, to every estimation counter, and if is selected, it also stores the signs . By linearity, its final counters equal those of the streaming algorithm. They determine every estimate , the test that all output weights are positive, and hence the output and whether the run is successful. The working memory consists of the three tables, at most stored signs, and the workspace of the decoder and of the final test. Proposition 2.8 therefore increases the failure probability by at most for every fixed choice of the other randomness, and hence also after averaging over it.
Step 2: the survival bits. Now fix the query cuts, the four-wise seeds, and a seed of the evaluation generator, so that the evaluation signs form a fixed string. Consider the algorithm that visits the pairs in order, reads the bits of block one at a time, and adds the contribution of to all three tables at every layer with . Besides the three tables, its working memory holds only the current pair and layer and the product of the bits read so far in the current block. The final counters, together with the fixed seeds and evaluation signs, determine everything the decoder does: selection and candidate discovery use the selection counters, the diagnostic uses the diagnostic counters, and the estimates use the estimation counters and the fixed evaluation signs. Since the decoder never reads a survival bit, the algorithm can finally run the decoder and decide success within bits of memory. An independent copy of the generator therefore increases the failure probability by at most another . Combining the two steps, the failure probability with both generators exceeds its value with fully independent tapes by at most .
Computing the random bits. The sketch stores the two generator seeds, of bits each, together with the four-wise seeds. Whenever it processes an update to a pair , or queries during recovery, it computes each bit of block that it needs from the relevant seed, in polylog() time by Proposition 2.8. For the main sketch, , so both seeds have bits. For a copy in Section 7.3, they have bits. Both replacement bounds hold for every fixed choice of accurate query cuts, so they remain true conditional on the success of all earlier steps in Section 7.3.
7.5 Proof of Theorem 1.1
If or , we simply store the input exactly, which meets all bounds of Theorem 1.1 (Appendix A). Otherwise, we run the algorithm of Section 3 with three changes: the decoder uses candidate discovery (Section 7.1), the query cuts come from the query forest of Lemma 7.2 with (Section 7.2), and the survival and evaluation tapes are generated as in Section 7.4. As in Section 3, the coarse sketch is that of Theorem 2.6 with . This theorem was proved in Section 7.3.
Space. The three tables have counters (Section 7.1), each of bits (Appendix A). By Theorem 2.6, the coarse sketch uses bits, including its seeds and recovery workspace. Normalizing , computing the query forest (Lemma 7.2), and preprocessing it (Section 7.1) need bits. Candidate discovery stores decoded pairs (Section 7.1), and the decoder stores at most selected pairs (Section 3). The generator seeds have bits (Section 7.4), and the four-wise seeds have polylogarithmic total size (Appendix A). In total, the algorithm uses bits.
Update time. Each update is applied to the coarse sketch and to the three tables at the two endpoints of . Updating the coarse sketch takes time by Theorem 2.6. For the tables, we compute the survival bits of and, at each surviving layer and each endpoint, update selection, diagnostic, and estimation counters. This amounts to counter updates, each of which needs one hash value and one sign. Four-wise values and generator bits take polylogarithmic time to compute (Appendix A and Proposition 2.8), so the worst-case update time is .
Recovery time. Computing takes time by Theorem 2.6, normalizing it takes time (Appendix A.3), and computing the query forest takes time by Lemma 7.2. Recovery from the tables then takes time (Section 7.1). These bounds hold on every run, so the recovery time is in the worst case.
Correctness. The coarse sketch fails with probability at most by Theorem 2.6, and so does the algorithm of Lemma 7.2. If neither fails, then the query cuts are accurate, and they are independent of the three tables in any case (Section 7.2). Fix accurate query cuts, and suppose first that the tapes are fully independent. By Proposition 6.2, outside eight events of probability at most each, pair enumeration returns a positive reweighting of a set of at most edges, and is a -cut sparsifier of . In particular, the load bound and selection success hold outside these events. Proposition 7.1 then shows that, except with probability , candidate discovery returns the same output. Hence a run is successful in the sense of Section 7.4 except with probability . Generating the tapes as in Section 7.4 increases this failure probability by at most , to at most . The total failure probability is therefore at most . Together with the bounds on space, update time, and recovery time, this proves Theorem 1.1.
Acknowledgements
The authors began studying this problem in 2025 and developed an initial solution, in which an issue was later identified. Subsequently, Stellar-Colosseum [LWD⁺26], a fully automated agentic system built on the Gemini 4 base model, proposed a new end-to-end proof for an algorithm with near-optimal space complexity. Following further interaction, the Gemini model also proposed a way to achieve near-linear running time. The authors verified the proof, edited it for clarity of presentation, and take responsibility for the final version. Other models were subsequently used to edit the text. The authors thank Oswaldo Ramirez for helpful discussions during the early stages of this work.
References
[ACK⁺16] Alexandr Andoni, Jiecao Chen, Robert Krauthgamer, Bo Qin, David P. Woodruff, and Qin Zhang. On sketching quadratic forms. In Proceedings of the 2016 ACM Conference on Innovations in Theoretical Computer Science (ITCS), pages 311–319, 2016.
[AGM12] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: Sparsification, spanners, and subgraphs. In Proceedings of the 31st ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pages 5–14, 2012.
[BK96] András A. Benczúr and David R. Karger. Approximating -t minimum cuts in time. In Proceedings of the 28th Annual ACM Symposium on Theory of Computing (STOC), pages 47–55, 1996.
[BK15] András A. Benczúr and David R. Karger. Randomized approximation schemes for cuts and flows in capacitated graphs. SIAM J. Comput., 44(2):290–319, 2015.
[BLM13] Stéphane Boucheron, Gábor Lugosi, and Pascal Massart. Concentration Inequalities: A Nonasymptotic Theory of Independence. Oxford University Press, 2013.
[BSS12] Joshua D. Batson, Daniel A. Spielman, and Nikhil Srivastava. Twice-Ramanujan sparsifiers. SIAM J. Comput., 41(6):1704–1721, 2012.
[CGP+23] Timothy Chu, Yu Gao, Richard Peng, Sushant Sachdeva, Saurabh Sawlani, and Junxing Wang. Graph sparsification, spectral sketches, and faster resistance computation via short cycle decompositions. SIAM J. Comput., 52(6):FOCS18–85–FOCS18–157, 2023.
[CKL22] Yu Chen, Sanjeev Khanna, and Huan Li. On weighted graph sparsification by linear sketching. In 63rd IEEE Annual Symposium on Foundations of Computer Science (FOCS), pages 474–485. IEEE, 2022.
[CKM+14] Michael B. Cohen, Rasmus Kyng, Gary L. Miller, Jakub W. Pachocki, Richard Peng, Anup B. Rao, and Shen Chen Xu. Solving SDD linear systems in nearly time. In Proceedings of the 46th Annual ACM Symposium on Theory of Computing (STOC), pages 343–352. ACM, 2014.
[CKST19] Charles Carlson, Alexandra Kolla, Nikhil Srivastava, and Luca Trevisan. Optimal lower bounds for sketching graph cuts. In Proceedings of the 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2565–2569, 2019.
[CSWZ16] Jiecao Chen, He Sun, David P. Woodruff, and Qin Zhang. Communication-optimal distributed clustering. In Advances in Neural Information Processing Systems 29 (NeurIPS), pages 3720–3728, 2016.
[DV10] Anindya De and Thomas Vidick. Near-optimal extractors against quantum storage. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC), pages 161–170, 2010.
[FHHP19] Wai Shing Fung, Ramesh Hariharan, Nicholas J. A. Harvey, and Debmalya Panigrahi. A general framework for graph sparsification. SIAM J. Comput., 48(4):1196–1223, 2019.
[GH61] Ralph E. Gomory and T. C. Hu. Multi-terminal network flows. Journal of the Society for Industrial and Applied Mathematics, 9(4):551–570, 1961.
[JS18] Arun Jambulapati and Aaron Sidford. Efficient spectral sketches for the Laplacian and its pseudoinverse. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2487–2503, 2018.
[JS25] Arun Jambulapati and Aaron Sidford. Ultrasparse ultrasparsifiers and faster Laplacian system solvers. ACM Trans. Algorithms, 21(3):31:1–31:49, 2025.
[JW21] Rajesh Jayaram and David P. Woodruff. Perfect sampling in a data stream. SIAM J. Comput., 50(2):382–439, 2021.
[Kar00] David R. Karger. Minimum cuts in near-linear time. J. ACM, 47(1):46–76, 2000.
[KLM+17] Michael Kapralov, Yin Tat Lee, Cameron Musco, Christopher Musco, and Aaron Sidford. Single pass spectral sparsification in dynamic streams. SIAM J. Comput., 46(1):456–477, 2017.
[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 multi-commodity generalizations. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 217–226. SIAM, 2014.
[KMM 20] Michael Kapralov, Aida Mousavifar, Cameron Musco, Christopher Musco, Navid Nouri, Aaron Sidford, and Jakab Tardos. Fast and space efficient spectral sparsification in dynamic streams. In Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1814–1833. SIAM, 2020.
[KP12] Michael Kapralov and Rina Panigrahy. Spectral sparsification via random spanners. In Innovations in Theoretical Computer Science (ITCS), pages 393–398, 2012.
[LN97] Rudolf Lidl and Harald Niederreiter. Finite Fields, volume 20 of Encyclopedia of Mathematics and its Applications. Cambridge University Press, second edition, 1997.
[LNPS23] Jason Li, Danupon Nanongkai, Debmalya Panigrahi, and Thatchaphol Saranurak. Near-linear time approximations for cut problems via fair cuts. In Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 240–275, 2023. Full version at arXiv:2203.00751.
[LNSW26a] Honghao Lin, Hoai-An Nguyen, William Swartworth, and David P. Woodruff. Unbiased insights: Optimal streaming algorithms for sampling, the forget model, and beyond. Proc. ACM Manag. Data, 4(2):122:1–122:26, 2026.
[LNSW26b] Yang P. Liu, Hoai-An Nguyen, Vihan Shah, and David P. Woodruff. A nearly optimal min-cut algorithm for dynamic streams. CoRR, abs/2610.34097, 2026.
[LP21] Jason Li and Debmalya Panigrahi. Approximate Gomory–Hu tree is faster than n - 1 max-flows. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 1738–1748, 2021.
[LS17] Yin Tat Lee and He Sun. An SDP-based algorithm for linear-sized spectral sparsification. In Proceedings of the 49th ACM SIGACT Symposium on Theory of Computing (STOC), pages 678–687, 2017.
[LWD 26] Honghao Lin, David P. Woodruff, Yuan Deng, Jieming Mao, Song Zuo, and Vahab Mirrokni. Stellar Colosseum: A many-agent harness for long-horizon research in mathematics and theoretical computer science. CoRR, abs/2609.15983, 2026.
[McG14] Andrew McGregor. Graph stream algorithms: A survey. ACM SIGMOD Record, 43(1):9–20, 2014.
[Nis92] Noam Nisan. Pseudorandom generators for space-bounded computation. Combinatorica, 12(4):449–461, 1992.
[NZ96] Noam Nisan and David Zuckerman. Randomness is linear in space. Journal of Computer and System Sciences, 52(1):43–52, 1996.
[Pen16] Richard Peng. Approximate undirected maximum flows in time. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1862–1867. SIAM, 2016.
[She13] Jonah Sherman. Nearly maximum flows in nearly linear time. In 54th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 263–269. IEEE Computer Society, 2013.
[SS11] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM J. Comput., 40(6):1913–1926, 2011.
[ST04] Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In Proceedings of the 36th Annual ACM Symposium on Theory of Computing (STOC), pages 81–90, 2004.
[ST11] Daniel A. Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM J. Comput., 40(4):981–1025, 2011.
[ST14] Daniel A. Spielman and Shang-Hua Teng. Nearly linear time algorithms for preconditioning and solving symmetric, diagonally dominant linear systems. SIAM J. Matrix Anal. Appl., 35(3):835–885, 2014.
[Tro11] Joel A. Tropp. Freedman’s inequality for matrix martingales. Electronic Communications in Probability, 16:262–270, 2011.
A Implementation details
This appendix gives the implementation details omitted from the main text: the small cases, the bit lengths of all numbers, the normalization of the graphs used for query cuts, and the four-wise independent hash functions and signs.
A.1 Small cases and bit lengths
We first round and down to powers of two. This changes each of them by at most a factor of two and affects only constants.
If or , we store all coordinates exactly in an array indexed by id and output by scanning the array. This uses bits, time per update, and recovery time. For , the space is bits and both times are . For , we have , so the space is bits, the recovery time is , and the output has at most edges.
In the remaining case, , so . Together with , this implies that every parameter has an -bit representation. Moreover, the bounds on space and recovery time are also . The analysis uses only through and , so the implementation may take , which can be computed exactly.
Every coefficient of a three-table sketch lies in , so all counters are integers. Recovery computes medians, squares of difference queries, averages of counters, and rescalings by , and compares these values with thresholds determined by . Every is the weight of a cut in a normalized graph (Section A.3) or, at the first stage of Section 7.3, the integer . All of these numbers are therefore rationals with -bit numerators and denominators, and each operation on them takes time.
A.2 Counter widths
During the stream, each update changes every counter by at most , so every vertex counter of every copy has magnitude at most . In Section 7.3, the vertex counters formed in (37) have magnitude at most . The algorithms of Section 7.4 build the counters coordinate by coordinate, so every partial sum they produce has magnitude at most . Postorder aggregation (Section 7.1) sums at most vertex counters. Hence every counter has magnitude at most , where , and bits per counter suffice.
A.3 Normalizing the graphs used for query cuts
Query cuts are computed from recovered graphs. We normalize these graphs so that the computation is exact and fast, even if the recovery that produced a graph has failed. For an integer bound and a graph , let be obtained from Y by merging parallel entries, replacing each weight by
and discarding entries that become zero. For a graph with entries, this takes time: sort the entries by identifier, merge parallel entries, and round. The clipping to bounds every weight on every run, and the next lemma shows that it has no effect when is a good approximation.
Lemma A.1 (Rounding a cut approximation). Let , and let be a nonnegative graph that approximates every cut of within . Then approximates every cut of within and has the same connected components as . Its weights are positive multiples of and at most .
Proof. Write and , and similarly for and .
Clipping has no effect. For a pair , .
Rounding loses little. Rounding down to a multiple of decreases each weight by less than . A cut is crossed by fewer than pairs, so for every S.
Cut approximation. If , then , so . Otherwise because is integral, and
Components and weights. A set is a union of components of exactly when , which by the previous step happens exactly when . Hence and have the same components. The weights of have the stated form by construction.
We apply this normalization with to the output of Theorem 2.6 (Section 7.2), and Section 7.3 applies it with the weight bound of each copy.
A.4 Four-wise independent hash functions and signs
Let be the smallest integer of the form with . Then . The polynomial is the cyclotomic polynomial , and it is irreducible over because 2 is a primitive root modulo (see, e.g., [LN97]). We represent as , so a field element occupies words and each field operation takes time. We identify each pair with the field element whose binary representation is . A uniformly random polynomial of degree at most three over , evaluated at the pairs, gives values that are four-wise independent and uniform on . Every table width is a power of two at most . For a table of width , fixed bits of the value therefore give a four-wise independent hash into with uniform marginals, and one fixed bit gives four-wise independent unbiased signs. Each function has a seed of bits and takes field operations to evaluate. A copy of the sketch uses hash functions and sign families, dominated by the 64R diagnostic sign families of each layer and row, so its four-wise seeds take bits.