Title: Max Flows
1Max Flows
2?????? (flow)
- ????????????????????????????????????????????
- ??????? source s ??? sink t
- ??????????????????????????????????????? s ??? t
capacity
source
sink
????????????????? s ??? t ??????????????????
3?????? (flow)
- ??? f(u,v) ??????????????????????????? (u,v)
- ?????????????????????????????????????????
- ??????????????????????? ??????????????????????????
????????? (???????? s ??? t)
flow / capacity
4??????? (cut)
S
T
...
...
s
...
t
...
???????????????? (S,T) ????????????????????????
S ?? T
f(S,T) ? c(S,T)
12 4 11 ? 12 14
5Max-Flow Min-Cut Theorem
S
T
...
...
s
...
t
...
fmax(S,T) cmin(S,T)
6?????? max-flow
- Augmenting-path method
- Preflow-push method
7??????????????????????
8??????????????????????
9Residual Network
- ???????????????? (residual capacity)
????????????? (u,v) ????????? G ??????????? f
??? cf(u,v) c(u,v) f(u,v) - ????????????????? (residual network) ??? G
??????????? f ??? - ???????????????????? G
- ???????????? (u,v) ??????????? cf(u,v) ???
cf(u,v) gt 0 - ???????????? (v,u) ??????????? f(u,v) ??? f(u,v)
gt 0
10Augmenting Path Method
- ?????????????? (augmenting path) ????????????????
?????????????????????????
12/12
11Ford Fulkerson, 1962
12????????
4
13???????? (???)
14???????? (???)
Residual Network
Resulting Flow
11
15???????? (???)
16???????? (???)
19
17???????? (???)
18???????? (???)
23
19???????? (???)
20?????????
- ????????????????????????????? ????????????????????
? ????????????????????????????????? - ??? max flow ??? f, ?????????? O(E f)
21??????? ?
22Augmenting Path ????????
- Capacity scaling O(E2 log U)
- ?-residual network ??? residual network
???????????????????????????????? ? - ????? ? 2lg U ???????? ? ??????????????????? 1
- Edmonds ??? Karp ????
- ???????????????? (????????????????) O(VE2)
- ?????????????????????????? O(V2 lg U lg V)
(U ????????????????????????????)
23?????? max-flow
- Augmenting-path method
- Preflow-push method
24Preflow-Push Method
- augmenting path method ???????????????????????????
????? ? ??????????????????????????????????????? ?
??????????? (maintain feasibility, aim for
optimality) - preflow push method ???????????????????? ? ?????
sink ???????? ? ??????????????????? source
??????????????????????????????????? (start with
super optimality, aim for feasibility)
25Original Network
6
5
4
3
2
14
1
s
x
y
z
t
12
5
8
10
0
7
16
26Residual network step 1 - initialize
6
s
5
-26
4
3
14
12
2
1
x
y
z
t
5
8
10
0
12
14
0
0
7
16
27Residual network step 2 - relabel
6
s
5
-26
4
3
14
12
2
x
1
12
y
z
t
5
8
10
0
14
0
0
7
16
28Residual network step 3 - push
6
s
5
-26
4
3
14
12
2
x
1
7
y
z
t
5
8
10
0
19
0
0
7
16
29Residual network step 4 - push
6
s
5
-26
4
3
14
12
2
x
1
0
y
z
t
5
8
10
0
19
0
7
7
9
7
30Residual network step 5 - relabel
6
s
5
-26
4
3
14
12
2
x
y
1
0
19
z
t
5
8
10
0
0
7
7
9
7
31Residual network step 6 - push
6
s
5
-26
4
3
14
12
2
x
y
1
0
11
z
t
5
8
10
0
8
7
7
9
7
32Residual network step 7 - relabel
6
s
5
-26
4
3
14
12
2
x
y
z
1
0
11
8
t
5
8
10
0
7
7
9
7
33Residual network step 8 - push
6
s
5
-26
4
3
14
12
2
x
y
z
1
0
11
0
8
t
5
8
2
0
15
7
9
7
34Residual network step 9 - relabel
6
s
5
-26
4
14
3
y
12
2
11
x
z
5
8
1
0
0
8
t
2
0
15
7
9
7
35Residual network step 10 - push
6
s
5
-26
4
14
3
y
12
2
6
x
z
5
8
1
5
0
8
t
2
0
15
7
9
7
36Residual network step 11 - push
6
s
5
-26
4
14
3
y
12
2
6
x
z
5
8
1
0
0
8
t
2
0
20
7
4
12
37Residual network step 12 - relabel
y
6
6
s
14
5
-26
4
5
8
3
12
2
x
z
1
0
0
8
t
2
0
20
7
4
12
38Residual network step 13 - push
y
6
6
0
s
8
5
-20
4
5
8
3
12
2
x
z
1
0
0
8
t
2
0
20
7
4
12
39??????
- e(u) ??? excess ????? u???????????????? u
????????????????????? - active node ?????????? e(u) gt 0(??????? s ??? t,
e(s) ? 0, e(t) ? 0 ????) - ?????????????????????
- ??? flow ??????????????????????? (sink
??????????) - ?????? (u,v), d(u) ? d(v) 1
- ????? active node u ???? push ?????? e(u)
?????????? "??????" v ?????? d(u) d(v) 1
(?????????????????? sink)
40Preflow-Push Method
41??? distance label ???????
- ??? d(i) 0 ???
- ?? reverse breadth-first search ??? t??? d(t)
0 ?????? d(i) k ?????? k ?????????????????? i
?? breadth-first tree
42??????? active nodes ???????
- FIFO preflow-push algorithm O(V3)
- Highest label preflow-push algorithm O(V2E1/2)
- Excess scaling algorithm
- O(VE V2logU)
43FIFO Preflow-Push
- ??? queue ????????????? active nodes
??????????????? push flow - ???????? relabel ?????????????? queue
- ??? u ?????????? push, ??????????? active node
???? ???? push ??????????? e(u) 0 ??????????
relabel
44FIFO ????????
Pic 1
Pic 2
Pic 4
Pic 3
45???????? (???)
Pic 6
Pic 5
Pic 8
Pic 7
46???????? (???)
Pic 9
Pic 10
Pic 11
Pic 12
47???????? (???)
Pic 13
Pic 14
Pic 15
Pic 16
48???????? (???)
Pic 17
Pic 18
49Highest-Label Preflow-Push
- ????? active node ??????????????? push
50?????????
51?????????
52???????????????? sources ??? sinks
53?????????????????????????
54???????????????????????????????????????