arXiv:2608.26037cs.DSAug 2026

Manuscript Offprint

arXiv:2608.26037

Partially-Dynamic All-Pairs Maxflow and Effective Resistance via Stable Sparsifiers

Gramoz Goranci, Rasmus Kyng, Maximilian Probst Gutenberg, Yibin Zhao, Gernot Zöcklein

Gramoz Goranci

University of Vienna

gramoz.goranci@univie.ac.at

Rasmus Kyng*

ETH Zurich

kyng@inf.ethz.ch

Maximilian Probst Gutenberg*

ETH Zurich

maximilian.probst@inf.ethz.ch

Yibin Zhao

University of Toronto

ybzhao@cs.toronto.edu

Gernot Zöcklein*

ETH Zurich

gernot.zoecklein@inf.ethz.ch

Abstract

We give a randomized data structure for undirected weighted graphs that are partially dynamic, i.e., that undergo either only edge insertions or only edge deletions. The data structure maintains (1±ε)(1 \pm \varepsilon)-approximations to the maxflow value and effective resistance between any queried pair of vertices, with total update time O~ε(n2)\widetilde{O}_{\varepsilon}(n^2) and worst-case query time O~ε(1)\widetilde{O}_{\varepsilon}(1).1^1 Thus, for dense graphs where m=Ω(n2)m = \Omega(n^2), our guarantees are near-optimal. Our algorithms succeed with high probability against an adaptive adversary.

Our result follows from a simple stability principle for partially dynamic graphs. We show how to partition an online sequence of mm updates into O~(n/ε)\tilde{O}(n/\varepsilon) epochs such that every graph within an epoch is a (1±O(ε))(1 \pm O(\varepsilon))-spectral approximation of the graph at the beginning of the epoch. The epochs are determined by the cumulative leverage score of the updated edges: small leverage-score mass implies small spectral change, while the total leverage-score mass over a monotone update sequence is O~(n)\tilde{O}(n). Consequently, a spectral sparsifier needs to be recomputed only once per epoch. Applying known static all-pairs maxflow and effective-resistance oracles to these sparsifiers then yields the result.

*The research leading to these results has received funding from the starting grant “A New Paradigm for Flow and Cut Algorithms” (no. TMSGI2 218022) and grant no. 200021 204787 of the Swiss National Science Foundation.

1^{1}We use O~(⋅)\tilde{O}(\cdot) notation to hide polylogarithmic factors in nn and O~ε(⋅)\tilde{O}_{\varepsilon}(\cdot) notation to additionally suppress polynomial factors in ε−1\varepsilon^{-1}. We let mm denote the maximum number of edges in the dynamic input graph at any time, and nn the number of vertices, and assume m=O~(n2)m = \tilde{O}(n^2) polynomially-bounded weights throughout.

1 Introduction

Maximum flow and effective resistance are two fundamental measures of connectivity in a graph. The st-maxflow value measures how much flow the network can route between two vertices s and t, whereas the st-effective resistance measures how well the network conducts between them.

Static algorithms and all-pairs oracles. In static graphs, both quantities are by now well understood. Exact st-maxflow can be computed in almost-linear m1+o(1)m^{1+o(1)} time [CKL+22; VCK+23], while a (1±ε)(1\pm\varepsilon)-approximation requires O~ε(m)\widetilde{O}_{\varepsilon}(m) time [Pen16; FLL26]. Similarly, a (1±ε)(1\pm\varepsilon)-approximation to st-effective resistance can be computed in near-linear time [ST14; CKM+14; KS16].

Recent work has also studied all-pairs oracles: data structures that, after preprocessing, answer a query for any pair s,t∈Vs, t \in V in O~ε(1)\widetilde{O}_{\varepsilon}(1) time. Such an implicit representation is necessary because explicitly reporting all pairwise values takes Ω(n2)\Omega(n^2) time. For maxflow, exact oracles with m1+o(1)m^{1+o(1)} preprocessing time and O~(1)\widetilde{O}(1) query time are known [ALPS23; AKL+25], as are (1±ε)(1 \pm \varepsilon)-approximate oracles with O~ε(m)\widetilde{O}_{\varepsilon}(m) preprocessing time [LP21; LNPS23]. For effective resistance, Spielman and Srivastava [SS11] gave an elegant reduction to O~ε(1)\widetilde{O}_{\varepsilon}(1) Laplacian solves, yielding O~ε(m)\widetilde{O}_{\varepsilon}(m) preprocessing and O~ε(1)\widetilde{O}_{\varepsilon}(1) query time. Thus, in the static setting, both all-pairs problems admit essentially optimal preprocessing and query times.

Dynamic algorithms. This raises the corresponding question for dynamic graphs:

Can all-pairs maxflow and effective resistance oracles be efficiently maintained in graphs undergoing updates?

However, the corresponding dynamic problem is conditionally much harder when exact answers are required. Assuming the OMv conjecture, Dahlgaard [Dah16] showed that exact st-maxflow in weighted undirected graphs cannot be maintained with O(n1−δ)O(n^{1-\delta}) amortized time per operation, for any constant δ>0\delta > 0. This lower bound holds even for a fixed pair s,ts, t and even when the graph is only partially-dynamic, i.e. only undergoes edge insertions or deletions. One notable positive result is the algorithm of [GH23] for exact st-maxflow in unweighted graphs undergoing edge insertions, which obtains O~(n5/2)\widetilde{O}(n^{5/2}) total update time. Beyond this restricted setting, we are not aware of an exact dynamic algorithm that improves on solving the flow problem from scratch after every update.

