Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS4234 Optimiz(s)ation Algorithms

Similar presentations


Presentation on theme: "CS4234 Optimiz(s)ation Algorithms"— Presentation transcript:

1 CS4234 Optimiz(s)ation Algorithms
v1.0: Seth Gilbert v1.1: Steven Halim CS4234 Optimiz(s)ation Algorithms L5 – Max-Flow/Min-Cut They are Primal-Dual LPs

2 Types of Graph Problems (so far)
0. Connectivity: How is my network connected? P: (Strongly) Connected Component , 1. Distances: How to get from here to there? P: Single-Source Shortest Paths, P: All-Pairs Shortest Paths 2. Spanning Trees: How do I design a network? P: Min-Spanning-Tree, NP-hard: Steiner-Tee NP-hard: Travelling-Salesman, 3. Network Flows: How is my network connected? Our topic today (A TSP cycle – an edge = An SP tree) Not all graph problems are in P Not all graph problems are NP-hard Not all optimization problems are graph problems

3 Roadmap Network Flows Definition Ford-Fulkerson Algorithm
Max-Flow/Min-Cut Theorem

4 Network Flow Problems Examples: Transportation problems
Network attacks problems (Bipartite) Matching and Assignment problems Distributed network reliability Project selection Image segmentation Sport’s teams prospects 2016 status: Last three: Steven has not tried 2017 status: only project selection and sports team have not been tried

5 Network Flow (1/6) Input: directed graph G = (V, E)
edge capacities c(e) source s destination/ target/sink t A 9 D 10 10 4 15 15 5 10 s B 8 E t 15 15 4 6 10 C 16 F capacity c(e) > 0

6 Network Flow (2/6) Output: Flow Assignment of flow f to each edge
2/9 A D 1/10 7/10 3/4 2/15 1/15 Example: capacity is 10: “c(e) = 10” flow is 7: “f(e) = 7” s 5/5 B 5/8 4/10 E t 0/15 4/4 1/6 4/15 7/10 C 4/16 F flow / capacity

7 Network Flow (3/6) Output: Flow
Flow is not negative: For every edge e, 0 ≤ f(e) Flow ≤ capacity: For every edge e, f(e) ≤ c(e) 2/9 A D 1/10 7/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 C 4/16 F flow / capacity

8 Network Flow (4/6) Equilibrium constraint:
For every vertex: Flow-in = Flow-out Except s and t 2/9 A D 1/10 7/10 3/4 2/15 1/15 Flow-in=5+2+1=8 s 5/5 5/8 4/10 B E t Flow-out=4+4=8 0/15 4/4 1/6 4/15 7/10 C 4/16 F

9 Network Flow (5/6) Output: st-flow
Capacity constraint (never exceed capacity) Equilibrium constraint (Flow-in = Flow-out) 2/9 A D 1/10 7/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

10 Network Flow (6/6) Uni-directional flow: st-flow
If f(u, v) > 0 and f(v, u) > 0, then they cancel out. Flows only go in one direction. 2/5 0/5 7/9 5/9

11 Value of a Flow (1/2) How much stuff gets from s to t?
How much leaves source? How much gets to target? 2/9 A D 1/10 7/10 3/4 2/15 1/15 7+4+1=12 7+5=12 s 5/5 5/8 4/10 B E t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

12 Value of a Flow (2/2) Definition: For a flow f: s t 7+4+1=12 7+5=12
2/9 A D 1/10 7/10 3/4 2/15 1/15 7+4+1=12 7+5=12 s 5/5 5/8 4/10 B E t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

13 Max Flow (1/2) Goal: Find an st-flow with maximum value. s t
2/9 A D 1/10 7/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 value = 12 (not maximum yet) C 4/16 F

14 Max Flow (2/2) Goal: Find an st-flow with maximum value.
Can be written as Linear Program (T04) 9/9 A D 9/10 10/10 0/4 1/15 0/15 5/5 9/10 s B 8/8 E t 13/15 0/4 3/6 0/15 10/10 value = 28 maximum C 13/16 F

