0% found this document useful (0 votes)
5 views

Sec Augmenting Path Algorithms

The document outlines the Augmenting Path Algorithm, a greedy algorithm used to find maximum flow in a flow network. It describes the process of initializing flow, finding augmenting paths in the residual graph, and augmenting flow along these paths until no more augmenting paths exist. Additionally, it explains the construction of the residual graph based on the original graph and current flow.

Uploaded by

julia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Sec Augmenting Path Algorithms

The document outlines the Augmenting Path Algorithm, a greedy algorithm used to find maximum flow in a flow network. It describes the process of initializing flow, finding augmenting paths in the residual graph, and augmenting flow along these paths until no more augmenting paths exist. Additionally, it explains the construction of the residual graph based on the original graph and current flow.

Uploaded by

julia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 152

12 Augmenting Path Algorithms

Greedy-algorithm:
ñ start with f (e) = 0 everywhere
ñ find an s-t path with f (e) < c(e) on every edge
ñ augment flow along the path
ñ repeat as long as possible
1

0 0|1
0|2 0

s 0|30 t

0|1 0
0 0|2

© Harald Räcke 443/612


12 Augmenting Path Algorithms
Greedy-algorithm:
ñ start with f (e) = 0 everywhere
ñ find an s-t path with f (e) < c(e) on every edge
ñ augment flow along the path
ñ repeat as long as possible
1

0|1
20 |20 0
0

20
s 0|30 t

0|1
0 20 |20
0

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 443/612
12 Augmenting Path Algorithms
Greedy-algorithm:
ñ start with f (e) = 0 everywhere
ñ find an s-t path with f (e) < c(e) on every edge
ñ augment flow along the path
ñ repeat as long as possible
1

0|1
|20 0
20

s 20|30 t

0|1
0 |20
20

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 443/612
12 Augmenting Path Algorithms
Greedy-algorithm:
ñ start with f (e) = 0 everywhere
ñ find an s-t path with f (e) < c(e) on every edge
ñ augment flow along the path
ñ repeat as long as possible
1

0|1
|20 0
20

s 20|30 t

0|1
0 |20
20

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 443/612
The Residual Graph
From the graph G = (V , E, c) and the current flow f we construct
an auxiliary graph Gf = (V , Ef , cf ) (the residual graph):

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 444/612
The Residual Graph
From the graph G = (V , E, c) and the current flow f we construct
an auxiliary graph Gf = (V , Ef , cf ) (the residual graph):
ñ Suppose the original graph has edges e1 = (u, v), and
e2 = (v, u) between u and v.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 444/612
The Residual Graph
From the graph G = (V , E, c) and the current flow f we construct
an auxiliary graph Gf = (V , Ef , cf ) (the residual graph):
ñ Suppose the original graph has edges e1 = (u, v), and
e2 = (v, u) between u and v.
ñ Gf has edge e10 with capacity max{0, c(e1 ) − f (e1 ) + f (e2 )}
and e20 with with capacity max{0, c(e2 ) − f (e2 ) + f (e1 )}.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 444/612
The Residual Graph
From the graph G = (V , E, c) and the current flow f we construct
an auxiliary graph Gf = (V , Ef , cf ) (the residual graph):
ñ Suppose the original graph has edges e1 = (u, v), and
e2 = (v, u) between u and v.
ñ Gf has edge e10 with capacity max{0, c(e1 ) − f (e1 ) + f (e2 )}
and e20 with with capacity max{0, c(e2 ) − f (e2 ) + f (e1 )}.

10|20
G u
14|16
v

Gf u
12
24 v

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 444/612
Augmenting Path Algorithm

Definition 1
An augmenting path with respect to flow f , is a path from s to t
in the auxiliary graph Gf that contains only edges with non-zero
capacity.

Algorithm 46 FordFulkerson(G = (V , E, c))


1: Initialize f (e) ← 0 for all edges.
2: while ∃ augmenting path p in Gf do
3: augment as much flow along p as possible.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 445/612
Augmenting Path Algorithm

Definition 1
An augmenting path with respect to flow f , is a path from s to t
in the auxiliary graph Gf that contains only edges with non-zero
capacity.

Algorithm 46 FordFulkerson(G = (V , E, c))


1: Initialize f (e) ← 0 for all edges.
2: while ∃ augmenting path p in Gf do
3: augment as much flow along p as possible.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 445/612
Augmenting Path Algorithm

