Daniel Sutantyo, Department of Computing, Macquarie University
8.0 - Maximum Flow
8.0 - Maximum Flow
8.0 - Maximum Flow
D
A
B
C
E
F
G
8.0 - Maximum Flow
a
s
c
t
b
d
13
source
sink
16
12
4
9
7
20
14
4
8.0 - Maximum Flow
a
s
c
t
b
d
13
source
sink
16
12
4
9
7
20
14
4
8.0 - Maximum Flow
a
s
c
t
b
d
13
source
sink
16
12
4
9
7
20
14
4
4
4
4
8.0 - Maximum Flow
a
s
c
t
b
d
13
source
sink
13
16
12
4
9
7
20
14
4
8.0 - Maximum Flow
8.0 - Maximum Flow
a
s
c
t
b
d
source
sink
4/13
12/16
12/12
0/4
0/9
0/7
12/20
4/14
4/4
8.0 - Maximum Flow
a
s
c
t
b
d
source
sink
8/13
11/16
12/12
1/4
4/9
7/7
15/20
11/14
4/4
Here is another flow:
a
s
c
t
b
d
source
sink
4/13
12/16
12/12
0/4
0/9
0/7
12/20
4/14
4/4
8.0 - Maximum Flow
8.0 - Maximum Flow
\[\sum_{v\in V\setminus \{s,t\}}f(v,u) = \sum_{v\in V\setminus\{s,t\}} f(u,v)\]
8.0 - Maximum Flow
this is a flow
this is a different flow
a
s
c
t
b
d
source
sink
8/13
11/16
12/12
1/4
4/9
7/7
15/20
11/14
4/4
a
s
c
t
b
d
source
sink
4/13
12/16
12/12
0/4
0/9
0/7
12/20
4/14
4/4
8.0 - Maximum Flow
sink
\(f(s,a) = 11\)
\(f(s,c) = 8\)
\(f(a,b) = 11\)
\(f(b,c) = 3\)
\(f(c,d) = 11\)
\(f(d,b) = 7\)
\(f(b,t) = 15\)
\(f(d,t) = 4\)
the value of this flow is \(19\)
A flow in \(G\) is a function \(f(u,v) : V \times V \rightarrow \mathbb R\) for \(u,v \in V\)
\(f(c,a) = 0\)
a
s
c
t
b
d
source
8/13
11/16
12/12
1/4
4/9
7/7
15/20
11/14
4/4
8.0 - Maximum Flow
a
s
c
t
b
d
source
sink
1/13
1/16
1/12
0/4
0/9
0/7
1/20
1/14
1/4
A flow in \(G\) is a function \(f(u,v) : V \times V \rightarrow \mathbb R\) for \(u,v \in V\)
\(f(s,a) = 1\)
\(f(s,c) = 1\)
\(f(a,b) = 1\)
\(f(b,c) = 0\)
\(f(c,d) = 1\)
\(f(d,b) = 0\)
\(f(b,t) = 1\)
\(f(d,t) = 1\)
the value of this flow is \(2\)
\(f(c,a) = 0\)
8.0 - Maximum Flow
8.0 - Maximum Flow
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
1/1
0/3
1/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
1/2
1/1
0/3
1/2
1/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
1/1
1/3
2/2
1/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
1/1
1/3
2/2
1/1
Ingredient #1:
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
Ingredient #2:
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
Ingredient #2:
8.0 - Maximum Flow
a
s
c
t
source
sink
0/1
2/3
2/2
0/1
Ingredient #2:
1/3
0/2
2/2
0/2
8.0 - Maximum Flow
a
s
c
t
source
sink
0/1
2/3
2/2
0/1
Ingredient #2:
1/3
0/2
2/2
0/2
8.0 - Maximum Flow
a
s
c
t
source
sink
1/1
1/3
2/2
1/1
2/3
0/2
2/2
0/2
Ingredient #2:
8.0 - Maximum Flow
a
s
c
t
source
sink
1/1
1/3
2/2
1/1
2/3
0/2
2/2
0/2
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
1/1
1/3
2/2
1/1
2/3
0/2
2/2
0/2
a
s
c
t
source
sink
2/2
1/1
1/3
2/2
1/1
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
a
s
c
t
source
sink
2
1
3
2
1
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
a
s
c
t
source
sink
2
1
3
2
1
0
0
0
0
0
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
1/1
0/3
1/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
a
s
c
t
source
sink
2
0
3
1
1
0
1
1
0
0
8.0 - Maximum Flow
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
a
s
c
t
source
sink
1
0
2
0
1
1
1
2
1
0
8.0 - Maximum Flow
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
\[c_f(u,v)=\begin{cases} c(u,v)-f(u,v)& \text{if $(u,v)\in E$,} \\ f(v,u) & \text{if $(v,u)\in E$,}\\ 0 & \text{otherwise} \end{cases} \]
8.0 - Maximum Flow
8.0 - Maximum Flow
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
8.0 - Maximum Flow
sink
\(f(s,a) = 1\)
\(f(s,c) = 1\)
\(f(a,t) = 2\)
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
\(f(c,a) = 1\)
\(f(c,t) = 0\)
8.0 - Maximum Flow
sink
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
sink
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
sink
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
sink
a
s
c
t
source
sink
1/2
1/1
1/3
2/2
0/1
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
\[(f \uparrow f_p)(u,v) = \begin{cases} f(u,v) + f_p(u,v) - f_p(v,u) &\text{if $(u,v) \in E$,} \\ 0 & \text{otherwise.}\end{cases}\]
a
s
c
t
source
sink
1
2
1
1
1
2
1
8.0 - Maximum Flow
\(|f\uparrow f_p| = |f| + |f_p| > |f|\)
(Lemma 26.1, Corollary 26.3 of CLRS, page 717, 720)
\[(f \uparrow f_p)(u,v) = \begin{cases} f(u,v) + f_p(u,v) - f_p(v,u) &\text{if $(u,v) \in E$,} \\ 0 & \text{otherwise.}\end{cases}\]
8.0 - Maximum Flow
\(|f\uparrow f_p| = |f| + |f_p| > |f|\)
(Lemma 26.1, Corollary 26.3 of CLRS, page 717, 720)
\[(f \uparrow f_p)(u,v) = \begin{cases} f(u,v) + f_p(u,v) - f_p(v,u) &\text{if $(u,v) \in E$,} \\ 0 & \text{otherwise.}\end{cases}\]
8.0 - Maximum Flow
a
s
c
t
source
sink
0/2
0/1
0/3
0/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
a
s
c
t
source
sink
1
1
2
1
2
2
\(G\)
\(G_f\)
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
0/1
2/3
2/2
0/1
a
s
c
t
source
sink
1
1
2
1
2
2
\(G\)
\(G_f\)
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
1/1
1/3
2/2
1/1
a
s
c
t
source
sink
1
1
2
1
2
2
\(G\)
\(G_f\)
8.0 - Maximum Flow
a
s
c
t
source
sink
2/2
1/1
1/3
2/2
1/1
a
s
c
t
source
sink
2
1
1
1
2
2
\(G\)
\(G_f\)
8.0 - Maximum Flow
8.0 - Maximum Flow
8.0 - Maximum Flow
8.0 - Maximum Flow
a
s
c
t
b
d
source
sink
0/13
0/16
0/12
0/4
0/9
0/7
0/20
0/14
0/4