15 Roadmap Network Flows Definition Ford-Fulkerson Algorithm
Max-Flow/Min-Cut Theorem

16 (you can also try other flow graphs)
Ford-Fulkerson (1/12) Initially: All flows are 0. Watch the animation live in VisuAlgo (chosen augmenting paths may be slightly different but the final answer is the same, max flow = 28) (you can also try other flow graphs) 0/9 A D 0/10 0/10 0/4 0/15 0/15 s 0/5 0/10 B 0/8 E t 0/15 0/4 0/6 0/15 0/10 value = 0 C 0/16 F

17 Ford-Fulkerson (2/12) Idea: Find an augmenting path (path from s to t that goes through edges with positive weight residual capacity (c(e)-f(e)) left) along which we can increase the flow. 0/9 A D 0/10 0/10 0/4 0/15 0/15 0/5 0/10 s B 0/8 E t 0/15 0/4 0/6 0/15 0/10 value = 0 C 0/16 F

18 Ford-Fulkerson (3/12) Augmenting path: Directed path from source s  sink t Can increase flow on all forward edges. First augmenting path s-A-E-t (+10) bottleneck 0/9 A D 0/10 10/10 0/4 10/15 0/15 s 0/5 10/10 B 0/8 E t 0/15 0/4 0/6 0/15 0/10 value = C 0/16 F

19 Ford-Fulkerson (4/12) Augmenting path: Directed path from source s  sink t Can increase flow on all forward edges. Second augmenting path s-C-F-t (+10) 0/9 A D 0/10 10/10 0/4 10/15 0/15 0/5 10/10 s B 0/8 E t 10/15 0/4 0/6 0/15 10/10 value = C 10/16 F

20 Ford-Fulkerson (5/12) Augmenting path: Directed path from source s  sink t Can increase flow on all forward edges. No more augmenting paths? Is max flow value = 20? 0/9 A D 0/10 10/10 0/4 10/15 0/15 0/5 10/10 s B 0/8 E t 10/15 0/4 0/6 0/15 10/10 value = C 10/16 F

21 Ford-Fulkerson (6/12) Augmenting path: Directed path from source s  sink t Can increase flow on all forward edges. Third augmenting path s-B-E-A-D-t? (details TBA) No edge from EA? 0/9 A D 0/10 10/10 0/4 10/15 0/15 0/5 10/10 s B 0/8 E t 10/15 0/4 0/6 0/15 10/10 value = C 10/16 F

22 Ford-Fulkerson (7/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) Third augmenting path s-B-E-A-D-t (+5) 5/9 A D 5/10 10/10 0/4 (10-5)/15 0/15 5/5 10/10 s B 5/8 E t 10/15 0/4 0/6 0/15 10/10 value = C 10/16 F

23 Ford-Fulkerson (8/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) Fourth augmenting path s-C-F-B-E-A-D-t (+3) 5+3/9 A D 5+3/10 10/10 0/4 (10-5-3)/15 0/15 5/5 10/10 s B 5+3/8 E t 10+3/15 0/4 0+3/6 0/15 10/10 C 10+3/16 F value = = 28

24 Ford-Fulkerson (9/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) No more augmenting paths? This time yes 8/9 A D 8/10 10/10 0/4 2/15 0/15 10/10 s 5/5 B 8/8 E t 13/15 0/4 3/6 0/15 10/10 C 13/16 F value = 28 No more augmenting paths.

25 Ford-Fulkerson (10/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) 8/9 A D saturated 8/10 10/10 0/4 2/15 0/15 s 5/5 B 8/8 10/10 E t 13/15 0/4 3/6 0/15 10/10 C 13/16 F value = 28 saturated

26 Ford-Fulkerson (11/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) 8/9 A D saturated 10/10 0/4 8/10 2/15 0/15 5/5 8/8 10/10 s B E t 0/15 s-component = {s,B,C,F} (details later) 13/15 0/4 3/6 10/10 C 13/16 F value = 28 saturated

