Max-flow and min-cut

Similar documents
Max-flow and min-cut

Flow Networks Alon Efrat Slides courtesy of Charles Leiserson with small changes by Carola Wenk. Flow networks. Flow networks CS 445

5. Network flow. Network flow. Maximum flow problem. Ford-Fulkerson algorithm. Min-cost flow. Network flow 5-1

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

Maximum Flow. Flow Graph

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

Network Flows: Introduction & Maximum Flow

Matching. Slides designed by Kevin Wayne.

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

4/12/12. Applications of the Maxflow Problem 7.5 Bipartite Matching. Bipartite Matching. Bipartite Matching. Bipartite matching: the flow network

CSC 373: Algorithm Design and Analysis Lecture 9

Algorithmic Discrete Mathematics 6. Exercise Sheet

1 Motivation and Basic Definitions

Algorithm Design and Analysis

Graduate Algorithms CS F-18 Flow Networks

Randomized Perfect Bipartite Matching

Main Reference: Sections in CLRS.

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Algorithm Design and Analysis

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

ALG 5.3 Flow Algorithms:

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Maximum Flow and Minimum Cut

CSE 521: Design & Analysis of Algorithms I

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Soviet Rail Network, 1955

Greedy. I Divide and Conquer. I Dynamic Programming. I Network Flows. Network Flow. I Previous topics: design techniques

LAPLACE TRANSFORMS. 1. Basic transforms

Today s topics. CSE 421 Algorithms. Problem Reduction Examples. Problem Reduction. Undirected Network Flow. Bipartite Matching. Problem Reductions

1 The Network Flow Problem

Reminder: Flow Networks

Graphs III - Network Flow

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

Solutions to assignment 3

MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

Positive and negative solutions of a boundary value problem for a

Solving Evacuation Problems Efficiently. Earliest Arrival Flows with Multiple Sources

Flow Networks. Ma/CS 6a. Class 14: Flow Exercises

Soviet Rail Network, 1955

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

CSC 364S Notes University of Toronto, Spring, The networks we will consider are directed graphs, where each edge has associated with it

Network Flow. Data Structures and Algorithms Andrei Bulatov

CS 473G Lecture 15: Max-Flow Algorithms and Applications Fall 2005

4.8 Improper Integrals

Introduction to Congestion Games

graph of unit step function t

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

Network Flows UPCOPENCOURSEWARE number 34414

Maximum Flow in Planar Graphs

16 Max-Flow Algorithms and Applications

Today: Max Flow Proofs

Flow networks, flow, maximum flow. Some definitions. Edmonton. Saskatoon Winnipeg. Vancouver Regina. Calgary. 12/12 a.

( ) ( ) ( ) ( ) ( ) ( y )

18 Extensions of Maximum Flow

