Algorihm Deign Technique CS : Nework Flow Dan Sheldon April, reedy Divide and Conquer Dynamic Programming Nework Flow Comparion Nework Flow Previou opic: deign echnique reedy Divide and Conquer Dynamic Programming Nework flow: pecific cla of problem wih many applicaion Formulae problem??? Deign algorihm eay hard hard Prove correcne hard eay eay Analyze running ime eay hard eay Where doe nework flow fi in? Nework Flow Previou opic: deign echnique Nework flow: pecific cla of problem wih many applicaion Direc applicaion: commodiie in nework whea/rail nework packe/inerne waer/pipe Nework Flow Previou opic: deign echnique Nework flow: pecific cla of problem wih many applicaion Direc applicaion: commodiie in nework whea/rail nework packe/inerne waer/pipe ndirec applicaion: Maching in biparie graph Airline cheduling Baeball eliminaion
Nework Flow Fir, a Sory Abou Flow and Cu Key heme: flow in a newwork are inimiaely relaed o cu Previou opic: deign echnique Nework flow: pecific cla of problem wih many applicaion Direc applicaion: commodiie in nework Sovie rail nework in whea/rail nework packe/inerne waer/pipe ndirec applicaion: Maching in biparie graph Airline cheduling Baeball eliminaion Plan: deign and analyze algorihm for max-flow problem, hen apply o olve oher problem On he hiory of he ranporaion and maximum flow problem. Alexander Schrijver, Mah Programming,. Example Defining Flow Example/definiion on board Moivaing example Flow nework ource Flow Direced graph Source, arge Edge capaciie c(e) capaciy Flow f (e) on each edge Repec capaciy and flow conervaion Value v(f ) ink Max flow problem: find a flow of maximum value Flow Nework flow = ource Flow value = flow = ink ource ink
Flow value = flow = ource Maximum Flow Problem Find - flow of maximum value. value = ink flow = ource Deigning a Max-Flow Algorihm dea (fale ar): repeaedly chooe pah and augmen flow on hoe pah unil we can no longer do o Board work Explore hi idea See where i ge uck nroduce and define reidual graph f Forward edge Backward edge Augmening pah Boleneck edge Ford-Fulkeron Algorihm ink Augmening Pah Revied dea: ue pah in he reidual graph o augmen flow Augmen flow f on pah P in f Augmen(f, P ) Le b = boleneck(p, f ). lea reidual capaciy in P for edge e = (u, v) in P do if e i a forward edge hen f (e) = f (e) + b. increae flow on forward edge ele f (e) = f (e) b. decreae flow on backward edge end if end for Example on board Ford-Fulkeron Algorihm Repeaedly find augmening pah in he reidual graph and ue hem o augmen flow! Repeaedly find augmening pah in he reidual graph and ue hem o augmen flow! Ford-Fulkeron(,, ). niially, no flow niialize f (e) = for all edge e niialize f = Ford-Fulkeron(,, ). niially, no flow niialize f (e) = for all edge e niialize f =. Augmen flow a long a i i poible while here exi an - pah P in f do f = Augmen(f, P ) updae f end while reurn f
Ford-Fulkeron Example Example : Toy example on board Flow value = Example Example f Flow value = f Flow value = Example Example f Flow value = f Flow value =
Example Example f Flow value = Ford-Fulkeron Analyi Sep : argue ha F-F reurn a flow Sep : analyze erminaion and running ime Sep : argue ha F-F reurn a maximum flow Sep : F-F reurn a flow Sep : F-F reurn a flow Claim: Le f be a flow and le f = Augmen(f, P ). Then f i a flow. max flow = f Proof idea. Verify wo condiion for f o be a flow Sep : F-F reurn a flow Claim: Le f be a flow and le f = Augmen(f, P ). Then f i a flow. Claim: Le f be a flow and le f = Augmen(f, P ). Then f i a flow. Proof idea. Verify wo condiion for f o be a flow Proof idea. Verify wo condiion for f o be a flow f aifie capaciy conrain f aifie capaciy conrain f aifie flow conervaion f aifie flow conervaion Example and proof kech on board
Sep : Terminaion and Running Time Sep : Terminaion and Running Time Aumpion: all capaciie are ineger. Then, by naure of F-F, all flow value and reidual capaciie remain ineger during he algorihm. Aumpion: all capaciie are ineger. Then, by naure of F-F, all flow value and reidual capaciie remain ineger during he algorihm. Claim: F-F erminae in a mo v(f) ieraion, where f i he reurned flow. Proof? Sep : Terminaion and Running Time Sep : Terminaion and Running Time Aumpion: all capaciie are ineger. Then, by naure of F-F, all flow value and reidual capaciie remain ineger during he algorihm. Claim: F-F erminae in a mo v(f) ieraion, where f i he reurned flow. Proof? Running ime: Le C be he oal capaciy of edge leaving ource Then v(f) apple C. So F-F erminae in a mo C ieraion Aumpion: all capaciie are ineger. Then, by naure of F-F, all flow value and reidual capaciie remain ineger during he algorihm. Claim: F-F erminae in a mo v(f) ieraion, where f i he reurned flow. Proof? Running ime: Le C be he oal capaciy of edge leaving ource Then v(f) apple C. So F-F erminae in a mo C ieraion Running ime per ieraion? Sep : Terminaion and Running Time Sep : F-F reurn a maximum flow Aumpion: all capaciie are ineger. Then, by naure of F-F, all flow value and reidual capaciie remain ineger during he algorihm. Claim: F-F erminae in a mo v(f) ieraion, where f i he reurned flow. Proof? Running ime: Le C be he oal capaciy of edge leaving ource Then v(f) apple C. So F-F erminae in a mo C ieraion We will prove hi by eablihing a deep connecion beween flow and cu in graph: he max-flow min-cu heorem. Board work: cu definiion - cu (A, B) Capaciy c(a, B) Example Running ime per ieraion? O(m + n) o find an augmening pah
Flow Value Lemma Corollary: Cu and Flow Fir relaionhip beween cu and flow Lemma: lef be any flow and (A, B) be any - cu. Then Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. v(f) = e ou of A e ino A Proof and picure on board Corollary: Cu and Flow Corollary: Cu and Flow Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. Proof: Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. Proof: v(f) = e ou of A e ino A Corollary: Cu and Flow Corollary: Cu and Flow Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. Proof: v(f) = apple e ou of A e ou of A e ino A Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. Proof: v(f) = apple apple e ou of A e ou of A c(e) e ou of A e ino A
Corollary: Cu and Flow Dualiy Really imporan corollary of flow-value lemma Corollary: Lef be any - flow and le (A, B) be any - cu. Proof: v(f) = apple apple e ou of A e ou of A e ou of A = c(a, B) c(e) e ino A lluraion on board (leave up). Dualiy Dualiy F-F reurn a maximum flow lluraion on board (leave up). Dualiy Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)... Claim f here i a flow f and cu (A,B ) uch ha v(f )=c(a,b ),hen f i a maximum flow (A,B ) i a minimum cu F-F reurn a maximum flow F-F reurn a maximum flow Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue:
F-F reurn a maximum flow F-F reurn a maximum flow Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue: v(f )=C(A,B ) Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue: v(f )=C(A,B ) f i a maximum flow F-F reurn a maximum flow F-F reurn a maximum flow Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue: v(f )=C(A,B ) f i a maximum flow (A,B ) i a minimum cu Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue: v(f )=C(A,B ) f i a maximum flow (A,B ) i a minimum cu Corollary: F-Freurnamaximumflow. F-F reurn a maximum flow Max-Flow Min-Cu Theorem Claim: Suppoe f i an - flow uch ha here are no reidual pah in f (e.g., he flow reurned by F-F)...... and le (A,B ) be he - cu where A coni of all node reachable from in he reidual graph. Then he following are rue: v(f )=C(A,B ) f i a maximum flow (A,B ) i a minimum cu Theorem: in every flow nework, he value of he maximum - flow i equal o he value of he minimum - cu. Proof? Corollary: F-Freurnamaximumflow. Prove claim on board
Max-Flow Min-Cu Theorem Max-Flow Min-Cu Theorem Theorem: in every flow nework, he value of he maximum - flow i equal o he value of he minimum - cu. Proof? For any flow nework, run F-F o ge a maximum flow f and minimum-cu (A,B ) uch ha v(f )=c(a,b ).