flow networks
DESCRIPTION
Flow Networks. [email protected]. Formalization. Basic Results. Min-cut. Ford-Fulkerson. Edmunds-Karp. Bipartite Matching. Flow Network. Directed Graph G = (V, E) Each edge has a capacity. Properties of Flow. Capacity Constraint Skew Symmetry Flow Conservation. Maximum Flow. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/1.jpg)
Flow [email protected]
![Page 2: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/2.jpg)
Formalization
Basic Results
Ford-Fulkerson
Edmunds-Karp
Bipartite Matching
Min-cut
![Page 3: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/3.jpg)
Flow Network
• Directed Graph G = (V, E)• Each edge has a capacity
![Page 4: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/4.jpg)
Properties of Flow
Capacity Constraint
Skew Symmetry
Flow Conservation
![Page 5: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/5.jpg)
Maximum Flow
– Returns Maximum Flow of G
Value of Flow
|𝒇 |=∑𝑣∈𝑉
𝑓 (𝑠 ,𝑣 )
![Page 6: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/6.jpg)
Motivating Problem
s
v1
v2
v3
v4
tFact
ory
Warehouse
16
10 4
1220
9 7
414
13
![Page 7: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/7.jpg)
Motivating Problem
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/20
4/9 7/7
4/411/14
8/13
![Page 8: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/8.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
15/20
4/9 7/7
4/411/14
8/13
12/12
![Page 9: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/9.jpg)
Multiple Sources / Sinks
s1
v1
v2
v3
v4
t1
16
10 4
1220
9 74
14
13
t24s2
4
![Page 10: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/10.jpg)
Multiple Sources / Sinks
s1
v1
v2
v3
v4
t1
16
10 4
1220
9 74
14
13
t24s2
4
S t∞
∞ ∞
∞
![Page 11: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/11.jpg)
Implicit Summation Notation
![Page 12: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/12.jpg)
Key EqualitiesLet G = (V, E) be a flow network, and let f be a flow in G. Then
![Page 13: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/13.jpg)
Capacity Constraint
Skew Symmetry
Flow Conservation
Homomorphism
![Page 14: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/14.jpg)
Flow Value
Prove
DefinitionHomomorphismFlow ConservationSkew SymmetryHomomorphismFlow Conservation
![Page 15: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/15.jpg)
Ford-Fulkerson
flow=0while(augmenting path p)) { augment flow f along p}return flow
![Page 16: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/16.jpg)
Residual network
Induced network from G=(V, E) and flow f
![Page 17: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/17.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/20
4/9 7/7
4/411/14
8/13
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
![Page 18: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/18.jpg)
Augmenting Path
A path of
non-zero weight
from s to t in Gf
![Page 19: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/19.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/20
4/9 7/7
4/411/14
8/13
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
![Page 20: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/20.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/20
4/9 7/7
4/411/14
8/13
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
![Page 21: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/21.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/20
4/9 7/7
4/411/14
8/13
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
![Page 22: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/22.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
20/20
0/9 7/7
4/411/14
13/13
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
20
411
1311
0 7
0
3
0
9
3
00
0
![Page 23: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/23.jpg)
S-T Cut
• A cut C=(S, T) of a flow network G=(V, E) is a partition of V into S and T = V – S
• Net flow across• Capacity of cut:
![Page 24: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/24.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11/16
10 1/4
12/12
15/204/9 7/
7
4/411/14
8/13
f(S, T) = 12 – 4 + 11 = 19c(S, T) = 12 + 14 = 26
![Page 25: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/25.jpg)
Let f be a flow in a flow network G with source s and sink t, and let (S, T) be a cut of G. Then the net flow across (S, T) is f(S, T) = |f|
HomomorphismFlow ConservationHomomorphismFlow ConservationDefinition
![Page 26: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/26.jpg)
|𝑓 |= 𝑓 (𝑆 ,𝑇 )The value of any flow f in a flow network G is bounded by the capacity of any cut of G
![Page 27: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/27.jpg)
Min-Cut Max-Flow
1. f is a maximum flow in G2. The residual network Gf contains no
augmenting path3. |f|= c(S, T) for some cut (S, T) of G
![Page 28: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/28.jpg)
(1 )⇒ (2)1. Premise: f is a max-flow in G2. Assume Gf has augmenting path p3. We can augment Gf with p to get a flow f’ > f– Contradicts [1]
• Hence Gf has no augmenting paths
![Page 29: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/29.jpg)
(2 )⇒ (3)1. Premise: Gf has no augmenting paths2. Let
1. T = V-S3. (S, T) is a cut
1. Otherwise
![Page 30: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/30.jpg)
(3 )⇒ (1)
1. , |f| is maximum
The value of any flow f in a flow network G is bounded by the capacity of any cut of G
![Page 31: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/31.jpg)
Ford-Fulkerson
flow=0while(augmenting path p)) { augment flow f along p}return flow
Termination: Gf has no augmenting path iff flow is maximum
![Page 32: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/32.jpg)
Run-time
flow=0while(augmenting path p)) { augment flow f along p}return flow
O(E|f*|) where |f*| is the maximum flow
![Page 33: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/33.jpg)
s
v1
v2
t1
1,000,000 1,000,000
1,000,0001,000,000
![Page 34: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/34.jpg)
s
v1
v2
t1
1,000,000 1,000,000
1,000,0001,000,000
![Page 35: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/35.jpg)
s
v1
v2
t1
999,999 1,000,000
1,000,0001,000,000
1
1
![Page 36: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/36.jpg)
s
v1
v2
t1
999,999 1,000,000
1,000,0001,000,000
1
1
![Page 37: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/37.jpg)
s
v1
v2
t1
999,999 999,999
1,000,000999,999
1
11
1
![Page 38: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/38.jpg)
s
v1
v2
t1
999,999 999,999
1,000,000999,999
1
11
1
![Page 39: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/39.jpg)
Edmunds Karp
flow=0while(augmenting path p)) { find augmenting path by BFS augment flow f along p}return flow
Run-time: O(VE2)
![Page 40: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/40.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
Critical Edge
![Page 41: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/41.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
Critical Edge
Lemma: Edges can be critical at most times
![Page 42: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/42.jpg)
s
v1
v2
v3
v4
tFact
ory
Warehouse
11
5
12
15
411
811
4 7
5
3
0
5
3
00
5
𝛿 𝑓 (𝑢 ,𝑣 )≔ h𝑠 𝑜𝑟𝑡𝑒𝑠𝑡− h𝑝𝑎𝑡 h𝑙𝑒𝑛𝑔𝑡 𝑓𝑟𝑜𝑚𝑢→𝑣
![Page 43: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/43.jpg)
𝛿 𝑓 (𝑢 ,𝑣 )≔ h𝑠 𝑜𝑟𝑡𝑒𝑠𝑡− h𝑝𝑎𝑡 h𝑙𝑒𝑛𝑔𝑡 𝑓𝑟𝑜𝑚𝑢→𝑣1. Assume (u, v) is a critical edge2. Augmenting-paths are shortest path [by EK]3. [from 1]4. After flow-augmentation, cf(u,v) = 0• (u, v) cannot be critical path until another
augmenting path containing (v, u).• Let the flow at this point be f’5.
6. i.e, each time (u, v) is augmenting-path, path length increases by 2
7. (u, v) can be critical edge at most times
![Page 44: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/44.jpg)
Lemma: Edges can be critical at most times
Since there are O(E) edges, the number of augmenting path is bounded by O(VE) [by Lemma].
Run-time: O(VE2)
![Page 45: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/45.jpg)
Bipartite Matching
![Page 46: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/46.jpg)
Bipartite Matching
![Page 47: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/47.jpg)
Bipartite Matching MaxFlow
s t
![Page 48: Flow Networks](https://reader035.vdocuments.net/reader035/viewer/2022062811/5681624c550346895dd294c1/html5/thumbnails/48.jpg)
Bipartite Matching MaxFlow
s t