27 Ford-Fulkerson (12/12) Augmenting path: Undirected path from source s  sink t Can increase flow on all forward edges OR Can decrease flow on backward edges (details TBA) 8/9 A D empty 10/10 0/4 8/10 2/15 0/15 5/5 8/8 10/10 s B E t 0/15 s-component = {s,B,C,F} (details later) 13/15 0/4 3/6 10/10 C 13/16 F value = 28 empty

28 Ford-Fulkerson (Basic Idea)
Ford-Fulkerson Algorithm Start with 0 flow. While there exists an augmenting path: // iterative algorithm Find an augmenting path. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity. There are still a few missing details: How to find an augmenting path? Does Ford-Fulkerson always terminate? How fast? If it terminates, does it always find a max-flow?

29 Initial graph: flow = 0  residual = capacity.
Finding an Augmenting Path (1/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 4 15 15 5 10 s B 8 E t 15 4 6 15 10 C 16 F Initial graph: flow = 0  residual = capacity.

30 Step 1: augmenting path s-A-E-t of flow 10.
Finding an Augmenting Path (2/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10-10 4 15-10 15 5 10-10 s B 8 E t 15 4 6 15 10 C 16 F Step 1: augmenting path s-A-E-t of flow 10.

31 After augmenting path s-A-E-t of flow 10.
Finding an Augmenting Path (3/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 4 5 15 5 s B 8 E t 15 4 6 15 10 C 16 F After augmenting path s-A-E-t of flow 10.

32 How best to find an augmenting path in the residual graph?
For now, any O(V+E) graph traversal algorithm will do (BFS, DFS, etc.) Any path from st in the residual graph is an augmenting path. 30 of 60

33 Step 2: augmenting path s-C-F-t of flow 10.
Finding an Augmenting Path (4/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 4 5 15 5 s B 8 E t 15-10 4 6 15 10-10 C 16-10 F Step 2: augmenting path s-C-F-t of flow 10.

34 After step 2: augmenting path s-C-F-t of flow 10… stuck?
Finding an Augmenting Path (5/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 4 5 15 5 s B 8 E t 5 4 6 15 C 6 F After step 2: augmenting path s-C-F-t of flow 10… stuck?

35 Finding an Augmenting Path (6/15)
Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 4 15 15 5 8 10 s B E t 4 6 15 10 15 C 16 F To simplify the algorithm: We add edges in both direction in residual graph.

36 Finding an Augmenting Path (7/15)
Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10-10 0+10 10 0+10 4 15-10 15 5 8 10-10 s B E t 0+10 4 6 15 10 15 C 16 F Augmenting path 1: s-A-E-t (+10): Residual flow in the other direction.

37 Finding an Augmenting Path (8/15)
Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 10 4 5 15 5 8 s B E t 10 4 6 15 10 15 C 16 F Augmenting path 1: s-A-E-t (+10): Residual flow in the other direction.

38 Augmenting path 2: s-C-F-t (+10)
Finding an Augmenting Path (9/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 10 4 5 15 5 8 s B E t 10 4 6 15 10 15 C 16 F Augmenting path 2: s-C-F-t (+10)

39 Augmenting path 2: s-C-F-t (+10)
Finding an Augmenting Path (10/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 10 4 5 15 5 8 s B E t 10 4 6 15 10 5 10 C 6 F 10 Augmenting path 2: s-C-F-t (+10)

40 Augmenting path 3: s-B-E-A-D-t (+5)
Finding an Augmenting Path (11/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 9 A D 10 10 10 4 5 15 5 8 s B E t 10 4 6 15 10 5 10 C 6 F 10 Augmenting path 3: s-B-E-A-D-t (+5)

41 Augmenting path 3: s-B-E-A-D-t (+5)
Finding an Augmenting Path (12/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 5 4 A D 5 5 10 5 10 4 15 s 3 B E t 5 5 10 4 6 15 10 5 10 C 6 F 10 Augmenting path 3: s-B-E-A-D-t (+5)

42 Augmenting path 4: s-C-F-B-E-A-D-t (+3)
Finding an Augmenting Path (13/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 5 4 A D 5 5 10 5 10 4 15 s 3 B E t 5 5 10 4 6 15 10 5 10 C 6 F 10 Augmenting path 4: s-C-F-B-E-A-D-t (+3)

43 Augmenting path 4: s-C-F-B-E-A-D-t (+3)
Finding an Augmenting Path (14/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 8 1 A D 8 2 13 2 10 4 15 s B E t 5 8 10 4 3 15 13 2 3 10 C 3 F 13 Augmenting path 4: s-C-F-B-E-A-D-t (+3)

44 No more augmenting path, Forward flow = Reverse residual flow.
Finding an Augmenting Path (15/15) Residual Graph: Amount that flow can be increased residual(e) = capacity(e) – flow(e) 8 1 A D 8 2 13 2 10 4 15 s B E t 5 8 10 4 3 15 13 2 3 10 C 3 F 13 No more augmenting path, Forward flow = Reverse residual flow.

45 Ford-Fulkerson (More Complete)
Ford-Fulkerson Algorithm Start with 0 flow. Build residual graph: For every edge (u,v) add edge (u,v) with w(u,v) = capacity. For every edge (u,v) add (a new) edge (v,u) with w(v,u) = 0. While there exists an augmenting path: Find an augmenting path via DFS in residual graph. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity: For every edge (u,v) on the path, subtract the flow from w(u,v). For every edge (u,v) on the path, add the flow to w(v,u). Compute final flow by inverting residual flows. Be careful of potential bug here

46 Ford-Fulkerson Details: How to find an augmenting path?
Ford-Fulkerson Algorithm Start with 0 flow. While there exists an augmenting path: Find an augmenting path. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity. Details: How to find an augmenting path? Does Ford-Fulkerson always terminate? How fast? If it terminates, does it always find a max-flow?

47 Roadmap Network Flows Definition Ford-Fulkerson Algorithm
Max-Flow/Min-Cut Theorem

48 One possible st-cut, set S = blue, set T = green
Cuts and Flows – Definition (1/4) Definition: An st-cut partitions the vertices of a graph into two disjoint sets S and T where source s  S and sink t  T. PS: Hard to see the colors in b/w print… >< A 9 D 10 10 4 15 15 s 5 B 8 E 10 t 15 15 4 6 10 C 16 F One possible st-cut, set S = blue, set T = green

49 Another possible st-cut, set S = blue, set T = green
Cuts and Flows – Definition (2/4) Definition: An st-cut partitions the vertices of a graph into two disjoint sets S and T where source s  S and sink t  T. A s C F E B t D 10 5 15 4 9 6 16 8 Another possible st-cut, set S = blue, set T = green

50 Capacity of this st-cut = 48
Cuts and Flows – Definition (3/4) Definition: The capacity of an st-cut is the sum of the capacities of the edges that cross the cut from S to T. A 9 D 10 10 4 15 15 s 5 10 B 8 E t 15 15 4 6 10 C 16 F Capacity of this st-cut = 48

51 What is the capacity of this st-cut?
9 D 10 10 4 15 15 s 5 10 B 8 E t 15 15 4 6 10 C 16 F Capacity of this st-cut = 45 29 of 60

52 Cuts and Flows – Definition (4/4)
The net flow across an st-cut is the sum of the flows on edges from ST minus the flows from TS. A 5/9 D 10 10 4 3/15 15 s 5 10 B 4/8 E t 15 15 4 5/6 10 Capacity = 48 Net flow = 9 C 2/16 F

53 Cuts and Flows – Equal (1/4)
Proposition: Let f be a flow, and let (S,T) be an st-cut. Then the net flow across (S,T) equals the value of f. A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F Value of flow = 12

54 Cuts and Flows – Equal (2/4)
Proposition: Let f be a flow, and let (S,T) be an st-cut. Then the net flow across (S,T) equals the value of f. A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F Flow across cut = 12 Value of flow = 12

55 Cuts and Flows – Equal (3/4)
Proposition: Let f be a flow, and let (S,T) be an st-cut. Then the net flow across (S,T) equals the value of f. A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F Flow across cut = 12 Value of flow = 12

56 Cuts and Flows – Equal (4/4)
Proposition: Let f be a flow, and let (S,T) be an st-cut. Then the net flow across (S,T) equals the value of f. A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F Flow across cut = 12 Value of flow = 12

57 Cuts and Flows – Equal Proof (1/5)
Proof: (by induction) Start with S = {source s}, T = V \ S. Define F = flow across cut. 2/9 A D 7/10 1/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 F = 12 4/16 C F

58 Cuts and Flows – Equal Proof (2/5)
Inductive step: Take one node X that is reachable from S and add it to S. Add new outgoing edges that cross new cut. Subtract new incoming edges that cross new cut. Subtract/add edges from A to S. 2/9 A D 7/10 1/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 F + ( ) – 7 = F 4/16 C F

59 Cuts and Flows – Equal Proof (3/5)
Inductive step: Conservation of flow: (Equilibrium constraint) Flow into A equals flow out of A. Flow that crossed (old S)A == A(old T) So F remains unchanged 2/9 A D 7/10 3/4 2/15 1/10 1/15 s 5/5 B 5/8 4/10 E t 0/15 4/4 1/6 4/15 7/10 F + ( ) – 7 = F 4/16 C F

60 Cuts and Flows – Equal Proof (4/5)
Proof: (by induction) Start with S = {source s}, T = V \ S. Define F = flow across cut. Move vertices one at a time from T to S. At every step, F remains unchanged. Thus for all cuts, flow is F. 2/9 A D 7/10 1/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 4/16 C F

61 Cuts and Flows – Equal Proof (5/5)
Proof: (by induction) What is F? Consider cut S = V \ {sink t}, T = {sink t}. All edges crossing the cut go to sink t. Value of flow = flow across cut = F. 2/9 A D 7/10 1/10 3/4 2/15 1/15 5/5 4/10 s B 5/8 E t 0/15 4/4 1/6 4/15 7/10 4/16 C F

62 Cuts and Flows – Weak Duality (1/2)
Let f be a flow, and let (S,T) be an st-cut. Then value(f)  capacity(S,T). A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

63 Cuts and Flows – Weak Duality (2/2)
Let f be a flow, and let (S,T) be an st-cut. Then value(f)  capacity(S,T). Proof: value(f) = flow across cut (S,T)  capacity(S,T). flow value proposition flow is bounded by the capacity

64 MaxFlow-MinCut Theorem
Let f be a maximum flow. Let (S,T) be an st-cut with minimum capacity. Then value(f) = capacity(S,T). A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

65 Augmenting Path Theorem
Flow f is a maximum flow if and only if there are no augmenting paths in the residual graph. A 2/9 D 1/10 7/10 3/4 2/15 1/15 s 5/5 B 5/8 E 4/10 t 0/15 4/4 1/6 4/15 7/10 C 4/16 F

66 Cuts and Flows – 3 Statements
Proof: The following three statements are equivalent for flow f: There exists a cut whose capacity equals the value of f. f is a maximum flow. There is no augmenting path with respect to f.

67 Cuts and Flows – Statement 12
1  2: There exists an f-capacity cut  f is maximum Assume (S,T) is a cut with capacity equal to f. For all flows g: value(g)  capacity(S,T) For all flows g: value(g)  value(f) f is a maximum flow weak duality

68 Cuts and Flows – Statement 23
2  3: f is maximum flow  no augmenting paths Assume there IS at least 1 more augmenting path: Improve flow by sending flow on augmenting path. Augmenting path has bottleneck capacity > 0. f was NOT a maximum flow. Contradiction.

69 Cuts and Flows – Statement 31 (1/4)
3  1: no augmenting paths  exists f-capacity cut Assume there is no augmenting path: Let S be the vertices reachable from the source in the residual graph. Let T be the remaining vertices, i.e. T = V \ S. A 9/9 D 9/10 10/10 0/4 1/15 0/15 s 5/5 B 8/8 E 9/10 t 13/15 0/15 0/4 3/6 10/10 C 13/16 F

70 Cuts and Flows – Statement 31 (2/4)
3  1: no augmenting paths  exists f-capacity cut Assume there is no augmenting path: Let S = reachable vertices. T = remaining vertices. S contains the source s and T contains the target/sink t. source s cannot reach sink t anymore Otherwise, if sink t was reachable from source s in the residual graph, there would be another augmenting path. A s C F E B t D 10/10 5/5 13/15 0/4 9/9 3/6 1/15 0/15 9/10 13/16 8/8

71 Cuts and Flows – Statement 31 (3/4)
3  1: no augmenting paths  exists f-capacity cut Assume there is no augmenting path: Let S = reachable vertices. T = remaining vertices. (S,T) is an st-cut. All edges from TS are empty. All edges from ST are saturated. A s C F E B t D 10/10 5/5 13/15 0/4 9/9 3/6 1/15 0/15 9/10 13/16 8/8 T->S empty: Otherwise, there would be an outgoing edge in the residual graph.

72 Cuts and Flows – Statement 31 (4/4)
3  1: no augmenting paths  exists f-capacity cut Assume there is no augmenting path: Let S = reachable vertices. T = remaining vertices. (S,T) is an st-cut. All edges from TS are empty. All edges from ST are saturated. value(f) = net flow across (S,T) = capacity of cut Notice  changed to = ST saturation TS empty flow value proposition

73 Summary Augmenting Path Theorem:
Flow f is a maximum flow if and only if there are no augmenting paths in the residual graph.  If Ford-Fulkerson terminates, then there is no augmenting path. Thus, the resulting flow is maximum.

74 Finding Min Cut (1/2) How to find a min-cut:
Run Ford-Fulkerson until termination. Let S be the set of vertices reachable from the source s: Run DFS in the residual graph. All the vertices reach are in S. For every edge in S, enumerate outgoing edges: If edge exits S, add to min-cut. If both ends of edge are in S, then continue.

75 Finding Min Cut (2/2) Finding a minimum cut:
Assume there is no augmenting path: Let S = reachable vertices. T = remaining vertices. (S,T) is an st-cut. Edges from (ST) are minimum cut. A s C F E B t D 10/10 5/5 13/15 0/4 9/9 3/6 1/15 0/15 9/10 13/16 8/8

76 Ford-Fulkerson (Yet More Details 1/3)
Ford-Fulkerson Algorithm Start with 0 flow. While there exists an augmenting path: Find an augmenting path. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity. Termination: Ford-Fulkerson always terminates. How to find an augmenting path? If it terminates, does it always find a max-flow? Does Ford-Fulkerson always terminate? How fast?

77 Ford-Fulkerson (Yet More Details 2/3)
Ford-Fulkerson Algorithm Start with 0 flow. While there exists an augmenting path: Find an augmenting path. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity. Termination: FF terminates if capacities are integers. Every iteration finds a new augmenting path. Each augmenting path has bottleneck capacity at least 1. So each iteration increases the flow of at least one edge by at least 1. Finite number of edges, finite max capacity per edge  termination.

78 Ford-Fulkerson (Yet More Details 3/3)
Ford-Fulkerson Algorithm Start with 0 flow. While there exists an augmenting path: Find an augmenting path. Compute bottleneck capacity. Increase flow on the path by the bottleneck capacity. Termination: Ford-Fulkerson always terminates. How to find an augmenting path? If it terminates, does it always find a max-flow? How fast does Ford-Fulkerson terminate? Can we do better? Next lecture…


Download ppt "CS4234 Optimiz(s)ation Algorithms"

Similar presentations


Ads by Google