Flows - PowerPoint PPT Presentation

About This Presentation
Title:

Flows

Description:

at most |E| path flows. Induction on the number of non-zero edges in f ... at most |E| path flows. Graph G. flow f in G. Residual network Gf. f'=f*-f. max-flow f* in G ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 62
Provided by: csRoch
Category:
Tags: flows | moste

less

Transcript and Presenter's Notes

Title: Flows


1
(No Transcript)
2
Flows
t
s
source
sink
3
Flows
edge-weights capacities
2
3
5
7
4
4
2
2
source
sink
4
Flows
edge-weights capacities
2
2
2
3
2
5
7
2
4
4
2
2
2
2
4 units of flow
source
sink
5
Flows
edge-weights capacities
2
2
2
3
4
5
7
2
2
4
4
4
2
2
2
6 units of flow
source
sink
6
Flows
edge-weights capacities
2
2
3
3
5
5
7
3
2
1
4
4
4
2
1
2
7 units of flow
source
sink
7
Optimal?
? a larger flow?
8
Cuts
capacity of a cut cap(C)? c(u,v)
C
s
u?C v?V-C
C ? V s ? C t ? V-C
for any cut and any flow
flow ? cut
?
max-flow ? min-cut
9
Flows
edge-weights capacities
2
2
5
5
3
4
FLOW CONSERVATION
10
Skew symmetry
edge-weights capacities
2
2
5
5
3
4
x
-x
FLOW CONSERVATION
11
Flows
edge-weights capacities
2
2
-5
5
3
? f(u,v) 0
v?V
4
x
-x
FLOW CONSERVATION
12
Flow formal definition
FLOW CONSERVATION CAPACITY CONSTRAINTS
? f(u,v) 0
v?V
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
improving can decrease flow on some edges
16
Augmenting path
1
1
1
1
-1
17
Augmenting path
1
1
1
1
1
18
Augmenting path
? can improve the flow
Ford-Fulkerson algorithm
F ? zero-flow while ? augmenting path p
improve F along p
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
2
2
5
2
3
7
2
4
2
4
4
4
2
2
2
21
Residual network
2
2
2
3
9
7
2
1
2
4
4
4
2
2
2
22
Residual network
2
2
2
3
9
7
2
1
2
4
4
4
2
2
2
23
Residual network
4
2
3
9
7
2
1
2
4
4
4
2
2
2
24
Residual network
4
2
3
9
7
2
1
2
4
4
4
2
2
2
25
Residual network
4
5
9
7
2
1
1
2
4
4
4
2
2
2
26
Residual network
4
5
6
9
7
1
1
7
2
8
4
4
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
YES
Theorem no augmenting path ? max-flow
29
Theorem no augmenting path ? max-flow
Proof
no augmenting path ? no path
from s to t in the residual network
s
t
30
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
31
Theorem no augmenting path ? max-flow
Proof
no augmenting path ? no path
from s to t in the residual network
all edges from C to V-C saturated
C
s
t
vertices to which we can get from s
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
100
100
0
0
1
0
0
0
100
100
35
F ? zero-flow while ? augmenting path p
improve F along p
100
100
0
0
1
0
0
0
100
100
36
F ? zero-flow while ? augmenting path p
improve F along p
100
100
1
0
1
1
0
1
100
100
37
F ? zero-flow while ? augmenting path p
improve F along p
100
100
1
0
1
1
0
1
100
100
38
F ? zero-flow while ? augmenting path p
improve F along p
100
100
1
0
1
1
0
1
100
100
39
F ? zero-flow while ? augmenting path p
improve F along p
100
100
1
2
1
-1
2
1
100
100
40
F ? zero-flow while ? augmenting path p
improve F along p
100
100
1
2
1
-1
2
1
100
100
41
F ? zero-flow while ? augmenting path p
improve F along p
100
100
3
2
1
1
2
3
100
100
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
can a good choice of p improve the algorithm?
running time O(E F)
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 Gf
fflow in Gf
Claim hff 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 Gf
fflow in Gf
Claim hff 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 Gf
fflow in Gf
flow h in G
Claim fh-g is a flow in Gf
CAPACITY CONSTRAINTS
f(u,v) h(u,v)-f(u,v)?c(u,v)-f(u,v)
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?
Ef(e)?0 path flows
Induction on the number of non-zero edges in f
f flow
G with capacities c(u,v)max0,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 p (f-p)
51
  • 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
ff-f
? path with bottleneck capacity ? f/E
max-flow f in G
52
  • 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)
max-flow in the residual graph decreases by a
factor of at least (1-1/E)
Graph G flow f in G
Residual network Gf
ff-f
? path with bottleneck capacity ? f/E
max-flow f in G
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
count edges in the residual graph which are on a
path of length d from s to t
  1. one such edge saturated
  2. no new introduced

57
Plain Ford-Fulkerson O(E F) Maximum bottleneck
capacity O( (EV log V) E log F ) Fewest
edges O(E2 V)
58
Max-matching in bipartite graphs
59
Max-matching in bipartite graphs
60
Max-matching in bipartite graphs
solution using max-flow
all edge weights 1
s
t
61
Max-matching in bipartite graphs
solution using max-flow
Plain Ford-Fulkerson O(E F) Maximum bottleneck
capacity O( (EV log V) E log F ) Fewest
edges O(E2 V)
which one to use?
Write a Comment
User Comments (0)
About PowerShow.com