Faster Algorithm for Maximum Flow in Directed Planar Graphs with Vertex Capacities
aa r X i v : . [ c s . D S ] J a n A Note on Maximum Integer Flows in Directed PlanarGraphs with Vertex Capacities
Dor Mesica and Shay Mozes Efi Arazi School of Computer Science, The Interdisciplinary Center Herzliya,Israel ∗ Abstract
The most efficient algorithm currently known for computing maximum integer flowsin planar graphs with vertex capacities and multiple sources and sinks [Wang, SODA2019] runs in O ( k n polylog( nU )) where k is the number of sources and sinks, and U is the largest capacity of a single vertex. In this work we give a faster implementationfor a procedure used by Wang’s algorithm, improving the overall running time of hisalgorithm to O ( k n polylog( nU )). Finding a maximum flow is one of the most fundamental optimization problems. Theproblem has been extensively studied in many different settings and variants. This noteaddresses the problem of computing a maximum flow in a directed planar network withinteger arc and vertex capacities. This variant has been studied in several works since the1990s [3, 6, 2, 1, 5]. For a survey of the history of this problem and other relevant resultssee [5] and references therein.Vertex capacities pose a challenge in planar graphs because the standard reduction froma flow network with vertex capacities to a flow network with only edge capacities does notpreserve planarity. Significant progress on this problem was recently made by Wang inSODA 2019 [5]. Wang gave the first algorithms that exploit planarity when there are morethan a single source and a single sink. In particular, Wang gave an algorithm that runsin O ( k n polylog( nU )) where k is the number of sources and sinks, and U is the largestcapacity of a single vertex. In this work we give a faster implementation for a procedureused by Wang’s algorithm, improving the overall running time of the algorithm by a factorof k to O ( k n polylog( nU )). ∗ This work was partially supported by Israel Science Foundation grant No. 592/17.
1n this paper we aim to concisely describe this improvement. Thus we avoid repeatingmuch of the background, preliminaries and details that are not directly required to un-derstand our result. In Section 2 we provide the necessary notations and review Wang’salgorithm. Section 3 describes our improvement.
We follow the notations of [5]. Let G be a directed planar graph with vertex set V ( G )and arc set E ( G ), where | V ( G ) | = n . We use the term arc to emphasize that edges aredirected and the term edge when the direction is not important. For any vertex v ∈ V ( G )let deg( v ) denote the degree of v in G .A flow network is a directed graph G with a capacity function c : V ( G ) ∪ E ( G ) → [0 , ∞ )on the vertices and arcs of G , along with two disjoint sets S, T ⊂ V ( G ) called sources and sinks , respectively. The vertices in S and T are called terminals and their number isdenoted by k . We assume without loss of generality that terminals have infinite capacity.For any arc e = ( u, v ) ∈ E ( G ) we add to E ( G ) the reverse arc ( v, u ), denoted rev( e ). Thereverse arc rev( e ) is embedded together with e , and has capacity c (rev( e )) = 0.Let f : E ( G ) → [0 , ∞ ). For ease of notation, for any arc ( u, v ) ∈ E ( G ) we write f ( u, v )instead on f (( u, v )). For each vertex v let f in ( v ) = X ( u,v ) ∈ E ( G ) f ( u, v )and f out ( v ) = X ( v,u ) ∈ E ( G ) f ( v, u )The function f is called a f low if it satisfies the following conservation constraint : forall v ∈ V ( G ) \ ( S ∪ T ), f in ( v ) = f out ( v ). A flow is feasible on an arc e ∈ E ( G ) if f ( e ) ≤ c ( e ).A flow is said to be feasible if in addition to the conservation constraint, it is feasible onall arcs and for every vertex v ∈ V ( G ) \ ( S ∪ T ), f in ( v ) ≤ c ( v ). A non-feasible flow has excess on vertices or arcs. The excess on an arc e , denoted by ex( f, e ), is defined asex( f, e ) = max { , f ( e ) − c ( e ) } , and the excess ex ( f, v ) on a vertex v is defined asex( f, v ) = max { , f in ( v ) − c ( v ) } The excess of the flow f is defined to be ex( f ) = max v ∈ V ( G ) ex( f, v ).A flow is acyclic if there is no cycle C such that f ( e ) > e ∈ C .A flow saturates an arc e if f ( e ) = c ( e ). The value of a flow f is defined as | f | = P s ∈ S f out ( s ) − f in ( s ). A flow whose value is 0 is called a circulation .2he sum of two flows f and g is defined as follows. For every arc e ∈ E ( G ), ( f + g )( e ) =max { , f ( e ) + g ( e ) − f (rev( e )) − g (rev( e )) } . Multiplying the flow f by some constant c toget the flow cf is defined as ( cf )( e ) = c · f ( e ) for all e ∈ E ( G ).The residual capacity of an arc e with respect to f , denoted by c f ( e ), is c ( e ) − f ( e ) + f (rev( e )). The residual graph of a flow network G with respect to f is the graph G wherethe capacity of every arc e ∈ E ( G ) is set to c f ( e ). It is denoted by G f .The following two auxiliary graphs are used by Wang’s algorithm. In both these graphsonly the edges are capacitated. Definition 1 (The graph G ◦ ) . For a flow network G , the network G ◦ is obtained by thefollowing procedure. For each vertex v ∈ V ( G ) , replace v with an undirected cycle C v with d = deg( v ) vertices v , ..., v d . Each edge in C v has capacity c ( x ) / . Connect each arcincident to v with a different vertex v i , preserving the clockwise order of the arcs so thatthe graph remains planar. Definition 2 (The graph G × ) . Let f be a flow in G . Let X be the set of infeasible vertices.I.e., vertices x ∈ V ( G ) s.t. f in ( x ) > c ( x ) . The graph G × is defined as follows. Startingwith G ◦ , for each vertex x ∈ X , replace the cycle representing x with two vertices x in , x out and an arc ( x in , x out ) of capacity c ( x ) .Every arc of capacity c going from a vertex u / ∈ C x to a vertex in C x becomes an arc ( u, x in ) of capacity c . Similarly, every arc of capacity c going from a vertex of C x to avertex u / ∈ C x becomes an arc ( x out , u ) with capacity c . Note that even though G is planar, G × is not. An apex set in a graph is a set of verticeswhose removal makes the graph planar. Thus, { x in : x ∈ X } ∪ { x out : x ∈ X } is an apexset in G × .Suppose G and H are flow networks such that every arc in G is also an arc in H . If f ′ is a flow in H then the restriction of f ′ to G is the flow f in G defined by f ( e ) = f ′ ( e ) forall e ∈ E ( G ). Thus we can speak of the restriction of a flow f ◦ in G ◦ , to a flow f in G ,and of the restriction of a flow f × in G × to a flow f in G . The fastest algorithm currently known for computing maximum integer flows in planargraphs with vertex capacities and multiple sources and sinks was introduced by Yipu Wangin SODA 2019 [5]. It runs in O ( k n polylog( nU )) time, where U is the largest capacity ofa single vertex. Here we sketch Wang’s algorithm. We only go into details in the parts ofthe algorithm that will be modified in our algorithm in the next Section.Let λ ∗ be the value of the maximum flow in G . Wang’s algorithm uses binary searchto find λ ∗ . Let λ be the current candidate value for λ ∗ . The algorithm computes a flow f ◦ with value λ in the planar graph G ◦ . Let f be the restriction of f ◦ to G . Wang proves that f has at most k − f is at most ( k − U . As long as the excess of f is larger than 2 k the algorithmimproves f . This improvement phase, which will be described shortly, is the crux of thealgorithm. If ex( f ) ≤ k , then O ( k ) iterations of the classical Ford-Fulkerson algorithmsuffice to get rid of all the remaining excess.The improvement phase of the algorithm is based on finding a circulation g that cancelsthe excess on the infeasible vertices and does not add too much excess on other vertices. Itcan then be shown that adding 1 /k · g to the flow f decreases the total excess of the flow(ex( f )) by a factor of roughly 1 − /k . After O ( k log kU ) iterations of the improvementstep, the excess is at most 2 k .Wang proves that in order to find the circulation g , it suffices to compute a circulation g × in the graph G × that satisfies the following properties:1. f × + g × is feasible in G × .2. The restriction of f × + g × to G has no excess on vertices of X .3. The restriction of f × + g × to G has at most ( k − · ex( f ) excess on vertices in V ( G ) /X .The desired circulation g is the restriction of g × to G . If no such g × exists then g doesnot exist, which implies that λ > λ ∗ , and the algorithm continues the binary search for λ ∗ with a different value of λ .Wang essentially shows that any algorithm for finding g × in O ( T ) time, where T =Ω( n ), yields an algorithm for maximum flow with vertex capacities in O ( kT polylog( nU ))time. The additional terms stem from the O ( k log( kU )) iterations of the improvementstep, and the log( nU ) steps of the binary search. Wang shows how to compute g × in O ( k n log n ) time, by eliminating the excess of each vertex of X one after the other insome auxiliary graph obtained from G × . Thus, the overall running time of his algorithmis O ( k n polylog( nU )). We propose a faster way of computing the circulation g × by eliminating the excess on allthe vertices of X in a single shot. Doing so correctly requires some care in defining theappropriate capacities in the auxiliary graph, since we only know that for each x ∈ X , g × should eliminate at least ex( f, x ) units of flow from x , but the actual amount of floweliminated from x may have to be larger. This issue does not come up when resolving theexcess one vertex at a time as was done by Wang. Lemma 1.
There exists an algorithm that finds a circulation g × such that1. f × + g × is feasible in G × . . The restriction of f × + g × to G has no excess on vertices of X .3. The restriction of f × + g × to G has at most ( k − · ex( f ) excess on vertices in V ( G ) /X .in O ( k n log ( n )) time if such a circulation exists.Proof. The circulation can be found using the following algorithm. Define an auxiliarygraph H as follows. Starting with G × f × , the residual graph of G × with respect to f × , • For each x ∈ X , set the capacity of the arc ( x in , x out ) to be 0 and the capacity of( x out , x in ) to be c ( x ). • Add a super source s and arcs ( s, x in ) with capacity ex( f, x ) for every x ∈ X . • Add a super sink t and arcs ( x out , t ) with capacity ex( f, x ) for every x ∈ X .Note that S x ∈ X { x in , x out } ∪ { s, t } is an apex set of size O ( k ) in H .Find a maximum flow h ′ in H using the algorithm of Borradaile et al. [1, Corollary5.1]. Convert h ′ to an acyclic flow h of the same value using the algorithm of Sleatorand Tarjan [4] (cf. [5, Lemma 2.5]). If h does not saturate every arc incident to s and t ,return that the desired circulation g does not exist. Otherwise, h can be extended to thedesired circulation g × by setting g × ( x out , x in ) = h ( x out , x in ) + ex( f, x ) for every x ∈ X and g × ( e ) = h ( e ) for all other arcs. Time Analysis.
Computing the graph H can be done in O ( n ) time. The graph H is ofsize O ( n ) vertices and has an apex set of size O ( k ). Thus, computing the flow h ′ using thealgorithm of Borradaile et al. [1, Corollary 5.1] takes O ( k n log ( n )) time. Transforming h ′ to an acyclic flow h using the algorithm of Sleator and Tarjan [4] takes O ( n log n ) time.Finally, computing g × from h takes O ( n ) time. The total of time to compute g × is thus O ( k n log ( n )). Correctness.
In order to prove the correctness of our algorithm, we will prove that thereexist a feasible flow h in H that saturates every arc incident to s and t if and only if thereexists a circulation g × in G × that satisfies conditions (1) and (2) in the statement of thelemma.( ⇐ ) Assume the circulation g × exists in G × . Define a flow h in H as follows. Forevery arc e ∈ E ( H ) not of the form ( x out , x in ) set h ( e ) = g × ( e ). For every x ∈ X , set h ( x out , x in ) = g × ( x out , x in ) − ex( f, x ), h ( s, x in ) = ex( f, x ) and h ( x out , t ) = ex( f, x ). Sincethe restriction of f × + g × to G has no excess on the vertices of x , g × ( x out , x in ) ≥ ex( f, x ),so h ( x out , x in ) ≥ h is a well defined flow. By definition, the flow h saturates everyarc incident to s and t . 5o show that h is feasible in H it is enough to show that h ( x out , x in ) ≤ c ( x ) for every x ∈ X (on all other arcs h is feasible because g × is feasible in G × f × ). Let x ∈ X . Since f × + g × is feasible in G × , g × ( x out , x in ) ≤ f × ( x in , x out ). Since h ( x out , x in ) = g × ( x out , x in ) − ex( f, x ), h ( x out , x in ) ≤ f × ( x in , x out ) − ex( f, c ) = c ( x ).( ⇒ ) Assume there exist a feasible flow h in H that saturates every arc incident to s and t , and let g × be the circulation obtained from h as described above. We show that f × + g × is feasible in G × . On all arcs e not of the form ( x out , x in ), g × ( e ) = h ( e ) and thecapacity of e in G × f × equals the capacity of e in H . Therefore, since h is a feasible flow in H , g × is feasible on e in G × f × , so f × + g × is feasible on e in G × . We now focus on thearcs ( x out , x in ) for each x ∈ X . Let e = ( x out , x in ). Observe that 0 ≤ h ( e ) ≤ c ( x ). Since g × ( e ) = h ( e ) + ex( f, x ) we have that ex( f, x ) ≤ g × ( e ) ≤ c ( x ) + ex( f, x ) = f × ( e ). Since( f × + g × )( x in , x out ) = f × ( x in , x out ) − g × ( x out , x in ), we have 0 ≤ ( f × + g × )( x in , x out ) ≤ c ( x ),so f × + g × is feasible in G × .We next show that the restriction of f × + g × to G has no excess on the vertices of X .By definition of G × and of residual graph, the only arcs in G × f × that can carry flow outof x in are the reverses of the arcs that carry flow into x in f , and the only arcs that cancarry flow into x out are the reverses of the arcs that carry flow out of x in f . We will showthat ( f + g ) in ( x ) ≤ c ( x ) by considering separately the contribution of the flow on arcs of G that in G × are incident to x out , and arcs of G that in G × are incident to x in .The only arc of f × that carries flow into x out is ( x in , x out ). Thus, there is no arc e of G such that f × ( e ) carries flow into x out . Since g × only carries flow into x out along the reversesof arcs that carry flow out of x out in f × and since for every such arc e ′ , g × ( e ′ ) ≤ f × (rev( e ′ )),there is also no arc e of G such that ( f × + g × )( e ) carries flow into x out .The total flow that f × carries into x in is c ( x ) + ex( f, x ). Let z denote the total amountof flow that g × carries into x in . Since the only arc incident to x in that carries flow in g × and does not belong to G is ( x out , x in ), the total amount of flow that g × carries into x in on arcs that belong to G is z − g × ( x out , x in ). On the other hand, g × carries z units of flowout of x in , and all of this flow is pushed along the reverses of arcs that carry flow into x in in f × (and also belong to G ). Hence, the total amount of flow that f × + g × carries into x in on arcs that belong to G is c ( x ) + ex( f, x ) + ( z − g × ( x out , x in )) − z . Therefore,( f + g ) in ( x ) = c ( x ) + ex( f, x ) − g × ( x out , x in ))= c ( x ) + ex( f, x ) − ( h ( x out , x in ) + ex( f, x ))= c ( x ) − h ( x out , x in ) ≤ c ( x ) . We have thus shown that the algorithm computes a flow g × satisfying conditions (1)and (2) in the statement of the lemma. To show that condition (3) is also satisfied,note that the value of the flow h is P x ∈ X ex( f, x ) ≤ ( k − · ex( f ). Since h is acyclic, h in ( v ) ≤ ( k − · ex( f ) for all v ∈ H . Since for all v ∈ V ( G ) /X , f in ( v ) ≤ c ( v ), and h in ( v ) = ( g × ) in ( v ), it follows that the excess of f × + g × on v is at most ( k − · ex( f ).6sing the O ( k log n )-time algorithm of Lemma 1 in the improvement phase of Wang’salgorithm instead of using Wang’s O ( k log n )-time procedure for this phase results in thefollowing theorem Theorem 1.
A maximum flow in an n -vertex planar flow network G with integer arc andvertex capacities bounded by U can be computed in O ( k n polylog( nU )) time. References [1] Glencora Borradaile, Philip N. Klein, Shay Mozes, Yahav Nussbaum, and ChristianWulff-Nilsen. Multiple-source multiple-sink maximum flow in directed planar graphs innear-linear time.
SIAM J. Comput. , 46(4):1280–1303, 2017.[2] Haim Kaplan and Yahav Nussbaum. Maximum flow in directed planar graphs withvertex capacities.
Algorithmica , 61(1):174–189, 2011.[3] Samir Khuller and Joseph Naor. Flow in planar graphs with vertex capacities.
Algo-rithmica , 11(3):200–225, 1994.[4] Daniel Dominic Sleator and Robert Endre Tarjan. A data structure for dynamic trees.
J. Comput. Syst. Sci. , 26(3):362–391, 1983.[5] Yipu Wang. Maximum integer flows in directed planar graphs with vertex capacitiesand multiple sources and sinks. In Timothy M. Chan, editor,
Proceedings of the Thir-tieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego,California, USA, January 6-9, 2019 , pages 554–568. SIAM, 2019.[6] Xianchao Zhang, Weifa Liang, and Guoliang Chen. Computing maximum flows in undi-rected planar networks with both edge and vertex capacities. In Xiaodong Hu and JieWang, editors,
Computing and Combinatorics, 14th Annual International Conference,COCOON 2008, Dalian, China, June 27-29, 2008, Proceedings , volume 5092 of