2 0|4 4

G 0|
1 0 0|2 0|8 0|6 10
0|

s 0|10 3 0|9 5 0|10 t

Flow value = 0

2 4 4
0

Gf 10 0 0 6 0
8 10
2 0
0

s 10 3
9 5
10 t
0 0 0

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 0|
1 0 0|2 0|8 0|6 10
0|

s 0|10 3 0|9 5 0|10 t

Flow value = 0

2 4 4
0

Gf 10 0 0 6 0
8 10
2 0
0

s 10 3
9 5
10 t
0 0 0

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 8 0|
8 |10 0|2 0|8 0|6 10
0

8
s 0|10 3 0|9 5 0|10 t

Flow value = 8

2 4 4
0

Gf 10 0 0 6 0
8 10
2 0
0

s 10 3
9 5
10 t
0 0 0

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 0|
10 0|2 8|8 0|6 10
8|

s 0|10 3 0|9 5 8|10 t

Flow value = 8

2 4 4
0

Gf 2 0 8 6 0
0 10
2 0
8

s 10 3
9 5 2 t
0 0 8

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 0|
10 0|2 8|8 0|6 10
8|

s 0|10 3 0|9 5 8|10 t

Flow value = 8

2 4 4
0

Gf 2 0 8 6 0
0 10
2 0
8

s 10 3
9 5 2 t
0 0 8

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 2 0|
10 |10 0|2 8|8 0|6 10
8

2 10
s 0|10 3 0|9 5 8|10 t

Flow value = 10

2 4 4
0

Gf 2 0 8 6 0
0 10
2 0
8

s 10 3
9 5 2 t
0 0 8

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 0|
0 8|8 10
|1 2|2 0|6
10

s 0|10 3 2|9 5 10|10 t

Flow value = 10

2 4 4
0

Gf 0 2 8 6 0
0 10
0 0
10

s 10 3 7 5
0 t
0 2 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 0|
0 8|8 10
|1 2|2 0|6
10

s 0|10 3 2|9 5 10|10 t

Flow value = 10

2 4 4
0

Gf 0 2 8 6 0
0 10
0 0
10

s 10 3 7 5
0 t
0 2 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 6
6
0|
10 8|8 10
10| 2|2 0|6

6 8
s 0|10 3 2|9 5 10|10 t

Flow value = 16

2 4 4
0

Gf 0 2 8 6 0
0 10
0 0
10

s 10 3 7 5
0 t
0 2 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 6|
0 8|8 10
|1 2|2 6|6
10

s 6|10 3 8|9 5 10|10 t

Flow value = 16

2 4 4
0

Gf 0 2 8 0 6
0 4
0 6
10

s 4 3 1 5
0 t
6 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 0|4 4

G 6|
0 8|8 10
|1 2|2 6|6
10

s 6|10 3 8|9 5 10|10 t

Flow value = 16

2 4 4
0

Gf 0 2 8 0 6
0 4
0 6
10

s 4 3 1 5
0 t
6 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2
2 0|4 4

G 0
8
6|
10 8|8 10
10| 2|2
2|2 6|6

8
s 6|10 3 8|9 5 10|10 t

Flow value = 18

2 4 4
0

Gf 0 2 8 0 6
0 4
0 6
10

s 4 3 1 5
0 t
6 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 2|4 4

G 68|
0 8|8 10
|1 0|2
2|2 6|6
10

s 8|10 3 8|9 5 10|10 t

Flow value = 18

2 2 4
2

Gf 0 0 8 0 8
0 2
2 6
10

s 2 3 1 5
0 t
8 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 2|4 4

G 68|
0 8|8 10
|1 0|2
2|2 6|6
10

s 8|10 3 8|9 5 10|10 t

Flow value = 18

2 2 4
2

Gf 0 0 8 0 8
0 2
2 6
10

s 2 3 1 5
0 t
8 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

3
2 2|4 4

G 7 9
68|
10 8|8 10
10| 0|2
2|2 6|6

9 9
s 8|10 3 8|9 5 10|10 t

Flow value = 19

2 2 4
2

Gf 0 0 8 0 8
0 2
2 6
10

s 2 3 1 5
0 t
8 8 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 3|4 4

G 69|
0 7|8 1
|1 0|2
2|2 6|6 0
10

s 9|10 3 9|9 5 10|10 t

