Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.

Similar presentations


Presentation on theme: "CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow."— Presentation transcript:

1 CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow

2 Outline Network flow definitions Flow examples Augmenting Paths Residual Graph Ford Fulkerson Algorithm Cuts Maxflow-MinCut Theorem

3 Network Flow Definitions Flowgraph: Directed graph with distinguished vertices s (source) and t (sink) Capacities on the edges, c(e) >= 0 Problem, assign flows f(e) to the edges such that: –0 <= f(e) <= c(e) –Flow is conserved at vertices other than s and t Flow conservation: flow going into a vertex equals the flow going out –The flow leaving the source is a large as possible

4 Flow Example a s d b cf e g h i t 20 5 55 5 5 10 20 5 5 5 5 10 30

5 Find a maximum flow Student Submission a s d b cf e g h i t 25 5 20 30 20 55 5 5 10 20 5 10 5 20 5 5 30

6 Find a maximum flow a s d b cf e g h i t 25 5 20 30 20 55 5 5 10 20 5 10 5 20 5 5 30

7 Augmenting Path Algorithm Augmenting path –Vertices v 1,v 2,…,v k v 1 = s, v k = t Possible to add b units of flow between v j and v j+1 for j = 1 … k-1 u st v 10/20 15/20 10/30 0/10 5/10

8 Find two augmenting paths Student Submission st 2/5 0/1 3/4 3/3 2/4 1/3 3/3 2/2 3/4 1/3 3/3 2/2 3/3 1/3 2/2 1/3

9 Residual Graph Flow graph showing the remaining capacity Flow graph G, Residual Graph G R –G: edge e from u to v with capacity c and flow f –G R : edge e’ from u to v with capacity c – f –G R : edge e’’ from v to u with capacity f

10 Residual Graph u st v 15/20 20/20 15/30 0/10 5/10 u st v 5 15 10 520 15 5

11 Build the residual graph Student Submission s d e g h t 3/5 2/4 3/3 1/5 1/1 2/2 2/5

12 Augmenting Path Lemma Let P = v 1, v 2, …, v k be a path from s to t with minimum capacity b in the residual graph. b units of flow can be added along the path P in the flow graph. u st v 15/20 20/20 15/30 0/10 5/10


Download ppt "CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow."

Similar presentations


Ads by Google