CS 545 Flow Nework lon Efra Slide courey of Charle Leieron wih mall change by Carola Wenk Flow nework Definiion. flow nework i a direced graph G = (V, E) wih wo diinguihed verice: a ource and a ink. Each edge (u, E ha a nonnegaive capaciy c(u,. If (u, E, hen c(u, = 0. Example: Flow nework Definiion. poiive flow on G i a funcion p : V V Raifying he following: Capaciy conrain: For all u, v V, 0 p(u, c(u,. Flow conervaion: For all u V {, }, p ( u, p( u) = 0. The value of a flow i he ne flow ou of he ource: p (, p( ). poiive flow flow on a nework : capaciy : 0: u : : : : : : : : Flow conervaion Flow ino u i + =. Flow ou of u i 0 + + =. The value of hi flow i 0 + =. The maximum-flow problem Maximum-flow problem: Given a flow nework G, find a flow of maximum value on G. : : 0: 0: : : : : : : : The value of he maximum flow i 4. pplicaion: Biparie Maching. B graph G(V,E) i called biparie if V can be pariioned ino wo e V= B, and each edge of E connec a verex of o a verex of B. maching i a e of edge M of E, where each verex of i adjacen o a mo one verex of B
Maching and flow problem : : 0: : B dd a verex, and connec i o each verex of. dd a verex, and connec each verex of B o. The capaciy of all edge i. Find max flow. ume i i an ineger flow, o he flow of each edge i eiher 0 or. Each edge of G ha carrie flow i in he maching. Each edge of G ha doe no carry flow i no in he maching. Claim: The edge beween and B ha carry flow form a maching. Greedy i ubopimal. : : : 0: 0: 0: 0: B ume we have already ome edge in a (parial ) maching M. In order o increae he cardinaliy of he maching we migh need o fir remove from M ome edge (omehow counerinuiive?) Thinking again abou he maching a flow problem, i mean ha we migh need o remove flow from edge ha currenly curry flow. Flow cancellaion Wihou lo of generaliy, poiive flow goe eiher from u o or from v o u, bu no boh. : : : 0: Ne flow from u o v in boh cae i. The capaciy conrain and flow conervaion are preerved by hi ranformaion. noaional implificaion IDE: Work wih he ne flow beween wo verice, raher han wih he poiive flow. Definiion. (ne) flow on G i a funcion f : V V Raifying he following: Capaciy conrain: For all u, v V, f (u, c(u,. Flow conervaion: For all u V {, }, f ( u, = 0. One ummaion inead of wo. Skew ymmery: For all u, v V, f (u, = f ( u). Equivalence of definiion Ne flow v. poiive flow. Theorem. The wo definiion are equivalen. Proof. ( ) Le f (u, = p(u, p( u). Capaciy conrain: Since p(u, c(u, and p( u) 0, we have f (u, c(u,. Flow conervaion: f ( u, = ( p( u, p( u) ) = p( u, p( u) In paricular, if u V {, }, hen f ( u, =0 Skew ymmery: f (u, = p(u, p( u) = (p( u) p(u, ) = f ( u). Proof (coninued) Obaining he poiive flow from he ne flow ( ) Define p(u, = f (u, if f(u, > 0, 0 if f(u, 0. Capaciy conrain: By definiion, p(u, 0. Since f (u, c(u,, i follow ha p(u, c(u,. Flow conervaion: If f (u, > 0, hen f ( u) < 0 o p(u)=0. p(u, p( u) = f (u,. If f (u, 0, hen p(u, p( u) = f ( u) = f (u, by kew ymmery. Therefore, p ( u, p( u) = f ( u,
Reidual nework Definiion. Le f be a flow on G = (V, E). The reidual nework G f (V, E f ) i he graph wih ricly poiive reidual capaciie c f (u, = c(u, f (u, > 0. Example: 4 0:4 Lemma. E f E. 4 4:4 :4 ugmening pah Definiion. ny pah from o in G f i an augmening pah in G wih repec o f. The flow value can be increaed along an augmening pah p by adding. c f (p):=min{ c f (u, (u, p } o he ne flow of each edge along p. (u, p e f(u, += c f (p) ; f(u) -= c f (p) Thi i called pah augmenaion. Example: :5 :6 7: c f (p) = 5:5 4 4:6 5 7 : Noe flow conervaion i preerved. ugmening pah anoher example Definiion. ny pah from o in G f i an augmening pah in G wih repec o f. The flow value can be increaed along an augmening pah p by adding c f (p):=min{ c f (u, (u, on p } o he ne flow of each edge along p. Thi i called pah augmenaion. Example : :5 :6-5: :5 5:5 : c f (p) = 5:5 4 4:6 -: 7 4:5 :5 0: Example maximum maching G : : 0: B. : : 0: 0: 0: B. f =0 Ford-Fulkeron max-flow algorihm Sar: While () { conruc G f if an augmening pah p in G f exi hen augmen f by c f (p) //ny pah would do ele exi } 0:0 0:0 0: 0:0 0:0 :0 0:0 c f (p)= 0 0 : 0:0 :0 0 f = 0 0 0 c f (p)= 0 0 8 8 :0 :0 :0 0: f = :0 :0 :0 :0 : :0 f = :0 :0 :0 0: f =4 :0
noher example - Maching : : : G : 0: 0: 0: 0: B. B. 0: : : G : : : : : f = f = Noaion Definiion. The value of a flow f, denoed by f, i given by f f (, = = f (, V ). Implici ummaion noaion: e ued in an arihmeic formula repreen a um over he elemen of he e. Example flow conervaion: f (u, V) = f(u, = 0 for all u V {, }. More definiion f (X, Y) = u X v Y f(u, Lemma: More properie of flow. If X doe no conain nor, hen f (X, V) = 0 Proof: f (X, V) = u X f(u,v) = u X 0. X u V v Y. If,B are dijoin e of verice, and X i anoher e, hen f ( B, X) = f(,x) +f(b,x) X B Noe (propery *): f(,x) = f ( B, X) - f(b,x) nd more properie of flow Lemma ( Propery #): For every e X of verice f (X,X)=0 Proof: f(x,x)= u X v X f(u,, and if f(u, appear in he ummaion, hen f(u) alo appear in he ummaion, and f(u) = -f(u,. Simple properie of flow Recall: f =f(,v)= v X f(, Theorem. f = f (V, ). Proof. f = f (, V) = f (V, V) f (V, V) (Propery *) = f (V, V ) (Propery #) = f (V, ) + f (V, V ) (Cae ) = f (V, ). (Cae )
Flow ino he ink : : -: 0: : : : : -: : : f = f (, V) = 4 f (V, ) = 4 Cu Definiion. cu (S, T) of a flow nework G =(V, E) i a pariion of V uch ha S and T. If f i a flow on G, hen he flow acro he cu i f (S, T). : : -: 0: : : : : 0: S={,a} f (S, T) = ( + ) + ( + + ) = 4 a : : S T noher characerizaion of flow value Recall: f =f(,v)= f(, Lemma. For any flow f and any cu (S, T), we have f = f (S, T). Proof. f (S, T) = f (S, V) f (S, S) (propery *) = f (S, V) = f (, V) + f (S, V) = f (, V) = f. : Capaciy of a cu Definiion. The capaciy of a cu (S, T) i c(s, T) = u S v T c(u, : : : S 0: 0: : 0: T : : c(s, T) = ( + ) + ( + + ) = : Upper bound on he maximum flow value Theorem. The value of any flow no larger han he capaciy of any cu: f c(s,t). Max-flow, min-cu heorem Theorem. The following are equivalen:. f = c(s, T) for ome cu (S, T).. f i a maximum flow.. f admi no augmening pah. min-cu Proof. f = f ( S, T) = f ( u, u S v T u S v T = c( S, T ). c( u, Proof. () (): Since f c(s, T) for any cu (S, T) (by he heorem from a few lide back), he aumpion ha f = c(s, T) implie ha f i a maximum flow. () (): If here were an augmening pah, he flow value could be increaed, conradicing he maximaliy of f.
() (): Define S = {v V here exi a pah in G f from o v}, Le T = V S. Since f admi no augmening pah, here i no pah from o in G f. Hence, S and S, So Τ. Thu (S, T) i a cu. Conider any verice u S and v T. pah in G f S T Conider u S, v T. We mu have c f (u, = 0, ince if c f (u, > 0, hen v S, no v T a aumed. Thu, f (u, = c(u,, ince c f (u, = c(u, f (u,. Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G f wr f exi do augmen f by c f (p) Can be low: 0 0 0 0 Summing over all u S and v T yield f (S, T) = c(s, T), and ince f = f (S, T), he heorem follow. Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: 0:0 0:0 0: Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: 0:0 0:0 0: 0:0 0:0 0:0 0:0 Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 0:0 : Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 0:0 : 0:0 :0 0:0 :0
Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 :0 0: Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 :0 0: :0 :0 :0 :0 Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Runime: Le f* be he value of a maximum flow, and aume i i an inegral value. The iniializaion ake O( E ) There are a mo f* ieraion of he loop Find an augmening pah wih DFS in O( V + E ) ime Each augmenaion ake O( V ) ime O( E f* ) in oal Ford-Fulkeron and maching Recall we expreed he maximum maching problem a a nework flow, bu we can expre he max flow a a maching, only if he flow i an ineger flow. However, hi i alway he cae once uing F&F algorihm: The flow along each edge i eiher 0 or. G : : 0: 0: 0: 0: B :. Runime analyi of F&F-algorihm applied for maching We aw ha in each ieraion of F&F algorihm, f increae by a lea. Le f* be he maximum value. How large can f* be? Claim: f* min{, B } (why?) Runime i O( E min{, B } )=O( E V ) Can be done in O( E / V ) (Dinic lgorihm) Edmond-Karp algorihm Edmond and Karp noiced ha many people implemenaion of Ford-Fulkeron augmen along a breadh-fir augmening pah: a pah wih malle number of edge in G f from o. Thee implemenaion would alway run relaively fa. Since a breadh-fir augmening pah can be found in O( E ) ime, heir analyi, focue on bounding he number of flow augmenaion. (In independen work, Dinic alo gave polynomial-ime bound.)
Running ime of Edmond-Karp One can how ha he number of flow augmenaion (i.e., he number of ieraion of he while loop) i O( V E ). Breadh-fir earch run in O( E ) ime ll oher bookkeeping i O( V ) per augmenaion. The Edmond-Karp maximum-flow algorihm run in O( V E ) ime. Be o dae The aympoically fae algorihm o dae for maximum flow, due o King, Rao, and Tarjan, run in O(V E log E/(V lg V) V) ime. If we allow running ime a a funcion of edge weigh, he fae algorihm for maximum flow, due o Goldberg and Rao, run in ime O(min{V /, E / } E lg (V /E + ) lg C), where C i he maximum capaciy of any edge in he graph.