Flow value = 19

2 1 4
3

Gf 0 0 7 0 9
1 1
2 6
10

s 1 3
0 5
0 t
9 9 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

2 3|4 4

G 69|
0 7|8 1
|1 0|2
2|2 6|6 0
10

s 9|10 3 9|9 5 10|10 t

Flow value = 19

2 1 4
3

Gf 0 0 7 0 9
1 1
2 6
10

s 1 3
0 5
0 t
9 9 10

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 446/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

Theorem 2
A flow f is a maximum flow iff there are no augmenting paths.

Theorem 3
The value of a maximum flow is equal to the value of a minimum
cut.

Proof.
Let f be a flow. The following are equivalent:
1. There exists a cut A, B such that val(f ) = cap(A, B).
2. Flow f is a maximum flow.
3. There is no augmenting path w.r.t. f .

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 447/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

1. =⇒ 2.
This we already showed.

2. =⇒ 3.
If there were an augmenting path, we could improve the flow.
Contradiction.

3. =⇒ 1.
ñ Let f be a flow with no augmenting paths.
ñ Let A be the set of vertices reachable from s in the residual
graph along non-zero capacity edges.
ñ Since there is no augmenting path we have s ∈ A and t ∉ A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 448/612
Augmenting Path Algorithm

val(f )

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 449/612
Augmenting Path Algorithm

X X
val(f ) = f (e) − f (e)
e∈out(A) e∈into(A)

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 449/612
Augmenting Path Algorithm

X X
val(f ) = f (e) − f (e)
e∈out(A) e∈into(A)
X
= c(e)
e∈out(A)

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 449/612
Augmenting Path Algorithm

X X
val(f ) = f (e) − f (e)
e∈out(A) e∈into(A)
X
= c(e)
e∈out(A)

= cap(A, V \ A)

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 449/612
Augmenting Path Algorithm

X X
val(f ) = f (e) − f (e)
e∈out(A) e∈into(A)
X
= c(e)
e∈out(A)

= cap(A, V \ A)

This finishes the proof.

Here the first equality uses the flow value lemma, and the
second exploits the fact that the flow along incoming edges
must be 0 as the residual graph does not have edges leaving A.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 449/612
Analysis

Assumption:
All capacities are integers between 1 and C.

Invariant:
Every flow value f (e) and every residual capacity cf (e) remains
integral troughout the algorithm.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 450/612
Analysis

Assumption:
All capacities are integers between 1 and C.

Invariant:
Every flow value f (e) and every residual capacity cf (e) remains
integral troughout the algorithm.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 450/612
Lemma 4
The algorithm terminates in at most val(f ∗ ) ≤ nC iterations,
where f ∗ denotes the maximum flow. Each iteration can be
implemented in time O(m). This gives a total running time of
O(nmC).

Theorem 5
If all capacities are integers, then there exists a maximum flow
for which every flow value f (e) is integral.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 451/612
Lemma 4
The algorithm terminates in at most val(f ∗ ) ≤ nC iterations,
where f ∗ denotes the maximum flow. Each iteration can be
implemented in time O(m). This gives a total running time of
O(nmC).

Theorem 5
If all capacities are integers, then there exists a maximum flow
for which every flow value f (e) is integral.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 451/612
A Bad Input

Problem: The running time may not be polynomial.

0|2
000 00
0|2 0

s 0|1 t

0|2 0
00 00
0 0|2

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 452/612
A Bad Input

Problem: The running time may not be polynomial.

00
20 0
20
00
0 0
s t

1 00
0 20
20
00
0

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

00
20 0
20
00
0 0
s t

1 00
0 20
20
00
0

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

99
19 0
20
00
1 1
s t

0 99
0 19
20
00
1

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

99
19 0
20
00
1 1
s t

0 99
0 19
20
00
1

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

99
19 1
19
99
1 0
s t

1 99
1 19
19
99
1

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

99
19 1
19
99
1 0
s t

1 99
1 19
19
99
1

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

98
19 1
19
99
2 1
s t

0 98
1 19
19
99
2

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

98
19 1
19
99
2 1
s t

0 98
1 19
19
99
2

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

98
19 2
19
98
2 0
s t

1 98
2 19
19
98
2

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Bad Input

Problem: The running time may not be polynomial.

98
19 2
19
98
2 0
s t

1 98
2 19
19
98
2

