Dinic'S Algorithm: 郭至軒( Kuoe0) Kuoe0.Ch
Dinic'S Algorithm: 郭至軒( Kuoe0) Kuoe0.Ch
KuoE0
[email protected]
KuoE0.ch
Attribution-ShareAlike 3.0 Unported
(CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
s 2 4 t
3 3
2 3
2
Maximum Flow
3/3
1 4
3/3 2/2
s 0/2 1/4 t
2/3 3/3
2 3
2/2
Concept
Level Graph
Blocking Flow
Level Graph
0/4
1 3
0/10
0/10
S 0/8 t
0/10 0/10
0/9
2 4
Level Graph
0/4
1 3
0/10
0/10
S
1 0/8 t
0/10 0/10
0/9
2 4
Level Graph
0/4
1
2 3
0/10
0/10
S
1 0/8 t
0/10 0/10
0/9
2 4
Level Graph
0/4
1
2 3
0/10
0/10
S
1 0/8 t
0/10 0/10
0/9
2 4
3
Level Graph
0/4
1
2 3
0/10
0/10
S
1 0/8 4t
0/10 0/10
0/9
2 4
3
Level Graph
0/4
1
2 3
0/10
0/10
S
1
s 0/8 4t
0/10 0/10
0/9
2 4
3
Blocking Flow
0/4 0/5
0/3 0/8
Blocking Flow
0/4 0/5
0/3 0/8
Blocking Flow
0/4 0/5
0/3 0/8
bottleneck: 4
Blocking Flow
4/4 4/5
0/3 0/8
Blocking Flow
4/4 4/5
0/3 0/8
Blocking Flow
4/4 4/5
0/3 0/8
bottleneck: 5
Blocking Flow
4/4 4/5
0/3 0/8
Blocking Flow
4/4 4/5
0/3 0/8
Blocking Flow
4/4 4/5
0/3 0/8
bottleneck: 3
Blocking Flow
4/4 4/5
3/3 3/8
Blocking Flow
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
3
Blocking Flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 3 4 5
8/10 3/5 5/5
10/10
2 4
5/5 5/6
3
Algorithm
1. build a level graph
2. find an augmenting path from source to sink
3. find the bottleneck on augmenting path
4. find the augmenting path from bottleneck to
sink
5. repeat step 3 and step 4 to construct a
blocking flow until no augmenting path found
Example
0/15 0/10
0/5 0/7
0/5 0/6
build a level graph
0/15 0/10
0/5 0/7
0/5 0/6
current flow: 0
build a level graph
0/15 0/10
0/5 0/7
1
0/10 0/5 0/5
0/10
0/5 0/6
current flow: 0
build a level graph
0/15 0/10
2
0/30 0/5 0/10 0/15
0/5 0/7
1
0/10 0/5 0/5
0/10
2
0/5 0/6
current flow: 0
build a level graph
0/15 0/10
2 3
0/30 0/5 0/10 0/15
0/5 0/7
1 3
0/10 0/5 0/5
0/10
2
0/5 0/6
current flow: 0
build a level graph
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
1 3 4
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 0
build a level graph
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 0
construct a blocking flow
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
11 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 0
construct a blocking flow
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
11 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 0
construct a blocking flow
bottleneck: 10
0/15 0/10
2 3 4
0/30 0/5 0/10 0/15
0/5 0/7
11 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 0
construct a blocking flow
10/15 10/10
2 3 4
10/30 0/5 0/10 10/15
0/5 0/7
11 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
0
construct a blocking flow
10/15 10/10
10/30
2 33 4
10/15
0/5 0/10
0/5 0/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
construct a blocking flow
10/15 10/10
10/30
2 33 4
10/15
0/5 0/10
0/5 0/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
construct a blocking flow
bottleneck: 5
10/15 10/10
10/30
2 33 4
10/15
0/5 0/10
0/5 0/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
construct a blocking flow
15/15 10/10
15/30
2 33 4
10/15
0/5 5/10
0/5 5/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
15
construct a blocking flow
15/15 10/10
15/30
22 3 4
10/15
0/5 5/10
0/5 5/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
15
construct a blocking flow
15/15 10/10
15/30
22 3 4
10/15
0/5 5/10
0/5 5/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
15
construct a blocking flow
bottleneck: 2
15/15 10/10
15/30
22 3 4
10/15
0/5 5/10
0/5 5/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
15
construct a blocking flow
15/15 10/10
17/30
22 3 4
10/15
2/5 5/10
2/5 7/7
1 3 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 10
15
17
construct a blocking flow
15/15 10/10
2 3 4
17/30 2/5 5/10 10/15
2/5 7/7
1 3 44 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 17
construct a blocking flow
15/15 10/10
2 3 4
17/30 2/5 5/10 10/15
2/5 7/7
1 33 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 17
construct a blocking flow
15/15 10/10
2 3 4
17/30 2/5 5/10 10/15
2/5 7/7
1 33 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 17
construct a blocking flow
bottleneck: 3
15/15 10/10
2 3 4
17/30 2/5 5/10 10/15
2/5 7/7
1 33 4 5
0/10 0/5 0/5
0/10
2 4
0/5 0/6
current flow: 17
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
0/10 0/5 3/5
3/10
2 4
0/5 0/6
current flow: 17
20
construct a blocking flow
15/15 10/10
20/30
22 3 4
10/15
5/5 5/10
2/5 7/7
1 33 4 5
0/10 0/5 3/5
3/10
2 4
0/5 0/6
current flow: 20
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
11 33 4 5
0/10 0/5 3/5
3/10
2 4
0/5 0/6
current flow: 20
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
11 33 4 5
0/10 0/5 3/5
3/10
2 4
0/5 0/6
current flow: 20
construct a blocking flow
bottleneck: 2
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
11 33 4 5
0/10 0/5 3/5
3/10
2 4
0/5 0/6
current flow: 20
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
11 33 4 5
2/10 2/5 5/5
5/10
2 4
0/5 0/6
current flow: 20
22
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
2/10 2/5 5/5
5/10
2 4
0/5 0/6
current flow: 22
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
2/10 2/5 5/5
5/10
22 4
0/5 0/6
current flow: 22
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
2/10 2/5 5/5
5/10
22 4
0/5 0/6
current flow: 22
construct a blocking flow
bottleneck: 5
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
2/10 2/5 5/5
5/10
22 4
0/5 0/6
current flow: 22
construct a blocking flow
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
7/10 2/5 5/5
10/10
22 4
5/5 5/6
current flow: 22
27
no augmenting path from source to sink
15/15 10/10
2 3 4
20/30 5/5 5/10 10/15
2/5 7/7
1 33 4 5
7/10 2/5 5/5
10/10
22 4
5/5 5/6
current flow: 22
27
build a level graph
15/15 10/10
2/5 7/7
current flow: 22
27
build a level graph
15/15 10/10
2/5 7/7
1
7/10 2/5 5/5
10/10
4
5/5 5/6
current flow: 22
27
build a level graph
15/15 10/10
2
20/30 5/5 5/10 10/15
2/5 7/7
1
7/10 2/5 5/5
10/10
2 4
5/5 5/6
current flow: 22
27
build a level graph
15/15 10/10
2
20/30 5/5 5/10 10/15
2/5 7/7
1 3
7/10 2/5 5/5
10/10
2 4
5/5 5/6
current flow: 22
27
build a level graph
15/15 10/10
2
20/30 5/5 5/10 10/15
2/5 7/7
1 3 4
7/10 2/5 5/5
10/10
2 4
5/5 5/6
current flow: 22
27
build a level graph
15/15 10/10
2 5
20/30 5/5 5/10 10/15
2/5 7/7
1 3 4
7/10 2/5 5/5
10/10
2 4
5/5 5/6
current flow: 22
27
no any path from source to sink exists
15/15 10/10
2 5
20/30 5/5 5/10 10/15
2/5 7/7
1 3 4
7/10 2/5 5/5
10/10
2 4
5/5 5/6
current flow: 22
27
Maximum Flow: 27
15/15 10/10
2/5 7/7
- Flow
Maximum flow problem - Wikipedia, the
free encyclopedia
Thank You for Your Listening.