View
218
Download
3
Category
Tags:
Preview:
Citation preview
Flows
source sink
s t
Flows
source sink
5
2
42
3
4
7
2
edge-weights = capacities
Flows
source sink
5
2
42
3
4
7
2
2
2
2
2
22
edge-weights = capacities
4 units of flow
Flows
source sink
5
2
42
3
4
7
2
2
4
2
2
24
edge-weights = capacities
6 units of flow
2
Flows
source sink
5
2
42
3
4
7
2
2
5
2
3
14
edge-weights = capacities
7 units of flow
3
1
Optimal?
5
2
42
3
4
7
2
2
52
3
14
3
1
a larger flow?
Cuts
s
C
C Vs Ct V-C
capacity of a cut
cap(C)= c(u,v)uCvV-C
for any cut and any flow
flow cut
max-flow min-cut
Flows
5
2
4
5
2
edge-weights = capacities
3
FLOW CONSERVATION
Skew symmetry
5
2
4
5
2
edge-weights = capacities
3
FLOW CONSERVATION
x
-x
Flows
5
2
4
-5
2
edge-weights = capacities
3
FLOW CONSERVATION
x
-x
f(u,v) = 0vV
Flow – formal definition
FLOW CONSERVATION
CAPACITY CONSTRAINTS
f(u,v) = 0vV
f(u,v) c(u,v)
SKEW SYMMETRY
f(u,v) = - f(v,u)
Max-flow problem
INPUT:directed graph G=(V,E), source sV, sink tVa capacity c(e) for each edge eE
OUTPUT:maximum flow from s to t
Max-flow problem
F zero-flowwhile can improve F improve F
Max-flow problem
5
2
42
3
4
7
2
2
42
2
24
2
5
2
42
3
4
7
2
2
52
3
14
3
1improving can decrease flow on some edges
+1+1
-1
+1+1
Augmenting path
+1+1
+1
+1+1
Augmenting path
+1+1
+1
+1+1
Augmenting path can improve the flow
F zero-flowwhile augmenting path p improve F along p
Ford-Fulkerson algorithm
Residual capacity
f(u,v)c(u,v)
r(u,v) = c(u,v) – f(u,v)
makes sense for negative f(u,v)
Residual network
5
2
42
3
4
7
2
2
22
24
24
Residual network
9
2
42
3
4
7
2
2
22
24
21
Residual network
9
2
42
3
4
7
2
2
22
24
21
Residual network
9
4
42
3
4
7
2
2
2
24
21
Residual network
9
4
42
3
4
7
2
2
2
24
21
Residual network
9
4
424
7
2
2
24
21 15
Residual network
9
4
84 2
71 15
4
7
6
Is there an augmenting path?Is there a path from s to t in the residual network?
Correct ?
F zero-flowwhile augmenting path p improve F along p
Correct ?
F zero-flowwhile augmenting path p improve F along p
Theorem:no augmenting path max-flow
YES
Theorem:no augmenting path max-flow
Proof:no augmenting path no path from s to t in the residual network
s t
Theorem:no augmenting path max-flow
Proof:no augmenting path no path from s to t in the residual network
s t
vertices to which we can get from s
Theorem:no augmenting path max-flow
Proof:no augmenting path no path from s to t in the residual network
s t
vertices to which we can get from s
all edges from C to V-C saturatedC
Theorem:no augmenting path max-flow
Theorem 2: max-flow = min-cut
Is there an augmenting path?Is there a path from s to t in the residual network?
time O(E)
F zero-flowwhile augmenting path p improve F along p
time = ?
F zero-flowwhile augmenting path p improve F along p
0
100
1
100
100
100
0 0
0
0
F zero-flowwhile augmenting path p improve F along p
0
100
1
100
100
100
0 0
0
0
F zero-flowwhile augmenting path p improve F along p
1
100
1
100
100
100
0 1
0
1
F zero-flowwhile augmenting path p improve F along p
1
100
1
100
100
100
0 1
0
1
F zero-flowwhile augmenting path p improve F along p
1
100
1
100
100
100
0 1
0
1
F zero-flowwhile augmenting path p improve F along p
1
100
1
100
100
100
2 -1
2
1
F zero-flowwhile augmenting path p improve F along p
1
100
1
100
100
100
2 -1
2
1
F zero-flowwhile augmenting path p improve F along p
3
100
1
100
100
100
2 1
2
3
F zero-flowwhile 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*)
F zero-flowwhile augmenting path p improve F along p
running time O(E F*)
can a good choice of p improve the algorithm?
F zero-flowwhile augmenting path p improve F along p
1. choose path p which increasesthe flow the most (i.e., p has themaximum bottleneck capacity)
2. choose path p which has the fewest number of edges
1. choose path p which increasesthe flow the most (i.e., p has themaximum bottleneck capacity)
THEOREM:number of augmenting steps O(E log F*)
Graph G
flow f in G
Residual network Gf
f’=flow in Gf
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
Graph G
flow f in G
Residual network Gf
f’=flow in Gf
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)
Graph G
flow f in G
Residual network Gf
f’=flow in Gf
Claim: f’=h-g is a flow in Gf
CAPACITY CONSTRAINTS:
f’(u,v) h(u,v)-f(u,v)c(u,v)-f(u,v)
flow h in G
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
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 hasless non-zero edges than f
f = flow
f = p + (f-p)
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 Gf
f’=f*-f
max-flow f* in Gpath with bottleneckcapacity f’/|E|
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 Gf
f’=f*-f
max-flow f* in Gpath with bottleneckcapacity f’/|E|
max-flow in the residual graph decreases by a factor of at least (1-1/|E|)
2. choose path p which has the fewest number of edges
THEOREM:number of augmenting steps O(E V)
2. choose path p which has the fewest number of edges
level graph = BFS in the residual network
2. choose path p which has the fewest number of edges
level graph = BFS in the residual network
2. choose path p which has the fewest number of edges
1) one such edge saturated2) no new introduced
count edges in the residual graph which are on a path of length d from s to t
Plain Ford-FulkersonO(E F*)
Maximum bottleneck capacity O( (E+V log V) E log F )
Fewest edgesO(E2 V)
Max-matching in bipartite graphs
Max-matching in bipartite graphs
Max-matching in bipartite graphs
s t
solution using max-flow
all edge weights =1
Max-matching in bipartite graphssolution using max-flow
s t
all edge weights =1
Plain Ford-FulkersonO(E F*)
Maximum bottleneck capacity O( (E+V log V) E log F )
Fewest edgesO(E2 V)
which oneto use?
Recommended