Question:
Can we tweak the algorithm so that the running time is
polynomial in the input length?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 453/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 1 5

∞ ∞

∞ ∞


s ∞ 3 r 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r2 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 1 5

∞ ∞

∞ ∞


s ∞ 3 r 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r2 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r2 5

∞ ∞

∞ ∞


s ∞ 3
0 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r + r2 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r2 5

∞ ∞

∞ ∞


s ∞ 3
0 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r + r2 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2
0 5

∞ ∞

∞ ∞


s ∞ 3 r2 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2
0 5

∞ ∞

∞ ∞


s ∞ 3 r2 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r2 5

∞ ∞

∞ ∞


s ∞ 3
0 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r3 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r2 5

∞ ∞

∞ ∞


s ∞ 3
0 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4 r3 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r4 5

∞ ∞

∞ ∞


s ∞ 3 r3 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4
0 7

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
A Pathological Input
1 √
Let r = 2 ( 5 − 1). Then r n+2 = r n − r n+1 .

2 r4 5

∞ ∞

∞ ∞


s ∞ 3 r3 6 ∞ t
∞ ∞ ∞

∞ ∞

∞ ∞

4
0 7

Running time may be infinite!!!

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 454/612
12.1 The Generic Augmenting Path Algorithm
© Harald Räcke 455/612
How to choose augmenting paths?

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:
ñ Choose path with maximum bottleneck capacity.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:
ñ Choose path with maximum bottleneck capacity.
ñ Choose path with sufficiently large bottleneck capacity.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:
ñ Choose path with maximum bottleneck capacity.
ñ Choose path with sufficiently large bottleneck capacity.
ñ Choose the shortest augmenting path.

12.1 The Generic Augmenting Path Algorithm


© Harald Räcke 455/612
Overview: Shortest Augmenting Paths

Lemma 6
The length of the shortest augmenting path never decreases.

Lemma 7
After at most O(m) augmentations, the length of the shortest
augmenting path strictly increases.

12.2 Shortest Augmenting Paths


© Harald Räcke 456/612
Overview: Shortest Augmenting Paths

Lemma 6
The length of the shortest augmenting path never decreases.

Lemma 7
After at most O(m) augmentations, the length of the shortest
augmenting path strictly increases.

12.2 Shortest Augmenting Paths


© Harald Räcke 456/612
Overview: Shortest Augmenting Paths

Lemma 6
The length of the shortest augmenting path never decreases.

Lemma 7
After at most O(m) augmentations, the length of the shortest
augmenting path strictly increases.

12.2 Shortest Augmenting Paths


© Harald Räcke 456/612
Overview: Shortest Augmenting Paths

These two lemmas give the following theorem:

Theorem 8
The shortest augmenting path algorithm performs at most
O(mn) augmentations. This gives a running time of O(m2 n).

Proof.
ñ We can find the shortest augmenting paths in time O(m)
via BFS.
ñ O(m) augmentations for paths of exactly k < n edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 457/612
Overview: Shortest Augmenting Paths

These two lemmas give the following theorem:

Theorem 8
The shortest augmenting path algorithm performs at most
O(mn) augmentations. This gives a running time of O(m2 n).

Proof.
ñ We can find the shortest augmenting paths in time O(m)
via BFS.
ñ O(m) augmentations for paths of exactly k < n edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 457/612
Overview: Shortest Augmenting Paths

These two lemmas give the following theorem:

Theorem 8
The shortest augmenting path algorithm performs at most
O(mn) augmentations. This gives a running time of O(m2 n).

Proof.
ñ We can find the shortest augmenting paths in time O(m)
via BFS.
ñ O(m) augmentations for paths of exactly k < n edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 457/612
Overview: Shortest Augmenting Paths

These two lemmas give the following theorem:

Theorem 8
The shortest augmenting path algorithm performs at most
O(mn) augmentations. This gives a running time of O(m2 n).

Proof.
ñ We can find the shortest augmenting paths in time O(m)
via BFS.
ñ O(m) augmentations for paths of exactly k < n edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 457/612
Shortest Augmenting Paths

Define the level `(v) of a node as the length of the shortest s-v
path in Gf .

12.2 Shortest Augmenting Paths


© Harald Räcke 458/612
Shortest Augmenting Paths

Define the level `(v) of a node as the length of the shortest s-v
path in Gf .

Let LG denote the subgraph of the residual graph Gf that


