Download presentation
Presentation is loading. Please wait.
2
Flows sourcesink s t
3
Flows sourcesink 5 2 4 2 3 4 7 2 edge-weights = capacities
4
Flows sourcesink 5 2 4 2 3 4 7 2 2 2 2 2 2 2 edge-weights = capacities 4 units of flow
5
Flows sourcesink 5 2 4 2 3 4 7 2 2 4 2 2 2 4 edge-weights = capacities 6 units of flow 2
6
Flows sourcesink 5 2 4 2 3 4 7 2 2 5 2 3 1 4 edge-weights = capacities 7 units of flow 3 1
7
Optimal? 5 2 4 2 3 4 7 2 2 5 2 3 1 4 3 1 a larger flow?
8
Cuts s C C V s C t V-C capacity of a cut cap(C)= c(u,v) u C v V-C for any cut and any flow flow cut max-flow min-cut
9
Flows 5 2 4 5 2 edge-weights = capacities 3 FLOW CONSERVATION
10
Skew symmetry 5 2 4 5 2 edge-weights = capacities 3 FLOW CONSERVATION x -x
11
Flows 5 2 4 -5 2 edge-weights = capacities 3 FLOW CONSERVATION x -x f(u,v) = 0 vVvV
12
Flow – formal definition FLOW CONSERVATION CAPACITY CONSTRAINTS f(u,v) = 0 vVvV f(u,v) c(u,v) SKEW SYMMETRY f(u,v) = - f(v,u)
13
Max-flow problem INPUT: directed graph G=(V,E), source s V, sink t V a capacity c(e) for each edge e E OUTPUT: maximum flow from s to t
14
Max-flow problem F zero-flow while can improve F improve F
15
Max-flow problem 5 2 4 2 3 4 7 2 2 4 2 2 2 4 2 5 2 4 2 3 4 7 2 2 5 2 3 1 4 3 1 improving can decrease flow on some edges
16
+1 +1 Augmenting path
17
+1 Augmenting path
18
+1 Augmenting path can improve the flow F zero-flow while augmenting path p improve F along p Ford-Fulkerson algorithm
19
Residual capacity f(u,v) c(u,v) r(u,v) = c(u,v) – f(u,v) makes sense for negative f(u,v)
20
Residual network 5 2 4 2 3 4 7 2 2 2 2 2 4 2 4
21
9 2 4 2 3 4 7 2 2 2 2 2 4 2 1
22
9 2 4 2 3 4 7 2 2 2 2 2 4 2 1
23
9 4 4 2 3 4 7 2 2 2 2 4 2 1
24
9 4 4 2 3 4 7 2 2 2 2 4 2 1
25
9 4 4 2 4 7 2 2 2 4 2 1 1 5
26
9 4 8 4 2 7 1 1 5 4 7 6 Is there an augmenting path? Is there a path from s to t in the residual network?
27
Correct ? F zero-flow while augmenting path p improve F along p
28
Correct ? F zero-flow while augmenting path p improve F along p Theorem: no augmenting path max-flow YES
29
Theorem: no augmenting path max-flow Proof: no augmenting path no path from s to t in the residual network st
30
Theorem: no augmenting path max-flow Proof: no augmenting path no path from s to t in the residual network st vertices to which we can get from s
31
Theorem: no augmenting path max-flow Proof: no augmenting path no path from s to t in the residual network st vertices to which we can get from s all edges from C to V-C saturated C
32
Theorem: no augmenting path max-flow Theorem 2: max-flow = min-cut
33
Is there an augmenting path? Is there a path from s to t in the residual network? time O(E) F zero-flow while augmenting path p improve F along p time = ?
34
F zero-flow while augmenting path p improve F along p 0 100 1 0 0 0 0
35
F zero-flow while augmenting path p improve F along p 0 100 1 0 0 0 0
36
F zero-flow while augmenting path p improve F along p 1 100 1 0 1 0 1
37
F zero-flow while augmenting path p improve F along p 1 100 1 0 1 0 1
38
F zero-flow while augmenting path p improve F along p 1 100 1 0 1 0 1
39
F zero-flow while augmenting path p improve F along p 1 100 1 2 2 1
40
F zero-flow while augmenting path p improve F along p 1 100 1 2 2 1
41
F zero-flow while augmenting path p improve F along p 3 100 1 2 1 2 3
42
F zero-flow while augmenting path p improve F along p Assume that the capacities are integers. Then the number of augementations is bounded by F * (=max-flow) running time O(E F * )
43
F zero-flow while augmenting path p improve F along p running time O(E F * ) can a good choice of p improve the algorithm?
44
F zero-flow while augmenting path p improve F along p 1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) 2. choose path p which has the fewest number of edges
45
1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F * )
46
Graph G flow f in G Residual network G f f’=flow in G f Claim: h=f+f’ is a flow in G SKEW SYMMETRY: h(u,v)=f(u,v)+f’(u,v)=-f(v,u)-f’(v,u) = - (f(v,u) + f’(v,u)) = - h(v,u) FLOW CONSERVATION: u h(u,v) = u (f(u,v)+f’(u,v))= u f(u,v) + u f’(u,v) = 0
47
Graph G flow f in G Residual network G f f’=flow in G f Claim: h=f+f’ is a flow in G CAPACITY CONSTRAINTS: f’(u,v) c(u,v)-f(u,v) h(u,v)=f(u,v)+f’(u,v) c(u,v)
48
Graph G flow f in G Residual network G f f’=flow in G f Claim: f’=h-g is a flow in G f CAPACITY CONSTRAINTS: f’(u,v) h(u,v)-f(u,v) c(u,v)-f(u,v) flow h in G
49
Claim: any flow f in G is a sum of at most |E| path flows Induction on the number of non-zero edges in f
50
Claim: any flow f in G is a sum of at most |{e E;f(e) 0}| path flows Induction on the number of non-zero edges in f G’ with capacities c’(u,v)=max{0,f(u,v)} p = augmenting path from zero flow in G’ p has bottleneck edge f-p has less non-zero edges than f f = flow f = p + (f-p)
51
1.choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F * ) Claim: any flow f in G is a sum of at most |E| path flows Graph G flow f in G Residual network G f f’=f * -f max-flow f * in G path with bottleneck capacity f’/|E|
52
1.choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F * ) Graph G flow f in G Residual network G f f’=f * -f max-flow f * in G path with bottleneck capacity f’/|E| max-flow in the residual graph decreases by a factor of at least (1-1/|E|)
53
2. choose path p which has the fewest number of edges THEOREM: number of augmenting steps O(E V)
54
2. choose path p which has the fewest number of edges level graph = BFS in the residual network
55
2. choose path p which has the fewest number of edges level graph = BFS in the residual network
56
2. choose path p which has the fewest number of edges 1) one such edge saturated 2) no new introduced count edges in the residual graph which are on a path of length d from s to t
57
Plain Ford-Fulkerson O(E F * ) Maximum bottleneck capacity O( (E+V log V) E log F ) Fewest edges O(E 2 V)
58
Max-matching in bipartite graphs
60
st solution using max-flow all edge weights =1
61
Max-matching in bipartite graphs solution using max-flow st all edge weights =1 Plain Ford-Fulkerson O(E F * ) Maximum bottleneck capacity O( (E+V log V) E log F ) Fewest edges O(E 2 V) which one to use?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.