Network flows. The problem. c : V V! R + 0 [ f+1g. flow network G = (V, E, c), a source s and a sink t uv not in E implies c(u, v) = 0

Contraction Mapping Principle Approach to Differential Equations

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

ENGR 1990 Engineering Mathematics The Integral of a Function as a Function

Basic Tools CMSC 641. Running Time. Problem. Problem. Algorithmic Design Paradigms. lg (n!) (lg n)! (lg n) lgn n.2

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

0 for t < 0 1 for t > 0

CS3510 Design & Analysis of Algorithms Fall 2017 Section A. Test 3 Solutions. Instructor: Richard Peng In class, Wednesday, Nov 15, 2017

Average Case Lower Bounds for Monotone Switching Networks

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

They were originally developed for network problem [Dantzig, Ford, Fulkerson 1956]

Lecture 2: Network Flow. c 14

Minimum Squared Error

Minimum Squared Error

Some basic notation and terminology. Deterministic Finite Automata. COMP218: Decision, Computation and Language Note 1

Chapter 2: Evaluative Feedback

Fall 2014 David Wagner 10/31 Notes. The min-cut problem. Examples

3/3/2015. Chapter 7. Network Flow. Maximum Flow and Minimum Cut. Minimum Cut Problem

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Maximum Flow. Contents. Max Flow Network. Maximum Flow and Minimum Cut

e t dt e t dt = lim e t dt T (1 e T ) = 1

Optimality of Myopic Policy for a Class of Monotone Affine Restless Multi-Armed Bandit

Maximum Flow. How do we transport the maximum amount data from source to sink? Some of these slides are adapted from Lecture Notes of Kevin Wayne.

Introduction to SLE Lecture Notes

Please Complete Course Survey. CMPSCI 311: Introduction to Algorithms. Approximation Algorithms. Coping With NP-Completeness. Greedy Vertex Cover

arxiv: v1 [cs.cg] 21 Mar 2013

can be viewed as a generalized product, and one for which the product of f and g. That is, does

Mathematics 805 Final Examination Answers

6.8 Laplace Transform: General Formulas

Transformations. Ordered set of numbers: (1,2,3,4) Example: (x,y,z) coordinates of pt in space. Vectors

INTEGRALS. Exercise 1. Let f : [a, b] R be bounded, and let P and Q be partitions of [a, b]. Prove that if P Q then U(P ) U(Q) and L(P ) L(Q).

Wrap up: Weighted, directed graph shortest path Minimum Spanning Tree. Feb 25, 2019 CSCI211 - Sprenkle

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

Graph Theory: Network Flow

Motion. Part 2: Constant Acceleration. Acceleration. October Lab Physics. Ms. Levine 1. Acceleration. Acceleration. Units for Acceleration.

Laplace Transform. Inverse Laplace Transform. e st f(t)dt. (2)

Price Discrimination

Price of Stability and Introduction to Mechanism Design

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

The solution is often represented as a vector: 2xI + 4X2 + 2X3 + 4X4 + 2X5 = 4 2xI + 4X2 + 3X3 + 3X4 + 3X5 = 4. 3xI + 6X2 + 6X3 + 3X4 + 6X5 = 6.

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

1. Find a basis for the row space of each of the following matrices. Your basis should consist of rows of the original matrix.

26.1 Flow networks. f (u,v) = 0.

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

Some Inequalities variations on a common theme Lecture I, UL 2007

Transcription:

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 (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 c(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 (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 c(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 going 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. Noice, if c(u, v) = f (u, v) hen here i only ckwrd edge. 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 (S, T )-cu (over ll cu in G) f = mx{ f } = min {c(s, T )}. (S,T ) Proof: For ny cu (S, T ) in G f (S) c(s, T ). If f in G i mx flow hen G f h no ugmening ph o i i diconneced. Le S = {v V v in G f }, hen (S, V {S }) i cu in G f v S, u V {S }, ( v, u) i no reidul edge, o in G f (v, u) = c(v, u), i.e. c(s, V {S }) = f (S, V {S }) in G. In priculr (S, V {S }) i min-cu in G nd = 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.

Corollry: 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.

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-flow. 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 min cu cpciy (=mx. flow 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. 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 polynomil ime 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 Noice v V d(v) = 0, o we hve, (v,z) E f (v, z). } {{ } edge ou of v 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}, we cn define 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 j, p j ])

Survey deign prolem Meuring cuomer ifcion. 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 j, p j ]) on he numer of cuomer h cn e ked ou i.

Survey deign prolem: Biprie grph G G C c d P 3 5 Cuomer C={,,c,d} Produc P={,,3,,5,6} Cuomer c d Buy,,, 3,6 3,,5,6 :[,] :[,3] c:[,] d:[,] : [,] : [,] 3: [,] : [,] 5: [0,] 6: [,] 6

Survey deign prolem: Mx flow formulion We conruc G from G, y dding: Edge: {C}, {P}, nd (, ). c,c i Cpciie: c(, ) = c(i, j) =, c(, i) = [c i, c i ], c(j, ) = [p j, p j ]. 0, Noice if f i he flow: f (i, j) = cuomer i i ked ou produc j, f (, i) # produc o k cuomer i for opinion, f (j, ) = # cuomer o e ked o review produc j, f (, ) i he numer of queion ked. 0, 0, j p,p

Mx flow formulion: Exmple 0 [,] [,3] 3 [,] [,3] 3 c d 3 5 [,] [,] [,] [,] [,] [0,] c d,,, 3,6 3,,5,6 :[,] :[,3] c:[,] d:[,3] : [,] : [,] 3: [,] : [,] 5: [0,] 6: [,] 6

Min reul Theorem G h feile circulion iff here i feile wy o deign he urvey. Proof if here i feile wy o deign he urvey: if i i ked ou j hen f (i, j) =, f (, i) = numer queion ked o i, f (j, ) = numer of cuomer who were ked ou j, f (, ) = ol numer of queion. ey o verify h f i feile in G If here i n inegrl, feile circulion in G : if f (i, j) = hen i will e ked ou j, he conrin (c i, c i, p j, p j ) will e ified.

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 Recll we wn o mx( i + j p ij ) i A j B (i,j) E, A {i,j} = }{{} ( ) Le Q = i V ( i + i ) = i + j, hen i V j V }{{} Θ() i A i + j B j = Q ( i A i + j B j) So, ( ) Q ( i A i j B j) (i,j) E, A {i,j} = p ij Therefore, mx( ) = 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 Mx-Flow/ Min-Cu 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.