contains only those edges (u, v) with `(v) = `(u) + 1.

12.2 Shortest Augmenting Paths


© Harald Räcke 458/612
Shortest Augmenting Paths

Define the level `(v) of a node as the length of the shortest s-v
path in Gf .

Let LG denote the subgraph of the residual graph Gf that


contains only those edges (u, v) with `(v) = `(u) + 1.

A path P is a shortest s-u path in Gf if it is a an s-u path in LG .

12.2 Shortest Augmenting Paths


© Harald Räcke 458/612
Shortest Augmenting Paths

Define the level `(v) of a node as the length of the shortest s-v
path in Gf .

Let LG denote the subgraph of the residual graph Gf that


contains only those edges (u, v) with `(v) = `(u) + 1.

A path P is a shortest s-u path in Gf if it is a an s-u path in LG .

2 4 4
0
Gf
10 0 2 6 0
LG 6 10
2 0
0

s 10 3
9 5
10 t
0 0 0

12.2 Shortest Augmenting Paths


© Harald Räcke 458/612
In the following we assume that the residual graph Gf does not
contain zero capacity edges.

This means, we construct it in the usual sense and then delete


edges of zero capacity.

12.2 Shortest Augmenting Paths


© Harald Räcke 459/612
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
ñ Back edges are added to all edges that don’t have back
edges so far.
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
ñ Back edges are added to all edges that don’t have back
edges so far.
These changes cannot decrease the distance between s and t.
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
ñ Back edges are added to all edges that don’t have back
edges so far.
These changes cannot decrease the distance between s and t.

2 4 4
0
Gf
10 0 2 6 0
LG 6 10
2 0
0

s 10 3
9 5
10 t
0 0 0
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
ñ Back edges are added to all edges that don’t have back
edges so far.
These changes cannot decrease the distance between s and t.

2 4 4
0
Gf
10 0 2 6 0
LG 6 10
2 0
0

s 10 3
9 5
10 t
0 0 0
Shortest Augmenting Path

First Lemma:
The length of the shortest augmenting path never decreases.

After an augmentation Gf changes as follows:


ñ Bottleneck edges on the chosen path are deleted.
ñ Back edges are added to all edges that don’t have back
edges so far.
These changes cannot decrease the distance between s and t.

2 4 4
0
Gf
10 0 2 6 0
LG 6 10
2 0
0

s 1 3
0 5 1 t
9
0 9
0 9
0
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.

Let EL denote the set of edges in graph LG at the beginning of a


round when the distance between s and t is k.
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.

Let EL denote the set of edges in graph LG at the beginning of a


round when the distance between s and t is k.

An s-t path in Gf that uses edges not in EL has length larger


than k, even when considering edges added to Gf during the
round.
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.

Let EL denote the set of edges in graph LG at the beginning of a


round when the distance between s and t is k.

An s-t path in Gf that uses edges not in EL has length larger


than k, even when considering edges added to Gf during the
round.

In each augmentation one edge is deleted from EL .

2 4 4
0
Gf
10 0 2 6 0
EL 6 10
2 0
0

s 10 3
9 5
10 t
0 0 0
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.

Let EL denote the set of edges in graph LG at the beginning of a


round when the distance between s and t is k.

An s-t path in Gf that uses edges not in EL has length larger


than k, even when considering edges added to Gf during the
round.

In each augmentation one edge is deleted from EL .

2 4 4
0
Gf
10 0 2 6 0
EL 6 10
2 0
0

s 10 3
9 5
10 t
0 0 0
Shortest Augmenting Path
Second Lemma: After at most m augmentations the length of
the shortest augmenting path strictly increases.

Let EL denote the set of edges in graph LG at the beginning of a


round when the distance between s and t is k.

An s-t path in Gf that uses edges not in EL has length larger


than k, even when considering edges added to Gf during the
round.

In each augmentation one edge is deleted from EL .

2 4 4
0
Gf
10 0 2 6 0
EL 6 10
2 0
0

s 1 3
0 5 1 t
9
0 9
0 9
0
Shortest Augmenting Paths

Theorem 9
The shortest augmenting path algorithm performs at most
O(mn) augmentations. Each augmentation can be performed in
time O(m).

Theorem 10 (without proof)


There exist networks with m = Θ(n2 ) that require O(mn)
augmentations, when we restrict ourselves to only augment
along shortest augmenting paths.

