Today: Max Flow Proof COSC 58, Algorihm March 4, 04 Many of hee lide are adaped from everal online ource
Reading Aignmen Today cla: Chaper 6 Reading aignmen for nex cla: Chaper 7 (Amorized analyi)
In-Cla Exercie # Find he maximum flow in he following flow nework: v v v v 4 5 7 v 5 v 6
In-Cla Exercie # Find he maximum flow in he following flow nework: Wha doe reidual graph look like (a he beginning) afer updaing flow from v v? v v v v 5 4 7 v 5 v 6
In-Cla Exercie # Find he maximum flow in he following flow nework: Wha doe reidual graph look like (a he beginning) afer updaing flow along augmening pah from v v? v v v v v v 5 4 v v 5 4 7 7 v 5 v 6 Wha happened o diance from o v? v 5 v 6
In-Cla Exercie # Find he maximum flow in he following flow nework: Wha doe reidual graph look like (a he beginning) afer updaing flow along augmening pah from v v? v v v v v v 5 4 v v 5 4 7 7 v 5 v 6 v 5 v 6 Wha happened o diance from o v? I increaed by a lea a diance of. (Remember hi for nex proof!)
Edmond Karp = Ford-Fulkeron Mehod implemened o elec hore augmening pah Take hore pah (in erm of number of edge) a an augmening pah Edmond-Karp algorihm How do we find uch a hore pah? Running ime O(VE ), becaue he number of augmenaion i O(VE) To prove hi we need o prove ha: The lengh of he hore pah doe no decreae Each edge can become criical a mo ~ V/ ime. Edge (u,v) on an augmening pah p i criical if i ha he minimum reidual capaciy in he pah: c f (u,v) = c f (p)
Non-decreaing hore pah Why doe he lengh of a hore pah from o any v doe no decreae? Obervaion: Augmenaion may add ome edge o reidual nework or remove ome. Only he added edge ( horcu ) may poenially decreae he lengh of a hore pah. Le uppoe (,,v) i he hore decreaedlengh pah and le derive a conradicion
Number of augmenaion Why doe each edge become criical a mo ~V/ ime? Scenario for edge (u,v), for u, v {, }: Criical he fir ime: (u,v) on an augmening pah Diappear from he nework Reappear on he nework: (v,u) ha o be on an augmening pah We can how ha in beween hee even he diance from o u increaed by a lea. Thi can happen a mo V/ ime, becaue he diance from o u can never be more han V - Since here are E pair of verice wih edge in reidual nework, he oal # of criical edge during alg. execuion i O(VE) (i.e., O(VE) ieraion). Each ieraion require E work o find hore pah. Thu, we have proved ha he running ime of Edmond- Karp i O(VE ).
Defining Flow, Capaciy Acro Cu If f i a flow, hen he ne flow f(s,t) acro he cu (S,T) i defined o be: f S, T = f u, v f(v, u) u S v T The capaciy of he cu (S,T) i: u S v T c S, T = c u, v u S v T Example: 0/5 a 8/ b /9 Flow acro hi cu? 6/4 /4 c 0 9 8/ d 5/5 / Capaciy of hi cu?
Defining Flow, Capaciy Acro Cu If f i a flow, hen he ne flow f(s,t) acro he cu (S,T) i defined o be: f S, T = f u, v f(v, u) u S v T The capaciy of he cu (S,T) i: u S v T c S, T = c u, v u S v T Example: 0/5 a 8/ b /9 Flow acro hi cu? 6 6/4 /4 c 0 9 8/ d 5/5 / Capaciy of hi cu?
Defining Flow, Capaciy Acro Cu If f i a flow, hen he ne flow f(s,t) acro he cu (S,T) i defined o be: f S, T = f u, v f(v, u) u S v T The capaciy of he cu (S,T) i: u S v T c S, T = c u, v u S v T Example: 0/5 a 8/ b /9 Flow acro hi cu? 6 6/4 /4 c 0 9 8/ d 5/5 / Capaciy of hi cu?
Proving Max Flow Weak dualiy lemma: Le f be any flow, and le (S, T) be any - cu. Then he value of he flow i a mo he capaciy of he cu. Cu capaciy = 0 Flow value 0 9 5 0 4 5 5 0 5 8 6 0 S 5 4 6 5 0 4 0 7 Capaciy = 0
Flow and Cu Weak dualiy lemma: Le f be any flow. Then, for any - cu (S, T) we have f = f(s,t) cap(s, T). Proof: f = = e ou of S e ou of S e ou of S f ( e) f ( e) c( e) cap( S, T ) e ino S f ( e) S 4/8 T 6/7
Cerificae of Opimaliy Corollary: Le f be any flow, and le (S, T) be any cu. If f = cap(s, T), hen f i a max flow and (S, T) i a min cu. Value of flow = 8 Cu capaciy = 8 Flow value 8 9/9 5 0/0 0/4 /5 0/5 9/0 4/5 8/8 6 9/0 S 0/4 4/6 0/5 0/0 4/5 4 4/0 7
Max-Flow Min-Cu Theorem Augmening pah heorem: Flow f i a max flow iff here are no augmening pah. Max-flow min-cu heorem: [Ford-Fulkeron 956] The value of he max flow i equal o he value of he min cu. Proof raegy: We prove boh imulaneouly by howing he following are equal: (i) There exi a cu (S, T) uch ha f = cap(s, T). (ii) Flow f i a max flow. (iii) There i no augmening pah relaive o f. (i) (ii) Thi wa he corollary o weak dualiy lemma. (ii) (iii) We how conrapoiive. Le f be a flow. If here exi an augmening pah, hen we can improve f by ending flow along pah.
(iii) (i) Proof of Max-Flow Min-Cu Theorem Le f be a flow wih no augmening pah. Le A be e of verice reachable from in reidual graph. By definiion of S, S. By definiion of f, S. S T f = = = e ou of S e ou of S f ( e) c( e) cap( S, T ) e ino S f ( e) original nework
In-Cla Exercie # You are given a andard flow nework G = (V, E) wih ource and ink, in which each edge (u, v) E ha a poiive inegral capaciy c(u, v). We define an edge in hi flow nework o be eniive if i croe ome minimum cu (S, T) of he nework. We define an edge in hi flow nework o be auraed if i flow equal i capaciy. Are all auraed edge alo (necearily) eniive? Explain your anwer.
In-Cla Exercie # Updaing Maximum Flow: Le G = (V, E) be a flow nework wih ource, ink, and ineger capaciie. Suppoe ha we are given a maximum flow in G, and he capaciy of a ingle edge (u, v) E i decreaed by. Give an O(V + E)-ime algorihm o updae he maximum flow.
Reading Aignmen Reading aignmen for nex cla: Chaper 7 (Amorized analyi)