Chater 7 Flow Problem 7. Introduction and definition Problem related to tranort have been invetigated ince the early fiftie. The roblem i to route ome good, called commoditie, from roduction ite to conumtion ite, through a network coniting of communication link inter-connecting the ite (ie-line, route, telecommunication network). Moreover, each link ha a maximum admiible throughut, called the caacity of the link. In general, mot of the ite of the network do not roduce nor conume anything, they are only ued to interconnect link. To each roduction or conumtion ite i aociated ome real number that correond to the maximum roduction or conumtion. The main objective i to maximize the throughut of the traffic. We firt conider network with directed link, i.e., that can be ued in one direction. Formally, a flow network i defined a follow. Definition 7. (Flow network). A flow network i a four-tule (G, r max,co max,c) uch that: G i a digrah (or a mulitdigrah), the vertice of which rereent the ite and the arc rereent the link; r max i a function from V (G) to IR + + ; r max (v) correond to the maximum roduction oible in v. If v i not a roduction ite, then r max (v)=0. co max i a function from V (G) to IR + + ; co max (v) correond to the maximum conumtion oible in v. If v i not a conumtion ite, then co max (v)=0. c i a function from E(G) to IR + + ; c(e) correond to the caacity of the link e. Definition 7. (Flow). The flow i a trile F =(r,co, f ) where - r i a function of roduction uch that, for any vertex v, 0 r(v) r max (v); 9
9 CHAPTER 7. FLOW PROBLEMS - co i a function of conumtion uch that, for any vertex v, 0 co(v) co max (v); - f i a function over E, called flow function that atifie the following contraint: Poitivity: e E(G), f (e) 0 Caacity contraint: e E(G), f (e) c(e) Flow conervation: v V (G), (u,v) E(G) f ((u,v)) + r(v)= By umming, the V (G) equation of flow conervation, we get: r(v)= co(v) v V (G) v V (G) (v,u) E(G) f ((v,u)) + co(v) In other word, the um of all roduced commoditie equal the um of all conumed commoditie. Thi value correond to the amount of routed traffic, it i the flow value, denoted by v(f). r max = r = r max = 5 4 0 r = co 0 max = co = 0 0 r max = r = co max = co = Figure 7.: Examle of flow network (left) and a flow of value 4 in it (right) Hence, the roblem i the following: Problem 7. (Maximum Flow). Intance: a flow network N. Find: a flow with maximum value. A flow with maximum value i aid to be a maximum flow. 7. Reducing to an elementary network Before tudying thi roblem, we how that it i equivalent to conider an elementary roblem where there i a unique roduction ite with infinite maximum roduction and a unique conumtion ite with infinite maximum conumtion.
7.. REDUCING TO AN ELEMENTARY NETWORK 9 Definition 7.4 (Elementary network). A flow network (G,,,c) i elementary: - and are two ditinct vertice where i a ource (i. e. d ()=0) and i a ink (i.e. d + ()=0); - ()=+ and (v)=0 for all v = ; - ()=+ and (v)=0 for all v =. We denote (G,,,c) by (G,,,c). Definition 7.5 (Aociated elementary network). If N =(G, r max,co max,c) i a flow network, it aociated elementary network i the following elementary network N =(Ḡ,,, c) obtained from N in the following way: - add a ource and a ink ; - link to all vertice v with non-null roduction with an arc (,v) of caacity r max (v); - link all vertice v with non-null conumtion to with a link (v, ) of caacity co max (v); 5 4 0 0 0 0 Figure 7.: Elementary network aociated to the flow network deicted in Figure 7. (right) and the flow in thi network correonding to the one of Figure 7. (left) It i eay to ee that there i a one-to-one correondence between any flow F =(r,co, f ) of the elementary network and a flow F =(r,co, f ) of the initial roblem defined a follow: for any roduction ite u, r (u)= f ((,u)); for any conumtion ite v, co (v)= f ((v, )) and for any arc (x,y), f ((x,y)) = f ((x,y)). Clearly, both flow have ame value v(f)=v(f )=r()=co(). Hence: Finding a maximum flow in a flow network i equivalent to finding a maximum flow olve in it aociated elementary network. In the following, we only conider elementary flow network.
94 CHAPTER 7. FLOW PROBLEMS Note that, in an (elementary) flow network N =(G,,,c), the flow conervation contraint can be written: v V (G) \{, }, (u,v) E(G) f ((u,v)) = f ((v,u)) (v,u) E(G) Moreover, a flow F =(r,co, f ) of an (elementary) flow network i well defined by the flow function f ince, by the flow conervation contraint in and, we have v(f) = r() = f ((,u)) u V (G),(,u) E(G) = co() = f ((u, )) u V (G),(u,) E(G) Therefore, for eae of reentation, we often identify a flow F with it function f, and we note the flow value by v( f ). To imlify the notation in the equel, for a flow f or a caacity c, and an arc (u,v), we write f (u, v) intead of f ((u, v)), and c(u, v) intead of c((u, v)). 7. Cut and uer bound on the maximum flow value We will how that the value of a maximum flow in a network i limited by the exitence of ome bottleneck through which the traffic mut go. Roughly, to go from the ource to the ink, the flow mut cro the border of a et of vertice, it ize (the um of the caacitie of the correonding edge) will limit the value of the flow. Such a border i called a cut. Definition 7.6 (Cut). In a flow network N =(G,,,c), an (, )-cut, or imly a cut, i a biartition C =(V,V ) of the vertice of G uch that V and V. The arc form V to V (i.e. with tail in V and head in V ) are the arc of C. Their et i denoted by E(C). The caacity of the cut C, denoted by δ(c), i the um of the caacitie of it arc: e E(C) c(e). Let f be a flow and C =(V,V ) be a cut, out( f,c) denote the flow on arc leaving V and in( f,c) the flow entering V : Note that the flow conervation imlie that out( f,c) = (u,v) E(C), u V,v V f (u,v) in( f,c) = (u,v) E(G), u V,v V f (u,v) for all cut C, v( f )=out( f,c) in( f,c) In articular, the value of the flow i alway at mot out( f,c). But clearly out( f,c) δ(c),o v( f ) δ(c). (7.)
7.4. AUXILIARY NETWORK AND PUSH ALGORITHM 95 V V Figure 7.: A flow network and a cut with caacity 4. Bold arc are thoe of the cut A cut can be viewed a a et of arc that the flow mut cro and whoe caacity limit the value of the flow. Let v max = max{v( f ), f a flow} and δ min = min{δ(c), C a cut}. Equation 7. alied to a maximum flow and a minimum-caacity cut yield v max δ min. (7.) In fact, the next theorem,due to Ford and Fulkeron, tate that there i equality. Theorem 7.7 (Ford & Fulkeron). The maximum value of a flow equal the minimum caacity of a cut, i.e., v max = δ min. We often ay that max flow equal min cut. It i an examle of min-max theorem There are many roof of thi theorem, ome being non-contructive roof of thi theorem. In the next ection, we reent the original roof which i baed on an algorithm comuting a maximum flow and a cut with minimum caacity. 7.4 Auxiliary Network and uh Algorithm Mot of the algorithm for comuting maximum flow are baed on the following idea: Starting from an exiting flow (initially, it may be null), the flow i increaed by going from the ource to the ink by uhing the commodity where it i oible. The difference between the algorithm mainly conit of the way ued to decide where and how to uh ome flow. For thi uroe, we define an auxiliary network. Thi grah, denoted by N( f ), deend on the exiting flow f.
96 CHAPTER 7. FLOW PROBLEMS Definition 7.8 (Auxiliary network). Given a flow network N =(G,,,c) and a flow f, we build the auxiliary network N( f )=(G( f ),,,c f ) a follow. For any air of vertice (u,v), let c f (u,v)=c(u,v) f (u,v)+ f (v,u) with c(u,v), f (u,v) and f (v,u) equal to 0 when they are not defined (if (u,v) i not an arc of G). Note that c f (u,v) 0 ince c(u,v) f (u,v) 0. Then, G( f ) i defined a follow V (G( f )) = V (G) E(G( f )) = {(u,v) c f (u,v) > 0} Note that c f (u,v)+c f (v,u)=c(u,v)+c(v,u). Intuitively, c f (u,v) i the um of the remaining caacity on the arc (u,v), i.e., c(u,v) f (u,v), lu a virtual caacity f (v,u), that allow to remove ome flow on the arc (v,u), which correond to virtually uh ome flow along (u,v). See examle in Figure 7.4 and 7.5. Note that the auxiliary network ha no arc with caacity 0. Thi i imortant becaue it enure that, for any directed ath P in G( f ), the minimum caacity of the arc of P i oitive. 4 4 7 4 4 4 4 5 5 5 5 5 Flow network Flow Auxiliary network Figure 7.4: A flow network, a flow and the correonding auxiliary network Let P be a directed (, )-ath in N( f ) where the minimum caacity of an arc in P i ε > 0. The flow f obtained by uhing ε unit of flow along P i defined by: For any arc (u,v) E(P), we uh the flow along (u,v), that i, we increae the flow with ε unit on (u,v). Two cae may haen: - If the remaining caacity of (u,v) i ufficient for the ε unit of flow, i.e., f (u,v)+ε c(u,v), then f (u,v)= f (u,v)+ε and f (v,u)= f (v,u). - If the remaining caacity of (u,v) i not ufficient for the ε unit of flow, i.e., f (u,v)+ ε > c(u,v), then, by definition of the auxiliary network, we have f (v,u) f (u,v)+ε c(u,v) > 0. Hence, (v,u) ha a flow exce of f (u,v)+ε c(u,v) unit that we mut remove. We et f (u,v)=c(u,v) and f (v,u)= f (v,u) ( f (u,v)+ε)+c(u,v).
7.4. AUXILIARY NETWORK AND PUSH ALGORITHM 97 If (u,v) and (v,u) do not belong to P, the flow remain unchanged on thee arc, f (u,v) = f (u,v) and f (v,u)= f (v,u). Lemma 7.9. If f i a flow of value v( f ), then f i a flow of value v( f )+ε. Proof. See Exercice 7.5. For intance, from the flow deicted in Figure 7.4, by taking the directed (, )-ath deicted in Figure 7.5 with minimum caacity and uhing the flow, we obtain the new flow and the new auxiliary network deicted in Figure 7.5. 4 4 5 5 4 (, )-ath New flow New auxiliary network Figure 7.5: Puh along a directed (, )-ath of the auxiliary network in Figure 7.4. Now, we have ome element of an algorithm:. Start with any flow f ;. Comute the auxiliary network N( f );. Find a directed ath from to in G( f ); 4. If uch a directed ath P exit, then uh ome flow along P and udate f. Note that, if there i no directed ath from the ource to the ink in the auxiliary grah, the reviou algorithm doe nothing. We will ee that, in thi cae, the exiting flow i maximum. Prooition 7.0. If G( f ) doe not contain a ath from the ource to the ink, then the flow f i maximum. Proof. Let V be the et of all vertice that can be reached from in G( f ). V doe not contain the ink ince there are no (, )-ath. Hence, V = V \V. Let C be the cut (V,V ). Let (u,v) be an arc of C. By definition of V, the arc (u,v) i not in G( f ). So, by definition of G( f ), thi mean that c f (u,v)=0. Hence, f i uch that f (u,v)=c(u,v) and f (v,u)=0. We get that out( f,c)=δ(c) and in( f,c)=0. Informally, there i no flow entering V and all arc of C (that i leaving V ) are aturated.
98 CHAPTER 7. FLOW PROBLEMS But v( f )=out( f,c) in( f,c), therefore v( f )=δ(c) The current flow ha the ame value a the caacity of the cut C. Hence, f i maximum by Equation (7.). Note that thi roof alo exhibit a cut (V,V ) with ame caacity a the maximum value of a flow. Hence it i a minimum-caacity cut. It how that it i eay to find a minimum-caacity cut (V,V ) from a maximum flow: V i the et of the vertice reachable from the ource in the auxiliary network and V it comlement. Now, we can rove Theorem 7.7. Proof of Theorem 7.7: Let f be a flow with maximum value in a flow network (G,,,c), and let N( f ) be the auxiliary network. In G( f ), there are no directed (, )-ath, otherwie we obtain a flow with greater value by uhing ome flow along thi ath (Lemma 7.9). Hence, by the roof of Prooition 7.0, the cut C =(V,V ), where V i the et of vertice v uch that there i a directed (,v)-ath in G( f ), ha caacity v( f )=v max. Therefore, δ min δ(c) v max. 7.5 Ford-Fulkeron algorithm We now have the following algorithm: Algorithm 7. (Ford and Fulkeron (956)).. Start with null flow f = 0;. Comute the auxiliary network N( f );. Look for a directed ath from to in G( f ); 4. If uch a directed ath P exit, then uh ome flow along P, udate f and go to ; 5. Ele terminate and return f. Thi algorithm i correct in the ene that If the algorithm terminate, then it return a maximum olution. But ) doe it alway terminate? ) If it terminate, what i it comlexity?
7.5. FORD-FULKERSON ALGORITHM 99 The anwer to quetion i omehow ye and no: we will ee that the algorithm alway terminate if the caacitie are rational, but it can take infinite time if caacitie are real. Beide, even when the caacitie are integer, the running time deend linearly on the value of the maximum flow that may be huge. Analyi of Ford-Fulkeron Algorithm Prooition 7.. (i) If all caacitie are integer, then Algorithm 7. terminate after at mot v max earche of a directed ath. (ii) If all the caacitie are rational, then Algorithm 7. terminate after at mot µ v max earche of a directed ath, with µ the leat common multile of the denominator of the caacitie. Proof. (i) If caacitie are integer, at each iteration, the algorithm uhe at leat one unit of flow (ince, in thi cae, ε i integral). Each iteration require the earch of a ath from to in G( f ). Thi can be done in time O( E(G) ) by any earch algorithm (See Chater ). Hence, it total running time i at mot O( v max E(G) ). (ii) If caacitie are rational, the algorithm terminate ince the flow increae of at leat µ at each iteration. µ can be very large, but it i fixed. Actually, we can olve the roblem by multilying all caacitie by µ and by olving the integral roblem obtained: it i roortional the initial one. Remark 7.. If ome caacitie are integer, then the Ford-Fulkeron algorithm return a maximum flow with integral value. Prooition 7.. If the caacitie are real, the algorithm may not terminate. Moreover, the increaing equence of the flow value may converge to a value a lot maller than the otimal value. Proof. Conider the flow network hown in Figure 7.6 for which the caacitie of all edge are infinite (or if the reader refer, a huge integer M). Let α denote the oitive root of x +x = 0. Clearly / < α <. Let the initial flow f 0 be a hown in Figure 7.6. We hall rove that by emloying a well (or very badly) choen equence of four augmenting ath over and over, Algorithm 7. will roduce an infinite equence of flow, the value of which are monotone increaing and which converge to a limit not exceeding 6. For any m 0, tart from the flow f 4m and uh along the directed ath (,c,d,a,b, ). The uhed amount i α 4m+ becaue of arc (a,b) in the auxiliary network. The reulting flow i f 4m+. Puh along the directed ath (,c,b,a,d, ) an amount of α 4m+ (becaue of (c,b)) to roduce f 4m+, uh along the directed ath (,a,b,c,d, ) an amount of α 4m+ (becaue of (c,d)) to roduce
00 CHAPTER 7. FLOW PROBLEMS d d c c α + α b α + α b α α a a Figure 7.6: A flow network and the initial flow f 0 f 4m+ and uh along the directed ath (,a,d,c,b, ) an amount of α 4m+4 (becaue of (a,d)) to roduce f 4m+4. See Figure 7.7. For k, the augmentation of the value from f k to f k i α k and hence v( f k ) = v( f 0 )+α + α + + α r = ( + α + α )+α + α + + α r = α (α + α + α + α + α + + α r+ ) = α (α + α +( α)+α + α + + α r+ ) = α ( + α + α + + α r+ ) < α ( + α + α + α + + α r+ ) < α α = α 4 < 6. From thi contruction, it i eay to contruct an examle of a network where ome caacitie are irrational uch that even tarting with a null flow, the equence of flow obtained by uhing along ome directed ath converge to a value le than 6, while the value of a maximum flow i infinite (or arbitrarily large). See Exercie 7.9. Remark 7.4. While the termination i not enured in cae of irrational caacitie, Theorem 7.7 (v max = δ min ) remain valid. We rove the real cae by taking the limit of the rational cae. In ractice, the rational cae i the only imortant roblem, ince comuter work with a finite reciion.
7.6. PUSHING ALONG SHORTEST PATHS 0 d d d d α 4m α 4m+ α 4m+ α 4m+ c α 4m+ c α 4m+ c α 4m+4 α 4m+ c α 4m+4 b b b b α 4m+ α 4m+ α 4m+5 a a a a f 4m f 4m+ f 4m+ f 4m+ Figure 7.7: The equence of flow. The arc leaving and the arc entering are not drawn The bound of Prooition 7. on the number of uhe i not good becaue it deend on the value of the maximum flow which may be huge. Figure 7.8 how an examle where v max uhe, if they are badly choen, are neceary to reach a flow with maximum value. Indeed, if k a k k k b Figure 7.8: Examle where k = v max uhe may be erformed. the uhe are alternatively erformed along P =(,a,b, ) and P =(,b,a, ), then one unit of flow i uhed at each iteration becaue the caacity of (a,b) or (b,a) equal. Therefore, k = v max uhe are neceary (k along P and k along P ). To imrove the reviou algorithm and to enure it quick termination in all cae, the idea i to conider the uhe on ome ecific directed ath. 7.6 Puhing along hortet ath Intead of uhing the flow along an arbitrary directed ath (, )-ath in the auxiliary network, a better algorithm conit in uhing along a hortet directed (, )-ath. Here, by hortet
0 CHAPTER 7. FLOW PROBLEMS ath, we mean a hortet ath in term of number of arc, not of total caacity. Algorithm 7. (Edmond-Kar, 970).. Start with null flow f = 0;. Comute the auxiliary network N( f ) ;. Look for a hortet directed ath from to in G( f ); 4. If uch a ath P exit, uh ome flow along P, udate f and go to ; 5. Ele terminate and return f. E(G) V (G) We will how that uch an algorithm erform at mot iteration. That i, it time E(G) V (G) comlexity i at mot time the comlexity of finding a hortet ath. Note that, contrary to the Ford-Fulkeron Algorithm (7.), thi bound i indeendent from the caacitie. The roof i baed on two imle roertie. ) During the iteration, the ditance between and in the auxiliary grah cannot decreae. ) During the iteration, the ditance between and remain unchanged at mot E(G) conecutive iteration. Let f 0 be a flow and let G 0 = G( f 0 ); We et: - E the et of arc of G 0 that belong to a hortet ath from to in G 0 ; - E the arc obtained by revering the one in E ; - G the grah obtained from G 0 by adding the arc in E. Lemma 7.5. The grah G ha the following roertie: (i) A directed ath from to with length dit G0 (, ) doe not ue any arc in E. (ii) The ditance from to in G i dit G0 (, ); Proof. (i) Let P be a directed (, )-ath in G that contain ome arc in E, and let (v,u) be the lat arc of E that belong to P. Let u how that P i not a hortet directed (, )-ath. Since (u,v) belong to a hortet directed (, )-ath, we have dit G0 (u, ) =dit G0 (v, )+. Since between u and, the ath P ue only arc in G 0, it length i l ++dit G0 (u, ) (where l i the length of the ubath of P between and v). Hence, P ha length l + + dit G0 (v, ). The ath P obtained by following P until v and then uing a hortet directed (v, )-ath ha length l + dit G0 (v, )=l + dit G0 (v, ). Therefore, P i not a hortet directed (, )-ath. (ii) Follow from (i).
7.7. ALGORITHM USING A SCALE FACTOR 0 Theorem 7.6. Algorithm 7. erform at mot E(G) V (G) iteration. It time-comlexity i E(G) V (G) earche of hortet directed ath, o O( E(G) V (G) ). Proof. During a uh, we add to the auxiliary network the arc in E. By Lemma 7.5, it doe not decreae the ditance between and. The algorithm conit of V te correonding to the et of all oible ditance between and. A te conit of a et of iteration when the ditance between and remain unchanged. Let u conider ucceive iteration that let the ditance dit(, ) unchanged. During ome iteration, the auxiliary network G 0 change ince ome arc are added and other arc are removed. However, ince d(, ) remain the ame, the ath along which uhe are erformed ue only arc of G 0. Since at each iteration, at leat one arc of G 0 i removed (we uh the maximum oible along the choen ath, o one arc i removed), at mot E(G) uch iteration are erformed. Since dit(, ) V (G), we have at mot V (G) te of at mot E(G) iteration each. At each iteration we mainly have to find a hortet directed (, )-ath. Thi can be done in time O( E(G) ) by any earch algorithm (See Chater ). Hence the total comlexity i O( E(G) V (G) ). 7.7 Algorithm uing a cale factor If the caacitie are integral then Algorithm 7. may take time to find the maximum flow becaue of the diarity of the value of the caacitie. In the examle in Figure 7.8, the uhe may be erformed along an arc with caacity, while there i a ath between the ource and the ink with caacity k. Thi roblem may be overcome by uing a cale factor. The idea i to try to work with caacitie with imilar value, to aturate them and then to conider caacitie with maller value. The idea i to tart with the greatet caacitie, to uh ome flow in a network that conit only of thee link and to try to aturate them a much a oible. Then, the network i relaced by the current auxiliary network to which we add new link with maller caacitie than the one conidered yet. Algorithm 7. (Scaling Algorithm). 0. Comute the mallet integer m uch that c(e) < m for any arc e. For all e E(G), et c(e)= m j=0 j c j (e) with c j (e) {0,}.. k := m ; for all e E(G), c (e) := 0 and f (e) := 0;. If k < 0, then terminate, ele for all e E(G), c (e) := c (e)+ k c k (e).. Increae a much a oible the flow f in (G,,,c ); k := k ; go to Ste.
04 CHAPTER 7. FLOW PROBLEMS Clearly, thi algorithm comute a maximum flow becaue, at the end, all caacitie are taken into account. Let u conider the comlexity of thi algorithm. For thi uroe, we need the following rooition the roof of which i left in Exercie 7.0. Prooition 7.7. Let N =(G,,,c) be a flow network and α a oitive real. Let e be an arc of G and N be the flow network (G,,,c ) where c i defined by c (e) =c(e)+α and c ( f )=c( f ) for all f = e. Then v max (N ) v max (N)+α. Theorem 7.8. Algorithm 7. erform le than (log (v max )+) E(G) uhe. Proof. Let c i = m j=i j c j be the caacity at Ste when k = i, g i be the flow added during thi te, and f i+ be the total flow before thi te. Hence f i = f i+ + g i. Let u rove by decreaing induction that at Ste -(i) Algorithm 7. erform at mot E(G) uhe and that f i (e) i a multile of i for every arc e. The reult hold trivially for i = n. Suoe now that the reult hold for i +. Since the caacity c i and the flow f i+ are multile of i, in the auxiliary network, the caacity of the arc are multile of i. Hence finding g i correond to finding a maximum flow g i in the network with integral caacitie (G,,,(c i f i+)/ i ) with v(g i ) v(g i)/ i. Moreover, at the end of Ste -(i + ), the flow could not be increaed anymore, therefore, there are no directed ath with minimum caacity i+. Hence, at Ste.(i), any directed ath in the auxiliary network ha minimal caacity i. Hence, each iteration uhe exactly i unit of flow at Ste.(i). Thu v(g i ) i E(G) and o v(g i ) i E(G). By Prooition 7., finding g i and g i i done in at mot E(G) uhe. In addition, by Remark 7., the flow g i ha integral value and o the value of g i are multile of i. Let i 0 be the larget integer uch that a uh ha been done at i 0. If i 0 v max, then after uhing once at Ste -(i 0 ), we obtained a flow of value i 0, which mut be a maximum flow. Otherwie, i 0 < log (v max ) and for each i, 0 i i 0, Algorithm 7. erform at mot E(G) uhe. Hence in total, the number of uhe it at mot (i 0 + ) E(G) (log (v max )+ ) E(G). 7.8 Flow in undirected grah Until now, we have conidered the roblem in directed grah. However, there are ome context in which the correonding network i undirected. For intance, when the link are bidirectional. In thi cae, each link ha one maximum caacity but the flow may circulate in both direction if the um of the two traffic i at mot the caacity of the link. A undirected flow network N =(G, r max,co max,c) i defined imilarily to the direct cae. The definition of the flow i a bit modified ince two value mut be aociated to each edge uv: f (u,v) correond to the traffic from u to v and f (v,u) correond to the traffic from v to u. Definition 7.9 (Undirected Flow). The flow i a three-tule F =(r,co, f ) where
7.8. FLOWS IN UNDIRECTED GRAPHS 05 - r i a function of roduction uch that, for any vertex v, 0 r(v) r max (v); - co i a function of conumtion uch that, for any vertex v, 0 co(v) co max (v); - f i a function over the ordered air (u,v) (with u and v adjacent), called flow function that atifie the following contraint: Poitivity: e E, f (e) 0 Caacity contraint: uv E, f ((u,v)) + f ((v,u)) c(uv) Flow conervation: v V, (u,v) E f ((u,v)) + r(v)= A in the directed cae, the value of the flow F i v(f)= r(v)= co(v) v V v V (v,u) E f ((v,u)) + co(v) Let N =(G, r max,co max,c) be an undirected flow network. The (directed) flow network aociated to N i N =(G, r max,co max,c) obtained by relacing each edge uv by an arc (u,v) and an arc (v,u) each of which ha caacity c(u,v). Formally, (G =(V (G), {(u,v),(v,u)}) uv E(G) andc((u,v)) =c((v,u)) = c(uv). Clearly, a flow function f in N and a flow function f in N atify the ame contraint but the caacity contraint. The one in N: i tronger than the one in N: uv E(G), f ((u,v)) + f ((v,u)) c(uv) uv E(G),f ((u,v)) c(uv) et f ((v,u)) c(uv) Hence, any flow of N i a flow in N. Hence, the maximum value of a flow in N i at mot the maximum value of a flow in N. In other word, v max (N) v max (N). We how that they are equal. Definition 7.0 (imle flow). A flow i imle if, for any air of vertice {u,v}, we have either f (u,v)=0 or f (v,u)=0. To any flow, there i a correonding imle flow defined a follow. If f (u,v) f (v,u) > 0 then f (u,v) = f (u,v) f (v,u) and f (v,u) =0. It i eay to ee that v( f )=v( f ) ince f (v,)=0 for any vertex v becaue d ()=0 and o f (,v)= f (,v). Prooition 7.. Let N be an undirected flow network and let N be the aociated flow network: v max (N)=v max (N) Proof. Let F =(r,co,f ) be a flow in N. Let F =(r,co, f ) be the imle flow of F. Then v(f) =v(f). Since F i imle, for any edge uv E(G), we have f (u,v) =0 or f (v,u) =0. Beide, the caacity contraint in N give f (u, v) c(uv) ou f (v, u) c(uv). Hence, for any uv E(G), f ((u,v)) + f ((v,u)) c(uv). Then, F i a flow for N. Therefore, any flow of N correond to a flow of N with ame value. Thi rooition allow u to reduce the undirected roblem to the directed cae. To find a maximum flow in an undirected network, it i ufficient to olve the roblem in the aociated directed network and to take the correonding imle flow.
06 CHAPTER 7. FLOW PROBLEMS 7.9 Alication of flow 7.9. Connectivity in grah Menger Theorem (Theorem 5.8 i very cloely related to Theorem 7.7. Oberve that the arc et of an (, )-cut in a flow network correond to an (, )-edge-earator. Hence one can deduce Menger Theorem from Theorem 7.7. We now do it for Theorem 5.8-(ii) for digrah. In fact the roof of thi reult we gave in Section 5.6 wa uing the uh technique (in diguie). Proof of Theorem 5.8-(ii) for digrah. Let G be a digrah. The edge-connectivity κ (,t) i the value of the caacity of a cut in the flow network N obtained by aigning to each arc a caacity of, and chooing a ource and t a ink. Indeed, if C =(V,V t ) i a cut, then after the removal of the arc of C, there remain no (,t)-ath. Hence κ (,t) δ min (N). Recirocally, let E be an arc-earator of G and G = G \ E. Let V be the et of vertice w of G uch that there exit a directed (,w)-ath in G, and V t = V \V u. By definition of V, any arc (x,y) with x V and y V t i in E. Hence, δ((v,v t )) E. Therefore, δ min (N) κ (,t). From Theorem 7.7, there i a flow of value κ (,t) in thi network. Moreover, by Remark 7., we may aume that thi flow i integral. Since the edge have unit caacity, the flow of value κ (,t) can be decomoed into a et of κ (,t) airwie edge-dijoint (,t)-ath. Hence κ (,t)=π (,t). The other cae of Menger Theorem may alo be derived from Theorem 7.7. See Exercie 7.. Thu Menger Theorem can be viewed a a articular cae of Theorem 7.7. In fact, they are equivalent and it i not too difficult to rove Theorem 7.7 from Menger Theorem. See Exercie 7.4. 7.9. Maximum matching in biartite grah The theorem on matching in biartite grah that we roved in Chater 6 are direct alication of flow. Indeed to every biartite grah G =((A,B),E), one can aociate the flow network N G =(H,,,c) defined a follow: H i the digrah obtained from G by orienting all edge of G from A to B and adding a ource and a ink, all arc (,a) for a A and (b, ) for b B; the caacity equal for all arc. See Figure 7.9. Figure 7.9: A biartite grah and it aociated flow network
7.9. APPLICATIONS OF FLOWS 07 There i a one-to-one correondence between the matching of G and the integral flow in N G : to every matching M correond the flow f M with value on the arc et (a,b) E(G){(,a),(a,b),(b, )}. Moreover the ize of M i equal to the value of the flow f M. In addition, an M-augmenting ath in G correond to a directed (, -ath in the auxiliary network N G ( f M ). Hence Algorithm 6. i a articular cae of Algorithm 7.. One can alo deduce all the reult of Chater 6 from Theorem 7.7. For examle, we now give a roof of Theorem 6. ( Let G =(A,B) biartite, there i a matching of ize k if and only if S A, A S + N(S) k ) uing flow. Proof of Theorem 6.. Let u rove that the maximum ize µ of a matching in G i equal to the maximum value of a flow in N G. If M i a matching of ize µ in G, then f M ha value µ. Hence µ v max. Recirocally, from Remark 7., there i a maximum flow f with integral value. It i in one-to-one correondence with a matching M of ize v( f )=v max. Hence, µ v max. Let C =(V,V ) be a minimum cut. Let A = A V and B = B V. If there i a vertex b (B N(A ))\B, then etting C =(V {b},v \{b}), we get δ(c ) δ(c) + = δ(c). So, by adding the vertice of (B N(A ))\B in V if needed, we may aume that the minimum cut that we conider i uch that N(A ) B. Let u conider the caacity of C. δ min = δ(c) = {(,a) a A \ A } + {(b, ) b B } + {(a,b)} a A,b B \ B } = A A + B Since N(A ) B, it follow that δ min A A + N(A ). Moreover, the cut (A N(A ),V (H) \ (A N(A ))) ha caacity A A + N(A. So δ min = A A + N(A ). We conclude that δ min = min{s A A S + N(S)} Hence, from Theorem 7.7, µ = v max = δ min = min{s A A S + N(S)}. 7.9. Maximum-gain cloure In thi roblem, we have everal tak. Each tak t T i aociated to a gain g(t). The gain may be negative (if o, it correond to a lo). We note T + (re. T ) the et of tak with oitive gain (re., negative gain). Beide, there are everal cloure contraint.that i, the choice of a tak may imly the choice of one or everal other tak. We rereent thi cloure relation (e.g., imlication relation) by an imlication digrah D T : it vertice are the tak and there i an arc (t,t ) if and only if the choice of t imlie the choice of t. The objective i to find a et of comatibletak with maximum gain, that i a ubet A of T uch that: - there are no arc leaving A (E((A,A)) = /0) i.e. A i a cloure in D T ; - t A g(t) i maximum.
08 CHAPTER 7. FLOW PROBLEMS Let u how how thi roblem can be reduced to a roblem of cut with minimum caacity, hence to a maximum flow roblem. Let N =(G,,,c) be the following flow network (See Figure 7.0: - V (G)=T {, }; - for any tak t with oitive gain, link the ource to the tak t with an arc (,t) with caacity c(,t)=g(t); - for any tak t with non-oitive gain, link t to the ink with an arc (t, ) with caacity c(t, )= g(t); - if a tak t imlie a tak t, we add the arc (t,t ) with infinite caacity in the network. T + + 0 0 + + + 4 5 4 + + + 5 5 5 + + + T 5 5 Figure 7.0: An imlication digrah and it correonding flow network Let u conider a cut C =(V,V ) with finite caacity in the network. We have S = {} A with A T. Moreover, ince the cut ha finite caacity, it arc et contain no arc of D T, o A i a et of comatible tak. Let A + = A T + and A = A T. The caacity of C i: δ(c) = t T + \A + c(,t)+ t A c(t, ) = t T + \A + g(t) t A g(t) = g(t) g(t) g(t) t T + t A + t A = g(t) g(t) t T + t A Since t T + g(t), the um of all oitive gain, i a contant, minimizing the caacity of the cut S = {} A i equivalent to maximizing the gain of A.
7.0. EXERCICES 09 7.0 Exercice Exercie 7.. Let N be the flow network and f 0 the (, )-flow in N a deicted in the figure below. 4 network initial flow ) Start from f 0 and find a maximum (, )-flow. Detail the te of the algorithm. ) Decribe a minimum cut of thi network. Exercie 7.. Find a maximum (, )-flow and a minimum (, )-cut in the network deicted below. (Detail the te of the uh algorithm.) 5 5 6 Exercie 7.. There are roduction ite A,B,C and 5 conumtion ite,,,4,5; their roduction and conumtion, reectively, are given in the following table. A B C 5 4 7 4 5 4 5 Finally, each roduction ite can only erve the conumtion ite a ummarized in the following table. A B C 4 45 The roblem i to atify the conumtion ite. Model the following roblem in term of flow and give a olution to the roblem or exlain why it could not exit. Exercie 7.4. Prove the following roerty: for all (, )-cut C =(V,V ),v( f )=out( f,c) in( f,c). Why i the hyothei V and V imortant? Exercie 7.5. Prove Lemma 7.9. Verify that the oitivity, the caacity contraint and the flow conervation are atified for f.
0 CHAPTER 7. FLOW PROBLEMS Exercie 7.6. The uort of a flow i the et of arc on which the flow function i oitive. Show that there alway exit a maximum flow whoe uort ha no directed cycle. Exercie 7.7. Let N =(G,,,c) be a flow netwrok uch that, for all arc e, c(e) i an even integer. ) Prove that the maximum value of a flow i an even integer. ) Show that there i a maximum flow f uch that, for all arc e, f (e) i an even integer. Exercie 7.8. Modify Algorithm 7. to obtain an algorithm finding a minimum cut in a flow network. Exercie 7.9. Contruct a flow network for which Algorithm 7. roduce a equence of flow whoe value converge to a finite value when uhing on ome equence of directed ath, while the value of a maximum flow i infinite (or arbitrarily large). Exercie 7.0. Prove Prooition 7.7. Exercie 7.. In thi exercie, we tudy a variant of the algorithm for finding a maximum flow, in which we uh the flow along a directed ath of maximum reidual caacity. ) Give an algorithm finding a directed ath of maximum reidual caacity. ) Show that if we uh an amount of x at one te, then we uh an amount of at leat x at each following te. Exercie 7.. Let N =(G,,,c) be a flow network. To each vertex v V (G), we aociate an real w(v). We want to comute a flow f of maximum value atifying the following extra contraint: v V (G) the flow entering v i at mot w(v) (i.e. u N (v) f (uv) w(v)). Show how to find uch a flow by comuting a maximum flow on a network obtained from N by light modification. Exercie 7.. Deduce Menger Theorem (5.8) from Theorem 7.7. (Hint: One can ue Exercie 7. to rove Theorem 5.8-(i). Exercie 7.4. Deduce Theorem 7.7 from Menger Theorem (5.8). Exercie 7.5. Several comanie end member to a conference; the ith comany end m i member. During the conference, everal workho are organized imulteanouly; the ith workho can receive at mot n j articiant. The organizer want to diatch articiant into workho o that two member of a ame comany are not in a ame workho. (The workho do not need to be full.) a) Show how to ue a flow network for teting if the contraint may be atified. b) If there are comanie and q workho indexed in uch a way that m m and n n q. Show that there exit a diatching of articiant into groue atifying the contraint if and only if, for all 0 k and all 0 l q, we have k(q l)+ l j= n j k i= m i.
7.0. EXERCICES Exercie 7.6 (Unlittable flow). We conider a flow network with one roduction ite and many conumtion ite, ay,,... n. The conumtion at ite i i d i. We want to route commoditie for to i with the following additionnal contraint: the traffic from to i mut be routed along a unique directed ath (it cannot be lit). Show that thi roblem i NP-comlete.
CHAPTER 7. FLOW PROBLEMS