Note:
There always exists a set of m augmentations that gives a
maximum flow.

12.2 Shortest Augmenting Paths


© Harald Räcke 462/612
Shortest Augmenting Paths

Theorem 9
The shortest augmenting path algorithm performs at most
O(mn) augmentations. Each augmentation can be performed in
time O(m).

Theorem 10 (without proof)


There exist networks with m = Θ(n2 ) that require O(mn)
augmentations, when we restrict ourselves to only augment
along shortest augmenting paths.

Note:
There always exists a set of m augmentations that gives a
maximum flow.

12.2 Shortest Augmenting Paths


© Harald Räcke 462/612
Shortest Augmenting Paths

Theorem 9
The shortest augmenting path algorithm performs at most
O(mn) augmentations. Each augmentation can be performed in
time O(m).

Theorem 10 (without proof)


There exist networks with m = Θ(n2 ) that require O(mn)
augmentations, when we restrict ourselves to only augment
along shortest augmenting paths.

Note:
There always exists a set of m augmentations that gives a
maximum flow.

12.2 Shortest Augmenting Paths


© Harald Räcke 462/612
Shortest Augmenting Paths

Theorem 9
The shortest augmenting path algorithm performs at most
O(mn) augmentations. Each augmentation can be performed in
time O(m).

Theorem 10 (without proof)


There exist networks with m = Θ(n2 ) that require O(mn)
augmentations, when we restrict ourselves to only augment
along shortest augmenting paths.

Note:
There always exists a set of m augmentations that gives a
maximum flow.

12.2 Shortest Augmenting Paths


© Harald Räcke 462/612
Shortest Augmenting Paths

When sticking to shortest augmenting paths we cannot improve


(asymptotically) on the number of augmentations.

However, we can improve the running time to O(mn2 ) by


improving the running time for finding an augmenting path
(currently we assume O(m) per augmentation for this).

12.2 Shortest Augmenting Paths


© Harald Räcke 463/612
Shortest Augmenting Paths

When sticking to shortest augmenting paths we cannot improve


(asymptotically) on the number of augmentations.

However, we can improve the running time to O(mn2 ) by


improving the running time for finding an augmenting path
(currently we assume O(m) per augmentation for this).

12.2 Shortest Augmenting Paths


© Harald Räcke 463/612
Shortest Augmenting Paths

We maintain a subset EL of the edges of Gf with the guarantee


that a shortest s-t path using only edges from EL is a shortest
augmenting path.

With each augmentation some edges are deleted from EL .

When EL does not contain an s-t path anymore the distance


between s and t strictly increases.

Note that EL is not the set of edges of the level graph but a
subset of level-graph edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 464/612
Shortest Augmenting Paths

We maintain a subset EL of the edges of Gf with the guarantee


that a shortest s-t path using only edges from EL is a shortest
augmenting path.

With each augmentation some edges are deleted from EL .

When EL does not contain an s-t path anymore the distance


between s and t strictly increases.

Note that EL is not the set of edges of the level graph but a
subset of level-graph edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 464/612
Shortest Augmenting Paths

We maintain a subset EL of the edges of Gf with the guarantee


that a shortest s-t path using only edges from EL is a shortest
augmenting path.

With each augmentation some edges are deleted from EL .

When EL does not contain an s-t path anymore the distance


between s and t strictly increases.

Note that EL is not the set of edges of the level graph but a
subset of level-graph edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 464/612
Shortest Augmenting Paths

We maintain a subset EL of the edges of Gf with the guarantee


that a shortest s-t path using only edges from EL is a shortest
augmenting path.

With each augmentation some edges are deleted from EL .

When EL does not contain an s-t path anymore the distance


between s and t strictly increases.

Note that EL is not the set of edges of the level graph but a
subset of level-graph edges.

12.2 Shortest Augmenting Paths


© Harald Räcke 464/612
Suppose that the initial distance between s and t in Gf is k.

EL is initialized as the level graph LG .

Perform a DFS search to find a path from s to t using edges from


EL .

Either you find t after at most n steps, or you end at a node v


that does not have any outgoing edges.

You can delete incoming edges of v from EL .

12.2 Shortest Augmenting Paths


© Harald Räcke 465/612
Suppose that the initial distance between s and t in Gf is k.

EL is initialized as the level graph LG .

Perform a DFS search to find a path from s to t using edges from


