Professional Documents
Culture Documents
08 Graphs Network Flow
08 Graphs Network Flow
— Network Flow —
Silvio Jamil F. Guimarães
Graduate Program in Informatics – PPGINF
Image and Multimedia Data Science Laboratory – IMScience
Pontifical Catholic University of Minas Gerais – PUC Minas
Aug 2021
Teoria dos Grafos e Computabilidade
— Maximum Flow and Minimum Cut —
Silvio Jamil F. Guimarães
Graduate Program in Informatics – PPGINF
Image and Multimedia Data Science Laboratory – IMScience
Pontifical Catholic University of Minas Gerais – PUC Minas
Aug 2021
Maximum Flow and Minimum Cut
10 20
P
I The value of a flow is ν(f ) = e out of s f (e).
P
I The value of a flow is ν(f ) = e out of s f (e).
I Useful notation:
f out (v ) = e out of v f (e) f in (v ) =
P P
e into v f (e)
For S ⊆ V P ,
f out (S) = e out of S f (e) f in (S) =
P
e into S f (e)
Maximum Flow
u I Assumptions :
20 10
1. No edges enter s, no edges leave t.
s 30 t
10 20
Maximum Flow
u I Assumptions :
20 10
1. No edges enter s, no edges leave t.
s 30 t 2. There is at least one edge incident
on each node.
10 20
Maximum Flow
u I Assumptions :
20/20 10/10
1. No edges enter s, no edges leave t.
s 10/30 t 2. There is at least one edge incident
on each node.
10/10 20/20
3. All edge capacities are integers .
v
Questions?
Network Flow
– Maximum Flow and Minimum
Cut –
20 10
s 30 t
10 20
0/20 0/10
s 0/30 t
0/10 0/20
u u
20 10 20 10
s 30 t s 30 t
10 20 10 20
v v
u u u
20 10 20 10 20 10
s 30 t s 30 t s 30 10 t
10 20 10 20 10 20
v v v
20 10
s 30 t
10 20
0/20 0/10
s 0/30 t
0/10 0/20
u u f /c v
0/20 0/10
s 0/30 t
0/10 0/20
c −f
u v
v f
u u f /c v u
0/20 0/10 20 10
0 0
s 0/30 t s 0 30 t
0/10 0/20 10 20
c −f 0 0
u v
v f v
20 10
s 30 t
10 20
u u
20 10 0/20 0/10
s 30 t s 0/30 t
10 20 0/10 0/20
v v
u u u
20 10 0/20 0/10 20 10
0 0
s 30 t s 0/30 t s 0 30 t
10 20 0/10 0/20 10 20
0 0
v v v
u u u u
20 10 0/20 0/10 20 10 20 10
0 0 0 0
s 30 t s 0/30 t s 0 30 t s 0 30 t
10 20 0/10 0/20 10 20 10 20
0 0 0 0
v v v v
u u
20 10 20/20 0/10
s 30 t s 20/30 t
10 20 0/10 20/20
v v
u u u
20 10 20/20 0/10 0 10
20 0
s 30 t s 20/30 t s 20 10 t
10 20 0/10 20/20 10 0
0 20
v v v
u u u u
20 10 20/20 0/10 0 10 0 10
20 0 20 0
s 30 t s 20/30 t s 20 10 t s 20 10 t
10 20 0/10 20/20 10 0 10 0
0 20 0 20
v v v v
u u
20 10 20/20 10/10
s 30 t s 10/30 t
10 20 10/10 20/20
v v
u u u
20 10 20/20 10/10 0 0
20 10
s 30 t s 10/30 t s 10 20 t
10 20 10/10 20/20 0 0
10 20
v v v
Questions?
Network Flow
– Ford-Fulkerson Algorithm –
100 100
s 1 t
100 100
0/100 0/100
s 0/1 t
0/100 0/100
u
v
100 100
s 1 t
100 100
u u
s 0/1 t s 0 1 t
s 1 t
100 100
u u u
s 0/1 t s 0 1 t s 0 1 t
s 1 t
100 100
u u u
s 0/1 t s 0 1 t s 0 1 t
s 1 t
100 100
u
v
1/100 0/100
s 1/1 t
0/100 1/100
u u u
s 0/1 t s 0 1 t s 0 1 t
s 1 t
100 100
u u
v
1/100 0/100 99 100
1 0
s 1/1 t s 1 0 t
v v
u u u
s 0/1 t s 0 1 t s 0 1 t
s 1 t
100 100
u u u
v
1/100 0/100 99 100 99 100
1 0 1 0
s 1/1 t s 1 0 t s 1 0 t
v v v
Questions?
Network Flow
– Scaling Max-Flow Algorithm –
a 9 f
10 4 15 15 10
s 5 c 8 d 10 t
15 4 6 15 10
b 30 e
a 4 f
10 2 8 6 10
s 10 c 9 d 10 t
e j
d i
c h
b g
a f
e j
d i
c h
b g
a f
e j
d i
c h
b g
a f
a f
s c d t
b e
a f
s c d t
b e
Network Connectivity
Network Connectivity
s c d t
b e
Network Connectivity
s c d t
b e