Nearly Maximum Flows in Nearly Linear Time
Jonah Sherman
Introduction
In this paper, we introduce a new approach to this problem in undirected graphs. We maintain a flow that may not quite route exactly, but we also keep track of an upper bound on how much it will cost us in congestion to fix it back up. We will aim to minimize a potential function measuring the current congestion plus an over-estimate on the cost of fixing up the residuals. By not needing to worry about precisely conserving flow at every vertex, we can take large steps in each iteration towards minimizing our potential function. On the other hand, by intentionally over-estimating the cost of fixing up the residuals, in the course of minimizing our potential function we must inevitably fix them up, as it will cost strictly less to do so.
For a graph , let be the diagonal matrix containing the edge capacities, and let be the divergence matrix, where is the excess at vertex . For a set , we’ll write , the total excess in , and , the capacity of the cut in . A valid demand vector satisfies .
The minimum congestion flow problem for demands , and its dual, the maximum congested cut, are
We refer to the optimum value of these problems as . It is well-known that for problem (2), one of the threshold cuts with respect to achieves .
2 Outline
An -congestion-approximator for is a matrix such that for any demand vector ,
Our main result is that we can use good congestion approximators to quickly find near-optimal flows in a graph. We prove the following theorem in section 2.
For the sake of giving the reader a concrete example of what a congestion-approximator might look like before continuing, we’ll begin with two simple toy examples.
Let be a maximum weight spanning tree in , and let be the matrix with a row for each edge in , and
where is the cut in induced by removing from .
Then, is a -congestion-approximator.
Since is the congestion on the cut in induced by removing from , certainly . On the other hand, at least of the capacity of those cuts is contained in , so routing through congests by at most . Multiplication by and can be done in time via elimination on leaves. ∎
For graphs of large conductance, we can obtain a trivial approximator by simply looking at how much the demand into each vertex congests its total degree.
Let have conductance . Let be diagonal matrix with where . Then, is a -congestion-approximator.
Routing into or out of vertex certainly must congest one of its edges by at least , so . On the other hand, the capacity of any cut in is at least times the total degree of the smaller side. It follows that if no vertex is congested by more than , then no cut is congested by more than . ∎
Congestion Potential
The key to our scheme lies transforming problem (1) to an unconstrained optimization problem, using the congestion-approximator to bound the cost of routing the residual. To that end, we introduce our potential function.
Each iteration requires time plus a multiplication by and .
The flow may not quite route the demands we wanted. Fortunately, that will be easy to fix. The extra factor of two in equation (3) means that half of the contribution to the objective value from the residual part is pure slack. On the other hand, if is nearly optimal, there can’t be too much slack.
Suppose . Then, .
Let meet the assumption. Let be a routing of in with . Then, moving from to decreases the objective value by atleast . On the other hand, that decrease can’t exceed . Since , the lemma follows. ∎
So while AlmostRoute may not route , our bound for the congestion to route the residual is at most half of our bound to route the original demands. Furthermore, the objective already pays the cost of routing that residual. In fact, it pays it with a factor of two, so we need only route the remaining residual within a factor-two of optimal. That suggests an obvious way to route demands : repeatedly invoke AlmostRoute on the remaining residual, until the congestion required to route it is extremely small compared to the congestion required to route . Then route the final residual in a naive way, such as via a maximal spanning tree. The cost of that final routing will be paid for by the slack in the objective value of the first routing, simply by finding a factor -optimal routing for each residual after the first case.
Formalizing the latter argument completes our proof of theorem 1.2. Set , and let . Next for where , set and (we don’t actually need any after . Finally, let , and let be a flow routing in a maximal spanning tree of . Output and . Observe that theorem 2.1 yields
Beginning with the former inequality and repeatedly applying the latter yields,
On the other hand, by choice of , we have
We approximate using the symmetric softmax function.
We make use of some elementary facts about .
We will approximate problem (3) with the potential function,
Since equation (7) approximates equation (3) to within an additive , we will be concerned with minimizing after scaling so .
: • Initialize , scale so . • Repeat: – While , scale and up by . – Set . – If , set – Otherwise, terminate and output together with the potentials induced by (see below), after undoing any scaling.
Each step requires computing , which requires time plus a multiplication by and a multiplication by . Further, the partial derivative of the residual part for a particular edge is equal to a potential difference between the endpoints of that edge. When is nearly-optimal, those potentials yield a good dual solution for our original problem.
When terminates, we have a flow and potentials with,
Set , , and . Set to be our potentials. Observe that . First, equation (4) yields
By equation (5), using the fact that and have at most rows and ,
Altogether, using the fact that at termination, we have
Observing that overestimates completes the proof. ∎
Let us call the iterations between each scaling a phase. Since gives us the correct scale to within factor , we will scale at most times.
Let be our step. Then, equation (6), together with the fact that for a congestion-approximator yields,
Since we raised by at most when scaling, and each step drops by at least , there can be at most steps between phases. ∎
Computing Congestion-Approximators
In this section we prove theorem 1.5, using a construction of Madry, itself based on a construction of Spielman and Teng.
A -tree is a graph formed by the union of a forest with components, together with a graph on vertices, one from each component. The graph is called the core.
Each is a -tree, with a core containing at most edges.
We briefly remark that while the statement of theorem 3.2 in contains an additional logarithmic dependence on the capacity-ratio of , that dependence is easily eliminated. We elaborate further in appendix A. Our construction will simply apply theorem 3.2 recursively, sparsifying the core on each iteration. To accomplish that, we use an algorithm of Benczúr and Karger.
Further, the edges of are scaled versions of a subset of edges in , with no edge scaled by more than .
We now present the algorithm for computing the data structure representing a congestion-approximator. The algorithm assumes its input is sparse; our top-level data-structure is constructed by invoking , where is the parameter of theorem 1.5.
: • If , return. • Using theorem 3.2, compute distribution of -trees. • Pick the graphs of largest , throw away the rest, and scale the kept to sum to . • For : – , where is the core of – • Return the list where is the forest of .
The analysis of correctness will make use of another algorithm for sampling trees. The procedure is only used for analysis, and is not part of our flow algorithm.
: • Pick with probability . • Output
By induction on . For the claim is vacuous, so suppose . Since has edges, the distribution output by theorem 3.2 will have entries. We have and . Furthermore, the inductive hypothesis implies that every tree in dominates . Then,
Sparsifying the distribution from to scales by at most , so that is routable in with congestion at most larger than the original distribution. Since , by the multicommodity max-flow/min-cut theorem is routable in with congestion . By the inductive hypothesis, is routable in with congestion . It follows then that is routable in with congestion at most .
Since the capacity of each tree-edge dominates the capacity of the corresponding cut in , . On the other hand, can be routed in every tree with congestion . By routing a fraction of the flow through tree , we route in with congestion . But then can be routed in while congesting by at most an factor larger.
The total number of edges in satisfies the recurrence as each edge is either in one of the toplevel forests, or in one of the subgraphs. ∎
Having constructed our representation of , it remains only to show how to multiply by and . We use the following lemmas as subroutines, which are simple applications of leaf-elimination on trees.
There is an algorithm that, given a tree and a demand vector , takes time and outputs for each tree edge, the flow along that edge when routing in .
There is an algorithm that, given a tree annotated with a price for each edge, takes time and outputs a vector of vertex potentials such that, for any , the sum of the prices on the path from to in is .
We begin with computing . We take as input the demand vector , and then annotate each forest edge with the congestion induced by routing through a tree containing .
: • For : – Let be the tree formed by taking , adding a new vertex , and an edge from to each core-vertex of . Augment with demand zero to the new vertex. – . – Set for each forest edge in . – Set to a vector indexed by core-vertices, with equal to the flow on the edge from to core-vertex . – .
Let . We argue by induction on the depth of recursion. Fix a level and index . Observe that the cut in induced by cutting a forest edge is the same regardless of what tree lies on the core: it is the cut that separates the part of not containing the core from the rest of the vertices. It follows that we may place any tree on the core vertices, invoke , and obtain the flow on each forest edge. Next, for each component of , the total excess must enter via the core vertex. It follows that in a flow routing on , for any tree , the restriction of that flow to must have excess on the core vertex of , so it suffices to find a flow in the core with demands . But routing in will place exactly units of flow on the edge from to core-vertex .
To compute , we assume each forest edge has been annotated with a price that must be paid by any flow per unit of congestion on that edge, and output potentials such that is the total price to be paid for routing a unit of flow from to .
: • • For : – . – Let be the tree formed by taking , adding a vertex , and an edge from to each core-vertex of . Set for each forest edge, and for edge from to core-vertex . – – Add to after removing the entry for . • Return
Given edges annotated with per-congestion prices, the procedure correctly returns potentials such that is the cost per unit of flow from vertex to .
Let . We argue by induction on the depth of recursion. Fix a level; a flow must pay its toll to each , so the resulting potential equals the sum of the potentials for each . Fix an index . A unit of flow from to is first routed from to the core-vertex of the component of containing , then to the core-vertex of the component containing , and then finally to . By induction, we assume that yields potentials that give the per-unit costs of routing between core-vertices. Placing a star on the core with the edge from to core-vertex having per-unit cost preserves those costs. If is the price of an edge per unit of congestion, then is the price of an edge per unit of flow. It follows that the total toll paid is the same as the toll paid in ; thus, the potentials output by are correct.
Final Remarks
We remark that there are many other ways to obtain good congestion approximators. The oblivious routing schemes of require polynomial time to compute, but, once computed, give us a single tree whose single-edge cuts yield a -congestion approximator. Furthermore, we only need the actual tree, and not the routings of the tree back in the original graph. If such a single tree could be computed in nearly-linear time, it would make an ideal candidate for use in our algorithm.
There have been substantial simplifications to Spielman and Teng’s original algorithm (see ). It may be possible to use some of those techniques to further simplify our algorithm.
References
Appendix A Fixing Theorem 3.2
The proof of theorem 3.2 maintains a length function for each edge, and repeatedly invokes an algorithm that returns a spanning tree on with,
where is the length of the path between ’s endpoints in the tree. Without loss of generality, by scaling, we assume . Let if is a tree edge that lies on the path in containing . Then,
where is the total capacity of edges routed through in .