EL .

Either you find t after at most n steps, or you end at a node v


that does not have any outgoing edges.

You can delete incoming edges of v from EL .

12.2 Shortest Augmenting Paths


© Harald Räcke 465/612
Suppose that the initial distance between s and t in Gf is k.

EL is initialized as the level graph LG .

Perform a DFS search to find a path from s to t using edges from


EL .

Either you find t after at most n steps, or you end at a node v


that does not have any outgoing edges.

You can delete incoming edges of v from EL .

12.2 Shortest Augmenting Paths


© Harald Räcke 465/612
Suppose that the initial distance between s and t in Gf is k.

EL is initialized as the level graph LG .

Perform a DFS search to find a path from s to t using edges from


EL .

Either you find t after at most n steps, or you end at a node v


that does not have any outgoing edges.

You can delete incoming edges of v from EL .

12.2 Shortest Augmenting Paths


© Harald Räcke 465/612
Suppose that the initial distance between s and t in Gf is k.

EL is initialized as the level graph LG .

Perform a DFS search to find a path from s to t using edges from


EL .

Either you find t after at most n steps, or you end at a node v


that does not have any outgoing edges.

You can delete incoming edges of v from EL .

12.2 Shortest Augmenting Paths


© Harald Räcke 465/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
Let a phase of the algorithm be defined by the time between two
augmentations during which the distance between s and t
strictly increases.

Initializing EL for the phase takes time O(m).

The total cost for searching for augmenting paths during a


phase is at most O(mn), since every search (successful (i.e.,
reaching t) or unsuccessful) decreases the number of edges in
EL and takes time O(n).

The total cost for performing an augmentation during a phase is


only O(n). For every edge in the augmenting path one has to
update the residual graph Gf and has to check whether the edge
is still in EL for the next search.

There are at most n phases. Hence, total cost is O(mn2 ).

12.2 Shortest Augmenting Paths


© Harald Räcke 466/612
How to choose augmenting paths?
ñ We need to find paths efficiently.

12.3 Capacity Scaling


© Harald Räcke 467/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

12.3 Capacity Scaling


© Harald Räcke 467/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:

12.3 Capacity Scaling


© Harald Räcke 467/612
How to choose augmenting paths?
ñ We need to find paths efficiently.
ñ We want to guarantee a small number of iterations.

Several possibilities:
ñ Choose path with maximum bottleneck capacity.
ñ Choose path with sufficiently large bottleneck capacity.
ñ Choose the shortest augmenting path.

12.3 Capacity Scaling


© Harald Räcke 467/612
Capacity Scaling

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling
Intuition:
ñ Choosing a path with the highest bottleneck increases the
flow as much as possible in a single step.

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling
Intuition:
ñ Choosing a path with the highest bottleneck increases the
flow as much as possible in a single step.
ñ Don’t worry about finding the exact bottleneck.

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling
Intuition:
ñ Choosing a path with the highest bottleneck increases the
flow as much as possible in a single step.
ñ Don’t worry about finding the exact bottleneck.
ñ Maintain scaling parameter ∆.

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling
Intuition:
ñ Choosing a path with the highest bottleneck increases the
flow as much as possible in a single step.
ñ Don’t worry about finding the exact bottleneck.
ñ Maintain scaling parameter ∆.
ñ Gf (∆) is a sub-graph of the residual graph Gf that contains
only edges with capacity at least ∆.

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling
Intuition:
ñ Choosing a path with the highest bottleneck increases the
flow as much as possible in a single step.
ñ Don’t worry about finding the exact bottleneck.
ñ Maintain scaling parameter ∆.
ñ Gf (∆) is a sub-graph of the residual graph Gf that contains
only edges with capacity at least ∆.

Gf 1 Gf (99) 1
5 5
11 0 87 11
0 0
s t s t
1 2 2
0 13 20 13 20
3 3
0
2 2

12.3 Capacity Scaling


© Harald Räcke 468/612
Capacity Scaling

Algorithm 2 maxflow(G, s, t, c)
1: foreach e ∈ E do fe ← 0;
2: ∆ ← 2dlog2 Ce
3: while ∆ ≥ 1 do
4: Gf (∆) ← ∆-residual graph
5: while there is augmenting path P in Gf (∆) do
6: f ← augment(f , c, P )
7: update(Gf (∆))
8: ∆ ← ∆/2
9: return f

