CS 445 Flow Nework lon Efr Slide corey of Chrle Leieron wih mll chnge by Crol Wenk Flow nework Definiion. flow nework i direced grph G = (V, E) wih wo diingihed erice: orce nd ink. Ech edge (, ) E h nonnegie cpciy c(, ). If (, ) E, hen c(, ) = 0. Exmple: 3 3 2 3 2 3 2 3 2 Flow nework Definiion. poiie flow on G i fncion p : V V R ifying he following: Cpciy conrin: For ll, V, 0 p(, ) c(, ). Flow conerion: For ll V {, }, p (, ) p(, ) = 0. V V The le of flow i he ne flow o of he orce: p (, ) p(, ). V V
poiie flow flow on nework cpciy :3 0: :3 :2 :2 Flow conerion Flow ino i 2 + = 3. Flow o of i 0 + + 2 = 3. The le of hi flow i 0 + 2 = 3. The mximm-flow problem Mximm-flow problem: Gien flow nework G, find flow of mximm le on G. 0: 0:3 :2 3:3 The le of he mximm flow i 4. pplicion: Biprie Mching. B grph G(V,E) i clled biprie if V cn be priioned ino wo e V= B, nd ech edge of E connec erex of o erex of B. mching i e of edge M of E, where ech erex of i djcen o mo one erex of B, nd ice er.
Mching nd flow problem 0: dd erex, nd connec i o ech erex of. dd erex, nd connec ech erex of B o. The cpciy of ll edge i. Find mx flow. me i i n ineger flow, o he flow of ech edge i eiher 0 or. Ech edge of G h crrie flow i in he mching. Ech edge of G h doe no crry flow i no in he mching. Clim: The edge beween nd B h crry flow form mching. B Greedy i bopiml. 0: 0: 0: 0: B me we he lredy ome edge in (pril ) mching M. In order o incree he crdinliy of he mching we migh need o fir remoe from M ome edge (omehow coneriniie?) Thinking gin bo he mching flow problem, i men h we migh need o remoe flow from edge h crrenly crry flow. Flow cncellion Wiho lo of generliy, poiie flow goe eiher from o, or from o, b no boh. :2 :3 0:2 Ne flow from o in boh ce i. The cpciy conrin nd flow conerion re preered by hi rnformion.
noionl implificion IDE: Work wih he ne flow beween wo erice, rher hn wih he poiie flow. Definiion. (ne) flow on G i fncion f : V V R ifying he following: Cpciy conrin: For ll, V, f (, ) c(, ). Flow conerion: For ll V {, }, f (, ) = 0. V Skew ymmery: For ll, V, f (, ) = f (, ). Skew ymmery: Eqilence of definiion Ne flow. poiie flow. Theorem. The wo definiion re eqilen. Proof. ( ) Le f (, ) = p(, ) p(, ). Cpciy conrin: Since p(, ) c(, ) nd p(, ) 0, we he f (, ) c(, ). Flow conerion: f (, ) = ( p (, ) - p (, )) V V = p (, ) - p (, ) V V In priclr, if V {, }, hen f (, )=0 V f (, ) = p(, ) p(, ) = (p(, ) p(, )) = f (, ). Proof (conined) Obining he poiie flow from he ne flow ( ) Define p(, ) = f (, ) if f(, ) > 0, 0 if f(, ) 0. Cpciy conrin: By definiion, p(, ) 0. Since f (, ) c(, ), i follow h p(, ) c(, ). Flow conerion: If f (, ) > 0, hen f (, ) < 0 o p(,)=0. p(, ) p(, ) = f (, ). If f (, ) 0, hen p(, ) p(, ) = f (, ) = f (, ) by kew ymmery. Therefore, V V p (, ) p(, ) = f (, ) V
Reidl nework Definiion. Le f be flow on G = (V, E). reidl cpciie c f (, ) = c(, ) f (, ) The reidl nework G f (V, E f ), nd, E f re ll edge whoe reidl cpciy >0 Exmple: G f : 4 0:4 Lemm. E E f 2 E. Recll f (, ) = p(, ) p(, ). 4:4 :4 4 3 gmening ph Definiion. ny ph from o in G f i n gmening ph in G wih repec o f. I h boleneck c f (p):=min{ c f (,) (,) on p } The flow le cn be increed long n gmening ph p by dding c f (p) o he ne flow of ech edge long p. Thi i clled ph gmenion. I incree f by c f (p). 0:5 0:6 0:2 0:0 0: b c d Sr wih δ=0, δ:5 δ:6 δ:2 δ:0 δ: lowly incree b c d when δ=0, 5 6 2 0 G f : b c d c f (p) = fer gmenion :5 :6 :2 0 b c d gmening ph-more ccrely Definiion. ny ph p from o in G f i n gmening ph in G wih repec o f. c f (p):=min{ c f (,) (,) p } (,) p e f(,) += c f (p) ; f(,) -= c f (p) Thi i clled ph gmenion. Exmple: 3:5 2:6 7:2 b 2 4 5 G f : b c f (p) = 2 3 2 7 fer gmenion 5:5 4:6 9:2 b Noe flow conerion i preered.
gmening ph noher exmple Definiion. ny ph p from o in G f i n gmening ph in G wih repec o f. c f (p):=min{ c f (,) (,) p } (,) p e f(,) += c f (p) ; f(,) -= c f (p) Thi i clled ph gmenion. (No ll edge of nework re hown) 3:5 2:6-5:2 2:5 b c d 5:5 c f (p) = 2 G f : fer gmenion 2 3 5:5 4 7 2 b c 2 4:6-3:2 b 3:5 c 0:3 d d 3 2 4:5 f =0 Ford-Flkeron mx-flow lgorihm Sr: f [, ] 0 for ll, V While () { conrc G f if n gmening ph p in G f exi hen gmen f by c f (p) //ny ph wold do ele exi } 0:0 0:0 0: G f : 0:0 0:0 0 0:0 c f (p)= 0 0 G f : 0 0:0 0 f = 0 0 9 0 9 G f : 0 G f : G f: c f (p)= 9 0 9 9 9 9 9 8 9 2 8 9 2 0 0 0: f =2 0 0 2:0 0 0 2:0 f =3 2:0 2:0 0: f =4 2:0 2:0
noher exmple - Mching Sr from hi biprie grph b 2 b 2 B Cree hi nework flow problem f =0 0: 0: b 0: G : 0: 0: 0: 0: 2 b 2 B Reidl nework b G f : 2 b 2 Find ph p. G : G f: G : Mching Con f = b 0: 0: 0: 0: 2 b 2 B. b 2 b 2 B. 0: b 2 b 2 f =2 Correcne of FF lgorihm We will nex how h when FF-lgorihm ermine, i i bece i h fond mximm flow. The proof lo proide ddiionl informion bo he nework (wi for i)
C Definiion. c (S, T) of flow nework G =(V, E) i priion of V ino wo e S, T, ch h S nd T. 0: 0:3 :3 0:2 S T 3:3 C Definiion. c (S, T) of flow nework G =(V, E) i priion of V ino wo e S, T, ch h S nd T. 0: 0:3 :3 0:2 3:3 S T More exmpl of c. (, V,- ) (V-, ) Flow cro c Definiion. If f i flow on G, hen he flow cro he c, denoed f (S, T) = S T f(,) 0: 0:3 :3 0:2 S T 3:3 S={,} f (S, T) = (2 + 2) + ( 2 + + 2) = 4
noher chrcerizion of flow le Recll: f =f(,v)= V f(,) Lemm. For ny flow f nd ny c (S, T), we he f = f (S, T). Proof. Omied Mening h yo don need o know he proof, b yo do need o know hi lemm Conclion: The flow ino he ink eql he flow from he orce f(,v)=f(v.) Flow ino he ink 0: 0:3 :3 -:2 3:3 f = f (, V) = 4 f (V, ) = 4 Cpciy of c Definiion. The cpciy of c (S, T) i c(s, T)= S T c(,) S 0: 0:3 :3 0:2 T 3:3 c(s, T) = (3 + 2) + ( + 2 + 3) =
Upper bond on he mximm flow le Theorem. The le of ny flow no lrger hn he cpciy of ny c: f c(s,t). Proof: Recll h for he flow f o be legi, we m he f(,) c(,) for eery pir of erice (,). Hence f = f ( S, T ). = f (, ) S T S T = c( S, T ) c(, ) Mx-flow, min-c heorem Theorem. The following re eqilen:. f = c(s, T) for ome c (S, T). 2. f i mximm flow. 3. f dmi no gmening ph. Proof. () (2): Since f c(s, T) for ny c (S, T) (by he heorem from few lide bck), he mpion h f = c(s, T) implie h f i mximm flow. (2) (3): If here were n gmening ph, he flow le cold be increed, conrdicing he mximliy of f. (3) (): Define S = { V here exi ph in G f from o }, Le T = V S. Since f dmi no gmening ph, here i no ph from o in G f. Hence, S nd S, So Τ. Th (S, T) i c. Conider ny erice S nd T. ph in G f S T Conider S, T. We m he c f (, ) = 0, ince if c f (, ) > 0, hen S, no T med. Th, f (, ) = c(, ), ince c f (, ) = c(, ) f (, ). Smming oer ll S nd T yield f (S, T) = c(s, T), nd ince f = f (S, T), he heorem follow.
Noe h hi proof i conrcie I find c which form boleneck (noe h here migh be oher boleneck c) If we decree he cpciy of NY edge long hi c, i wold decree he mx flow. The Theorem lo implie h FF lgorihm i rel in mx flow. Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G f wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0:0 9 0:0 9 0: 0:0 9 0:0 9
Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0:0 9 0:0 9 0: 0:0 9 0:0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0:0 9 0:0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0:0 9 0:0 9 0 9
Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0: 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Cn be low: 0 9 0 9 0: 0 9 0 9 Ford-Flkeron mx-flow lgorihm lgorihm: f [, ] 0 for ll, V while n gmening ph p in G wr f exi do gmen f by c f (p) Rnime: Le f* be he le of mximm flow, nd me i i n inegrl le. The iniilizion ke O( E ) There re mo f* ierion of he loop Find n gmening ph wih DFS in O( V + E ) ime Ech gmenion ke O( V ) ime O( E f* ) in ol
Ford-Flkeron nd mching Recll we expreed he mximm mching problem nework flow, b we cn expre he mx flow mching, only if he flow i n ineger flow. Howeer, hi i lwy he ce once ing F&F lgorihm: The flow long ech edge i eiher 0 or. G : 0: 0: 0: 0: B. Rnime nlyi of F&F-lgorihm pplied o biprie mching We w h in ech ierion of F&F lgorihm, f incree by le. Le f* be he mximm le. How lrge cn f* be? Clim: f* min{, B } (why?) Rnime i O( E min{, B } )=O( E V ) Cn be done in O( E /2 V ) (Dinic lgorihm) Edmond-Krp lgorihm Edmond nd Krp noiced h mny people implemenion of Ford-Flkeron gmen long bredh-fir gmening ph: ph wih mlle nmber of edge in G f from o. Thee implemenion wold lwy rn reliely f. Since bredh-fir gmening ph cn be fond in O( E ) ime, heir nlyi, foce on bonding he nmber of flow gmenion. (In independen work, Dinic lo ge polynomil-ime bond.)
Rnning ime of Edmond-Krp One cn how h he nmber of flow gmenion (i.e., he nmber of ierion of he while loop) i O( V E ). Bredh-fir erch rn in O( E ) ime ll oher bookkeeping i O( V ) per gmenion. The Edmond-Krp mximm-flow lgorihm rn in O( V E 2 ) ime. Be o de The ympoiclly fe lgorihm o de for mximm flow, de o King, Ro, nd Trjn, rn in O(V E log E/(V lg V) V) ime. If we llow rnning ime fncion of edge weigh, he fe lgorihm for mximm flow, de o Goldberg nd Ro, rn in ime O(min{V 2/3, E /2 } E lg (V 2 /E + 2) lg C), where C i he mximm cpciy of ny edge in he grph.