It is therefore natural to allow for (1±ε)(1 \pm \varepsilon)-approximations to circumvent these strong lower bounds and to work with undirected graphs. A baseline solution follows from the implicit dynamic sparsifier in [BBP+22] which yields O~ε(n)\widetilde{O}_{\varepsilon}(n) amortized update time. This is achieved by implicitly sampling a (1±ε)(1 \pm \varepsilon)-sparsifier consisting of O~ε(n)\widetilde{O}_{\varepsilon}(n) edges in O~ε(n)\widetilde{O}_{\varepsilon}(n) time and then running the above-mentioned static algorithms on the sparsifier. This yields algorithms to maintain oracles for both (1±ε)(1 \pm \varepsilon)-approximate all-pairs maxflow and all-pairs effective resistances.

In the most general, fully-dynamic setting, [CGHPS20; GRST21; VCK+24] culminated in a deterministic 2^2 mo(1)m^{o(1)}-approximate all-pairs maxflow with m1+o(1)m^{1+o(1)} total update and mo(1)m^{o(1)} query time. [CGHPS20] further gives an algorithm to maintain (1±ε)(1 \pm \varepsilon)-approximate all-pairs effective resistances with O~ε(mn2/3)\widetilde{O}_{\varepsilon}(mn^{2/3}) total update time, breaking the above-stated O~ε(mn)\widetilde{O}_{\varepsilon}(mn) barrier, however, at the cost of a high query time of O~ε(n2/3)\widetilde{O}_{\varepsilon}(n^{2/3}). It also works only against an oblivious adversary. Thus, current fully dynamic algorithms improve on the baseline only by allowing for either a substantially weaker approximation or a substantially larger query time.

For the partially-dynamic setting, no improvement beyond these fully-dynamic algorithms is known for (1±ε)(1 \pm \varepsilon)-approximate all-pairs maxflow or effective resistances. Significant progress has

2^{2}Note that deterministic algorithms always work against an adaptive adversary.

instead been made for maxflow between a fixed pair s,ts,t. These works obtain total update time O~ε(m1+o(1))\widetilde{O}_{\varepsilon}(m^{1+o(1)}) [BCK+24; CKLMP24; VCK+24] or O~ε(n2)\widetilde{O}_{\varepsilon}(n^{2}) [GH23; GHRS25; KP26]. Both approaches work against an adaptive adversary; the former is even deterministic. Both heavily exploit the monotonicity of partially dynamic graphs: connectivity can only improve under insertions and only deteriorate under deletions.

Our contribution. In this paper, we break the update time baseline of O~ε(n)\widetilde{O}_{\varepsilon}(n). We give a simple algorithm that maintains (1±ε)(1 \pm \varepsilon)-approximations to both all-pairs maxflow values and all-pairs effective resistances in O~ε(n2)\widetilde{O}_{\varepsilon}(n^2) total update time.

Theorem 1.1. Let G=(V,E,w)G = (V, E, w) be an n-vertex undirected graph with polynomially-bounded positive edge weights undergoing either only edge insertions or only edge deletions, and let ε∈(0,1)\varepsilon \in (0,1). There is a randomized data structure that can be queried at any time, for any pair s,t∈Vs, t \in V, to return

• a(1±ε)a(1 \pm \varepsilon)-approximation to the st-maxflow value, and

• a(1±ε)a(1 \pm \varepsilon)-approximation to the st-effective resistance.

Each query takes worst-case time O~(1/ε2)\widetilde{O}(1/\varepsilon^2), and the total update time is O~(n2/ε7)\widetilde{O}(n^2/\varepsilon^7). The guarantees hold with high probability against an adaptive adversary.

Our result matches the O~ε(n2)\widetilde{O}\varepsilon(n^2) total update time of the fixed-pair algorithms [GH23; GHRS25; KP26] while supporting queries for arbitrary pairs. It is near-optimal for dense monotone update sequences with m=Θ(n2)m = \Theta(n^2) and improves on the O~ε(mn)\widetilde{O}\varepsilon(mn) baseline whenever m=ω(n)m = \omega(n). Compared with the previous fully dynamic all-pairs results, we obtain a (1±ε)(1 \pm \varepsilon) rather than a subpolynomial approximation for maxflow, while retaining fast query time. For effective resistance, we additionally obtain guarantees against an adaptive adversary.

We note that the dependence on ε−1\varepsilon^{-1} in is larger than in the corresponding fixed-pair results. We believe that improving this dependence poses an interesting open problem.

Our approach. In this article, we isolate a particularly simple consequence of monotonicity. We show that the online update sequence can be partitioned into O~(n/ε)\widetilde{O}(n/\varepsilon) epochs. Within an epoch, graphs spectrally approximate each other closely, and so a sparsifier of the first graph in the epoch approximates all remaining graph version reasonably well. Thus, we can reduce the number of times that we sample a new sparsifier to O~(n/ε)\widetilde{O}(n/\varepsilon) and thus only requires O~(n/ε)\widetilde{O}(n/\varepsilon) many static all-pairs oracles rebuilds on such sparsifiers which then yields as corollary.

To partition epochs, we use a simple, elegant approach: we measure leverage scores of edges that are updated, and as long as edges touched by updates within the epochs have small combined leverage score mass, we know that graphs still spectrally approximate each other closely. On the other hand, since the total leverage score mass over all updates is bounded by O(nlog⁡n)O(n \log n), we can show that we only need to start a new epoch O~ε(n)\widetilde{O}_{\varepsilon}(n) times.

References (28)