12.3 Capacity Scaling


© Harald Räcke 469/612
Capacity Scaling

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

Assumption:
All capacities are integers between 1 and C.

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

Assumption:
All capacities are integers between 1 and C.

Invariant:
All flows and capacities are/remain integral throughout the
algorithm.

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

Assumption:
All capacities are integers between 1 and C.

Invariant:
All flows and capacities are/remain integral throughout the
algorithm.

Correctness:
The algorithm computes a maxflow:
ñ because of integrality we have Gf (1) = Gf

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

Assumption:
All capacities are integers between 1 and C.

Invariant:
All flows and capacities are/remain integral throughout the
algorithm.

Correctness:
The algorithm computes a maxflow:
ñ because of integrality we have Gf (1) = Gf
ñ therefore after the last phase there are no augmenting
paths anymore

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

Assumption:
All capacities are integers between 1 and C.

Invariant:
All flows and capacities are/remain integral throughout the
algorithm.

Correctness:
The algorithm computes a maxflow:
ñ because of integrality we have Gf (1) = Gf
ñ therefore after the last phase there are no augmenting
paths anymore
ñ this means we have a maximum flow.

12.3 Capacity Scaling


© Harald Räcke 470/612
Capacity Scaling

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

Lemma 11
There are dlog Ce iterations over ∆.
Proof: obvious.

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

Lemma 11
There are dlog Ce iterations over ∆.
Proof: obvious.

Lemma 12
Let f be the flow at the end of a ∆-phase. Then the maximum
flow is smaller than val(f ) + m∆.
Proof: less obvious, but simple:

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

Lemma 11
There are dlog Ce iterations over ∆.
Proof: obvious.

Lemma 12
Let f be the flow at the end of a ∆-phase. Then the maximum
flow is smaller than val(f ) + m∆.
Proof: less obvious, but simple:
ñ There must exist an s-t cut in Gf (∆) of zero capacity.

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

Lemma 11
There are dlog Ce iterations over ∆.
Proof: obvious.

Lemma 12
Let f be the flow at the end of a ∆-phase. Then the maximum
flow is smaller than val(f ) + m∆.
Proof: less obvious, but simple:
ñ There must exist an s-t cut in Gf (∆) of zero capacity.
ñ In Gf this cut can have capacity at most m∆.

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

Lemma 11
There are dlog Ce iterations over ∆.
Proof: obvious.

Lemma 12
Let f be the flow at the end of a ∆-phase. Then the maximum
flow is smaller than val(f ) + m∆.
Proof: less obvious, but simple:
ñ There must exist an s-t cut in Gf (∆) of zero capacity.
ñ In Gf this cut can have capacity at most m∆.
ñ This gives me an upper bound on the flow that I can still
add.

12.3 Capacity Scaling


© Harald Räcke 471/612
Capacity Scaling

12.3 Capacity Scaling


© Harald Räcke 472/612
Capacity Scaling

Lemma 13
There are at most 2m augmentations per scaling-phase.

12.3 Capacity Scaling


© Harald Räcke 472/612
Capacity Scaling

Lemma 13
There are at most 2m augmentations per scaling-phase.
Proof:
ñ Let f be the flow at the end of the previous phase.

12.3 Capacity Scaling


© Harald Räcke 472/612
Capacity Scaling

Lemma 13
There are at most 2m augmentations per scaling-phase.
Proof:
ñ Let f be the flow at the end of the previous phase.
ñ val(f ∗ ) ≤ val(f ) + 2m∆

12.3 Capacity Scaling


© Harald Räcke 472/612
Capacity Scaling

Lemma 13
There are at most 2m augmentations per scaling-phase.
Proof:
ñ Let f be the flow at the end of the previous phase.
ñ val(f ∗ ) ≤ val(f ) + 2m∆
ñ Each augmentation increases flow by ∆.

12.3 Capacity Scaling


© Harald Räcke 472/612
Capacity Scaling

Lemma 13
There are at most 2m augmentations per scaling-phase.
Proof:
ñ Let f be the flow at the end of the previous phase.
ñ val(f ∗ ) ≤ val(f ) + 2m∆
ñ Each augmentation increases flow by ∆.

Theorem 14
We need O(m log C) augmentations. The algorithm can be
implemented in time O(m2 log C).

12.3 Capacity Scaling


© Harald Räcke 472/612

You might also like