Mx-flow nd min-cu
Mx-Flow nd Min-Cu Two imporn lgorihmic prolem, which yield euiful duliy Myrid of non-rivil pplicion, i ply n imporn role in he opimizion of mny prolem: Nework conneciviy, irline chedule (exended o ll men of rnporion), imge egmenion, iprie mching, diriued compuing, d mining,
Flow Nework Nework digrph G = (V, E).. i h ource verex V ink verex V edge cpciie c : E R + {0} Flow f : V V R + {0}.. Kirchoff lw: (u, v) E, 0 f (u, v) c(u, v), (Flow conervion) v V {, }, u V f (u, v) = z V f (v, z) The vlue of flow f = v V f (, v) = f (, V ) = f (V, ). / / / / / Vlue f =3
The Mximum flow prolem INPUT: Given flow nework (G = (V, E),,, c) QUESTION: Find flow of mximum vlue on G. S / / A /5 C / 0/9 / B / 5/5 D E 0/3 / 5/5 T The vlue of he mx-flow i 7 = + + = 5 +. Noice: Alhough he flow exiing i no mximum, he flow going ino i mximum (= mx. cpciy). Therefore he ol flow i mximum.
The cu Given (G = (V, E),,, c) cu i priion of V = S T o S T = ), wih S nd T. The flow cro he cu: f (S) = u S v T f (u, v) v S u T f (v, u). The cpciy of he cu: c(s) = u S v T f (u, v) cpciy of cu (S, T ) = um of weigh leving S. Noice ecue of he cpciy conrin: f (S) c(s) / / /5 c / 0/9 / / 5/5 d e 0/3 / 5/5 S = {,c,d} T={,,e,} c(s,t)=(+5+5)+(3+)=9 f(s,t)=(++5)+(0+ )=7
The cu Given (G = (V, E),,, c) cu i priion of V = S T o S T = ), wih S nd T. The flow cro he cu: f (S) = u S v T f (u, v) v S u T f (v, u). The cpciy of he cu: c(s) = u S v T f (u, v) Noice ecue of he cpciy conrin: f (S) c(s) / / /5 c / 0/9 / / 5/5 d e 0/3 / 5/5 S = {,c,} T={d,,e,} c(s,t)=+5+5= f(s,t)=++5 =7
Noion Given v G nd cu (S, T ) nd v S, le S = S {v}. Then Denoe f (S, T ) flow eween S nd T (wihou ping y v), i.e. f (S, T ) = u S w T f (u, w) w T u S f (w, u) wih (u, w) E nd (u, w) E, denoe f (v, T ) flow v T i.e. f (v, T ) = u T f (v, u), denoe f (T, v) flow T v i.e. f (T, v) = u T f (u, v), denoe f (S, v) flow S v i.e. f (S, v) = u S f (u, v), denoe f (v, S ) flow v S i.e. f (v, S ) = u S f (v, u), S T S v
Any cu h he me flow Theorem Given (G,,, c) he flow hrough ny cu (S, T ) i f (S) = f. Proof (Inducion on S ) If S = {} hen f (S) = f. Aume i i rue for S = S {v}, i.e. f (S ) = f. Noice f (S ) = f (S, T ) + f (S, v) f (v, S ). Moreover from he flow conervion, f (S, v) + f (T, v) = f (v, S ) + f (v, T ) f (v, T ) f (T, v) = f (S, v) f (v, S ) }{{} Then f (S) = f (S, T ) + f (v, T ) f (T, v), uing ( ) f (S) = f (S ) = f S T S v
Reidul nework Given nework (G = (V, E),,, c) ogeher wih flow f on i, he reidul nework, (G f = (V, E f ), c f ) i he nework wih he me verex e nd edge e: if c(u, v) f (u, v) > 0 hen (u, v) E f nd c f (u, v) = c(u, v) f (u, v) > 0 (forwrd edge), nd if f (u, v) > 0 hen (v, u) E f nd c f (v, u) = f (u, v) (ckwrd edge). i.e. here re f (u, v) uni of flow we cn undo, y puhing flow ckwrd he c f re denoed reidul cpciy. / 0/ 0/ /3 / Gf
Reidul nework: Augmening ph Given G = (V, E) nd flow f on G, n ugmening ph P i ny imple ph in G f (uing forwrd nd ckwrd edge, u P : ). Given f : in G nd P in G f define he oleneck (P, f ) o e he minimum reidul cpciy of ny edge in P, wih repec o f. Gf P: doed line f / / /3 / / G f
Reidul nework: Augmening ph Given G = (V, E) nd flow f on G, n ugmening ph P i ny imple ph in G f. Given f in G nd P in G f define he oleneck (P, f ) o e he minimum reidul cpciy of ny edge in P. Augmen(P, f ) =oleneck (P, f ) for ech (u, v) P do if (u, v) i forwrd edge in G hen Incree f (u, v) in G y ele Decree f (u, v) in G y end if end for reurn f f / / /3 / /
Reidul nework: Augmening ph Lemm Conider f =Augmen(P, f ), hen f i flow in G. Proof: We hve o prove h () e E, 0 f (e) c(e) nd h v flow o v = flow ou of v. Cpciy lw Forwrd edge (u, v) P we incree f (u, v) y, c(u, v) f (u, v) hen f (u, v) = f (u, v) + c(u, v). Bckwrd edge (u, v) P we decree f (v, u) y, f (v, u), f (v, u) = f (u, v) 0. Conervion lw, v P given edge e, e in P nd inciden o v, i i ey o check he ce ed wheher e, e re forwrd or ckwrd edge.
Mx-Flow Min-Cu heorem Theorem For ny (G,,, c) he vlue of he mx flow f i equl o he cpciy of he min -cu (over ll cu in G) Thi i ypicl exmple of LP duliy! Proof: For ny cu (S, T ) in G f (S) c(s, T ). Suppoe y hypohei h f in G i mx flow, i.e. f h no ugmening ph, hen G f h no ph. Le S = {v V v in G f }, noice S nd moreover (S, V {S }) i cu in G f v S, u V {S } we hve no reidul edge in he cu, o h in G f (v, u) = c(v, u), nd herefore c(s, V {S }) = f (S, V {S }) in G. A ny mx-flow mu e min-cu, hen in priculr (S, V {S }) i min-cu in G nd i i equl o he mx-flow f.
Ford-Fulkeron lgorihm L.R. Ford, D.R. Fulkeron: Mximl flow hrough nework. Cndin J. of Mh. 956. Ford-Fulkeron(G,,, c) for ll (u, v) E le f (u, v) = 0 G f = G while here i n ph in G f do find imple ph P in G f (ue DFS) f = Augmen(f, P) Upde f o f Upde G f o G f end while reurn f 0/0 0/30 G 0/0 f=0 0/0 0/5 0 30 G f 0 P 0 5
Ford-Fulkeron lgorihm L.R. Ford, D.R. Fulkeron: Mximl flow hrough nework. Cndin J. of Mh. 956. Ford-Fulkeron(G,,, c) for ll (u, v) E le f (u, v) = 0 G f = G while here i n ph in G f do find imple ph P in G f (ue DFS) f = Augmen(f, P) Upde f o f Upde G f o G f end while reurn f G G f 0/0 0/30 0/0 0/0 0/5 0 0 0 0 0 5 P f=0
Ford-Fulkeron lgorihm L.R. Ford, D.R. Fulkeron: Mximl flow hrough nework. Cndin J. of Mh. 956. Ford-Fulkeron(G,,, c) for ll (u, v) E le f (u, v) = 0 G f = G while here i n ph in G f do find imple ph P in G f (ue DFS) f = Augmen(f, P) Upde f o f Upde G f o G f end while reurn f G G f 0/0 0/30 0/0 5/0 5/5 0 0 5 0 0 5 5 P f=5
Ford-Fulkeron lgorihm L.R. Ford, D.R. Fulkeron: Mximl flow hrough nework. Cndin J. of Mh. 956. Ford-Fulkeron(G,,, c) for ll (u, v) E le f (u, v) = 0 G f = G while here i n ph in G f do find imple ph P in G f (ue DFS) f = Augmen(f, P) Upde f o f Upde G f o G f end while reurn f G G f 0/0 5/30 0/0 f=30 0/0 5/5 0 5 5 0 5 No P 5 5
Anlyi of Ford Fulkeron We re conidering nework h iniil flow nd cpciie re ineger, Lemm (Inegrliy invrin) A every ierion of he Ford-Fulkeron lgorihm, he flow vlue f (e) nd he reidul cpciie in G f re ineger. Proof: (inducion) The emen i rue efore he while loop. Inducive Hypohei: The emen i rue fer j ierion. ierion j + : A ll reidul cpciie in G f re ineger, hen oleneck (P, f ) Z, for he ugmening ph found in ierion j +. Thu he flow f will hve ineger vlue o will he cpciie in he new reidul grph.
Inegrliy heorem Theorem (Inegrliy heorem) There exi mx-flow f for which every flow vlue f i n ineger. Proof: Since he lgorihm ermine, he heorem follow from he inegrliy invrin lemm. Noice he inegrliy heorem doen y h every mx-flow i ineger vlued, i only y le one mx-flow h he propery of eing ineger vlued.
Anlyi of Ford Fulkeron Lemm If f i flow in G nd f i he flow fer n ugmenion, hen f < f. Proof: Le P e he ugmening ph in G f. The fir edge e P leve, nd G h no incoming edge o, e i forwrd edge. Moreover P i imple never reurn o. Therefore, he vlue of he flow incree in edge e.
Correcne of Ford-Fulkeron Conequence of he Mx-flow min-cu heorem. Theorem The flow reurned y Ford-Fulkeron f i he mx-flow. Proof: For ny flow f nd cu (S, T ) we hve f c(s, T ). The flow f i uch h f = c(s, T ), for ome cu (S, T ) f i he mx-cu. Therefore, for ny (G,,, c) he vlue of he mx flow i equl o he cpciy of he minimum cu.
Anlyi of Ford Fulkeron: Running ime Lemm Le C e he minimum cu vlue, Ford-Fulkeron ermine fer finding mo C ugmening ph. Proof: The vlue of he flow incree y fer ech ugmenion. The numer of ierion i C. A ech ierion: We hve o modify G f, wih E(G f ) m, o ime O(m). Uing DFS, he ime o find n ugmening ph P i O(n + m) Tol running ime i O(C(n + m)) = O(Cm) I h polynomic?
Running ime of Ford-Fulkeron The numer of ierion of Ford-Fulkeron could e Ω(C) A i i decried Ford-Fulkeron cn lerne C ime eween he lue nd red ph if he figure. /C /C / / /C /C C=000000000 000 million iercion in G wih verice!! Recll peudopolynomil lgorihm i n lgorihm h i polynomil in he unry encoding of he inpu. So he complexiy of Ford-Fulkeron lgorihm i equivlen o he PD Algorihm for 0- Knpck. I here polynomil ime lgorihm for he mx-flow prolem?
Edmond-Krp, Dinic lgorihm J.Edmond, R. Krp: Theoreicl improvemen in lgorihmic efficiency for nework flow prolem. Journl ACM 97. Y. Dinic: Algorihm for oluion of prolem of mximum flow in nework wih power eimion. Dokldy Ak.N. 970 Chooing good ugmening ph cn led o fer lgorihm. Ue BFS o find horer ugmening ph in G f. Uing BFS on G f we cn find he hore ugmening ph P in O(m), independenly of mx cpciy C.
Edmond-Krp lgorihm Ue BFS o find he ugmening ph ech G f wih fewer numer of edge. Edmond-Krp(G,,, c) For ll e = (u, v) E le f (u, v) = 0 G 0 = G while here i n ph in G f do P = BFS(G f,, ) f = Augmen(f, P) Upde G f = G f nd f = f end while reurn f C C C C The BFS in EK will chooe: or
Level grph Given G = (V, E),, define L G = (V, E G ) o e i he level grph y: l(v) = numer of edge in hore ph v in G, L G = (V, E G ) i he ugrph of G h conin only edge (v, w) E.. l(w) = l(v) +. Noice: Uing BFS we cn compue L G in O(n + m) Imporn propery: P i hore in G iff P i n ph in L G. G 5 d 9 3 5 c e 5 3 L G 5 d 5 c e 5 3
The working of he EK lgorihm /5 c e d 5 3 9 G f c e d 5 3 9 c e d / /5 /5 3 9 / /5 /5 / / G,f G,f c e d L c e d 3 9 G c e d L / /5 / 3 / / f / 3
The working of he EK lgorihm 5/5 c e d 3 / / / c e d 3 9 G c e d 3 f L f c e d 3 9 / / /5 /5 / / / /5 c e d 9 / /5 / /5 / / / /3 G,f G,f*
EK lgorihm: Properie Lemm Throughou he lgorihm, he lengh of he hore ph never decree. Proof: Le f nd f e he flow efore nd fer hore ph ugmenion le L nd L e he level grph of G f nd G f. Only ck edge dded o G f. Lemm Afer mo m hore ph ugmenion, he lengh of P i monooniclly increing. Proof: The oleneck edge i deleed from L fer ech ugmenion. No new edge i dded o L unil lengh of hore ph ricly incree
Complexiy of Edmond-Krp lgorihm Uing he he previou lemm, we prove Theorem The EK lgorihm run in O(m n) ep. Therefore i i rongly polynomil lgorihm. Proof: Need ime O(m + n) o find he ugmening ph uing BFS. Need O(m) ugmenion for ph of lengh k. Every ugmenion ph i imple k n O(nm) ugmenion
Finding min-cu Given (G,,, c) o find min-cu:. Compue he mx-flow f in G.. Oin G f. 3. Find he e S = {v V v} in G f.. Oupu he cu (S, V {S}) = {(v, u) v Sndu V {S}} in G. The running ime i he me hn he lgorihm o find he mx-flow. / / /5 c / 0/9 / / 5/5 d e 0/3 / 5/5 S c 9 5 d 3 e 5
The mx-flow prolem: Hiory Ford-Fulkeron (956) O(mC), where C i mx cpciy. Dinic (970) (locking flow) O(n m) Edmond-Krp (97) (hore ugmening ph) O(nm ) Krznov (97), O(n m) Golderg-Trjn (986) (puh re-lel preflow + dynmic ree) O(nm lg(n /m)) (for hi ime ui ue prllel implemenion) King-Ro-Trjn (998) O(nm log m/n lg n n). J. Orlin (03) O(nm) (clever follow up o KRT-98)
Mximum mching prolem Given n undireced grph G = (V, E) ue of edge M E i mching if ech node pper mo in one edge ( node my no pper ll). A perfec mching in G i mching M uch h M = V / The mximum mching prolem given grph G mching wih mximum crdinliy.
Mximum mching in grph iprie A grph G = (V, E) i id o e iprie if V cn e prie in L nd R, L R = V, L R =, uch h every e E connec L wih R. The mx mching iprie grph prolem: given iprie G = (L R, E) wih n verice find mximum mching. Mx mching =
Mximum mching: flow formulion Given iprie grph G = (L R, E) conruc Ĝ = ( ˆV, Ê): Add verice nd : ˆV = L R {, }. Add direced edge L wih cpciy. Add direced edge R wih cpciy. Direc he edge E from L o R, nd give hem cpciy. Ê = { L} E {R }.
Mximum mching: flow formulion Given iprie grph G = (L R, E) conruc Ĝ = ( ˆV, Ê): Add verice nd : ˆV = L R {, }. Add direced edge L wih cpciy. Add direced edge R wih cpciy. Direc he edge E from L o R, nd give hem cpciy. Ê = { L} E {R }.
Mximum mching: Anlyi Theorem Mx flow in Ĝ=Mx iprie mching in G. Proof Given mching M in G wih k-edge, conider he flow F h end uni long ech one of he k ph. f i flow nd h vlue k. 0 0
Mximum mching: Anlyi Mx flow Mx iprie mching If here i flow f in Ĝ, f = k, cpciie re Z n inegrl flow exii. Conider he cu C = ({} L, R {}) in Ĝ. Le F e he e of edge in C wih flow=, hen F = k. Ech node in L i in mo one e F nd every node in R i in mo one hed of n e F Therefore, exi iprie mching F in G wih F f 0 0
Dijoin ph prolem Given digrph (G = (V, E),, ), e of ph i edge-dijoin if heir edge re dijoin (lhough hem my go hrough ome of he me verice) The dijoin ph prolem given G,, find he mx numer of edge dijoin ph c e d
Dijoin ph prolem Given digrph (G = (V, E),, ), e of ph i edge-dijoin if heir edge re dijoin (lhough hem my go hrough ome of he me verice) The dijoin ph prolem given G,, find he mx numer of edge dijoin ph c e d
Dijoin ph prolem: Mx flow formulion Aign uni cpciy o every edge Theorem The mx numer of edge dijoin ph i equl o he mx flow vlue Mx flow=3 e d c e d c
Dijoin ph prolem: Proof of he Theorem Numer of dijoin ph mx flow If we hve k edge-dijoin ph in G hen mking f (e) = for ech e in ph, we ge flow = k Numer of dijoin ph mx flow If mx flow f = k 0- flow f wih vlue k k edge (, v).. f (, v) =, y flow conervion we cn exend o k ph, where ech edge i ph crrie flow =. If we hve n undireced grph, wih wo diinguied node u, v, how would you pply he mx flow formulion o olve he prolem of finding he mx numer of dijoin ph eween u nd?
Circulion wih demnd Given grph G = (V, E) wih cpciie c in he edge, uch h ech v V i ocie wih demnd d(v), where If d(v) > 0 v i ink, v cn receive d(v) uni of flow more hn i end. If d(v) < 0 v i ource, v cn end d(v) uni of flow more hn i receive. If d(v) = 0 hen v i neiher ource or ink. Le S e he e of ource nd T he e of ink. 3 3 3 3
Circulion wih demnd prolem Given G = (V, E) wih c 0 nd {d(v)} v V, define circulion funcion f : E R +... cpciy: For ech e E, 0 f (e) c(e),. conervion: For ech v V, f (u, v) 3 f (v, z) = d(v). / (u,v) E (v,z) E Circulion wih demnd feiiliy prolem: Given G = (V, E) wih c 0 nd {d(v)} v V, doe i exi feile circulion? Feile circulion: funcion f on G wih c 0 nd {d(v)} v V, uch h i ifie () nd ()? / 3 3 / / 3 /
Circulion wih demnd prolem Noice h if f i feile circulion, hen d(v) = f (u, v) v V v V (u,v) E }{{} edge o v (v,z) E f (v, z). } {{ } edge ou of v For ech e E we re couning wice f (e), hen v V d(v) = 0. And we hve, So If here i feile circulion wih demnd {d(v)} v V, hen d(v) = 0. v V Therefore S = {v V d(v) > 0} nd T = {v V d(v) < 0}, hen D = v S d(v) = v T d(v). / 3 / 3 3 / / 3 /
Circulion wih demnd: Mx-flow formulion Exend G = (V, E) o G = (V, E ) y Add new ource nd ink. For ech v S (d(v) < 0) dd (, v) wih cpciy d(v). For ech v T (d(v) > 0) dd (v, ) wih cpciy d(v). G 3 3 3 3 G 3 S 3 3 3 T 3 3
Anlyi.- Every flow f : in G mu e f D The cpciy c({}, V ) = D y mx-flow min-cu Thm. ny mx-flow f in G, f D..- If here i feile circulion f wih {d(v)} v V in G, hen we hve mx-flow f : in G wih f = D (, v) E, f (, v) = d(v) nd (u, ) E, f (u, ) = d(v). G / 3 3 / 3 / / 3 / G 3/ 3 3/ 3 3 / 3 / 3 3 / / / / /
Anlyi 3.- If here i flow f : in G wih f = D:. (, v) E nd (u, ) E mu e ured if we delee hee edge in G we oin circulion f in G.. f ifie d(v) = f (u, v) f (v, z). (u,v) E } {{ } edge o v (v,z) E } {{ } edge ou of v G / 3 3 / 3 / / 3 / G 3/ 3 3/ 3 3 / 3 / 3 3 / / / / /
Min reul Theorem (Circulion inegrliy heorem) If ll cpciie nd demnd re ineger, nd here exi circulion, hen here exi n ineger vlued circulion. Skech Proof Mx-flow formulion + inegrliy heorem for mx-flow From he previou dicuion, we cn conclude: Theorem (Necery nd ufficien condiion) There i feile circulion wih {d(v)} v V in G iff he mx-flow in G h vlue D.
Circulion wih demnd nd lower ound: Mx-flow formulion Generlizion of he previou prolem: eide ify demnd node, we wn o force he flow o ue cerin edge. Inroduce new conrin l(e) on ech e E, indicing he min-vlue he flow mu e on e. Given G = (V, E) wih c(e), c(e) l(e) 0, for ech e E nd {d(v)} v V, define circulion funcion f : E R +... cpciy: For ech e E, l(e) f (e) c(e),. conervion: For ech v V, f (u, v) f (v, z) = d(v). (u,v) E (v,z) E [,3] Circulion prolem wih lower ound: Given (G, c, l, {d(v)}), doe here exi feile circulion? 3 3 3
Circulion wih demnd nd lower ound: Mx-flow formulion Le (G = (V, E), c, l, d( )) e grph, conruc G = (V, E), c, d ), where for ech e = (u, v) E, wih l(e) > 0: c (e) = c(e) l(e) (en l(e) uni long e). Upde he demnd on oh end of e (d (u) = d(u) + l(e) nd d (v) = d(v) l(e)) [,3] 3 3 3 G 3 G 5
Min reul Theorem There exi circulion in G iff here exi circulion in G. Moreover, if ll demnd, cpciie nd lower ound in G re ineger, hen here i circulion in G h i ineger-vlued. Skech Proof Need o prove f (e) i circulion in G iff f (e) = f (e) l(e) i circulion in G. The ineger-vlued circulion pr i conequence of he ineger-vlue circulion Theorem for f in G.
Survey deign prolem Prolem:Deign urvey mong cuomer of produc Ech cuomer will receive queion ou ome produc. Ech cuomer i cn only e ked ou numer of produc eween c i nd c i ([c i, c i ]) which he h purched. For ech produc j we wn o collec de for minimum of p j diinc cuomer nd mximum of p j ([p i, p i ])
Survey deign prolem Formlly we wn o model he prolem : A iprie grph G = (C P, E), where C = {i} i he e of cuomer nd P = {i} i he e of produc. There i n (i, j) E i i h purched produc j. For ech i {,..., n} we we hve ound [c i, c i ] on he numer of produc i cn e ked ou. For ech j {,..., n} we we hve ound ([p i, p i ]) on he numer of cuomer h cn e ked ou i.
Survey deign prolem: Mx flow formulion 0, We conruc he grph G from G, y dding {, } nd edge {C} nd {P}. c,c i 0, 0, j p,p G h feile circulion iff here i feile wy o deign he urvey.
Pixel nd digil imge In digil imging, pixel i he mlle conrollle elemen of picure repreened on he creen. Digil imge re repreened y rer grphic imge, do mrix d rucure repreening recngulr grid of pixel, or poin of color The ddre of pixel correpond o i phyicl coordine.
Imge egmenion Given e of pixel clify ech pixel pr of he min ojec or pr of he ckground. Imporn prolem in differen echnique for imge proceing.
Foreground/ckground egmenion We im o lel ech pixel elonging o he foreground or he ckground Picure pixel grid of do. Define he undireced grph G = (V, E), where, V = e pixel in imge, E = pir of neighor of pixel (in he grid) For ech pixel i, i 0 i likelihood h i i in he foreground nd i 0 i likelihood h i i in he ckground. For ech (i, j) of neighoring pixel, here i eprion penly p ij 0 for plcing one in he foreground nd he oher in he ckground.
Foreground/ckground egmenion Gol: For i ioled, if i > i we prefer o lel i foreground (oherwie we lel i ckground) If mny neighor of i re leled foreground we prefer o lel i foreground. Thi mke he leling mooher y minimizing he moun of foreground/ckground We wn o priion V ino A (e of foreground pixel) nd B (e of ckground pixel), uch h we mximize he ojecive funcion: i + j p ij i A j B (i,j) E, A {i,j} =
Formule min-cu prolem Segmenion h he flvor of cu prolem, u i i mximizion differen hn he min-cu, G i undireced, i doe no hve ink nd ource. From mximizion o minimizion Le Q = i V ( i + i ), hen i A i + j B j = Q i A i + j B j, So mx( i A i + j B j (i,j) E, A {i,j} = p ij) i equivlen o min( i + j i A i + j B j + i V j B }{{} Θ() (i,j) E, A {i,j} = p ij) We wn min i A i + j B j + (i,j) E, A {i,j} = p ij.
Trnforming G ino n nework G We rnform G = (V, E) o G = (V, E ) y Add upper node repreening he foreground Add lower node repreening he ckground V = V {, } For ech (v, u) E cree niprllel direced edge (u, v) nd (v, u) in E For ech pixel i cree direced edge (, i) nd (i, ) E = {(, v) (v, )} v E {(u, v) (v, u)} (u,v) E
The undireced pixel grph G nd he digrph G G G
Adding cpciie o he edge of G For ech i V, c(, i) = i, c(i, ) = i For ech (i, j) E, c(i, j) = c(j, i) = p ij w p uw v u w p vu u x p wx v x w p xv v
Min-cu in G An cu (A, B ) correpond o priion of he pixel ino (A {}, B {}), where Edge (, j) wih j B conriue wih j o c(a, B ), edge (i, ) where i A conriue wih j o c(a, B ), edge (i, j) where i A nd j B conriue wih p ij o c(a, B ) Therefore, c(a, B ) = i A i + j B j + (i,j) E, A {i,j} = We wn o find he min vlue of he ove quniy, which i equivlen o find he min-cu (A; B) in G find he mx-flow in G. p ij p vu A v w u v u p xv x p uw w x v B p wx w
Concluion Min-Flow prolem i n inuiively ey prolem wih lo of pplicion. We ju preened few one. An lernive poin of view cn e oined from duliy in LP The meril in hi lk h een iclly oined from wo exook: Chper 6 of Cormen, Leieron, Rive, Sein: Inroducion o Algorihm, nd chper 7 of kleinerg, Trdo: Algorihm Deign.