lec-1 (9)
-
Upload
aanand-rishabh-daga -
Category
Documents
-
view
214 -
download
0
description
Transcript of lec-1 (9)
-
Ragesh Jaiswal
CSE, IIT Delhi
CSL 356: Analysis and Design of
Algorithms
-
Network Flow: Recap.
Ford-Fulkerson algorithm:
Given network with integer capacities, find a source-to-sink
path and push as much flow along the path as possible.
Update the residual capacity of edges in the residual graph.
Repeat.
Proof of correctness:
The algorithm terminates.
Max-flow-min-cut theorem: In every network flow the
maximum value of an flow is equal to the minimum capacity of an cut.
-
Network Flow:
Ford-Fulkerson algorithm:
Given network with integer capacities, find a source-to-sink
path and push as much flow along the path as possible.
Update the residual capacity of edges in the residual graph.
Repeat.
Proof of correctness:
The algorithm terminates.
The capacities are integers.
What if the capacities are not integers? Does the algorithm terminate?
Max-flow-min-cut theorem: In every network flow the
maximum value of an flow is equal to the minimum capacity of an cut.
-
Network Flow: A simple example where the Ford-Fulkerson algorithm does
not terminate.
s
q r s p
t
100 100
100 100
100
100
1 1
1 = 2
-
Network Flow: A simple example where the Ford-Fulkerson algorithm does
not terminate.
s
q r s p
t
1 1
1 = 2
100 100
100 100
100
100
-
Network Flow: A simple example where the Ford-Fulkerson algorithm does
not terminate.
s
q r s p
t
1 0
1 = 2
100 100
100 100
99
99
-
Network Flow: A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
s
q r s p
t
1 0
1 = 2
-
Network Flow:
s
q r s p
t
1 0
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
+1 0
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
+1 0
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
+1 0
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
+1 0
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
0 +1 +2
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
0 +1 +2
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow:
s
q r s p
t
+1 0 +2
1 = 2
A simple example where the Ford-Fulkerson algorithm does
not terminate.
Suppose inductively, the residual capacities of edges (, ), (, ), and (, ) are 1, 0, . Consider next four flows.
-
Network Flow: A simple example where the Ford-Fulkerson algorithm does
not terminate.
The total value of the flow converges to (1 + 2) =
4 + 5.
The max flow is 201.
-
Network Flow
Strongly polynomial time algorithm for max-flow
-
Network Flow: Edmonds-Karp
Max-Flow //Edmonds-Karp algorithm
- Start with a flow such that () = 0
- while there is an path in
- Find an path with least hop-length - Execute the augmenting path algorithm to obtain
- Update to and to - return
s
u
v
t
1000000
1
1000000
1000000
1000000
-
Let (, ) denote the hop-length of the shortest path from to in .
Claim 1: For all , , (, ) either remains same or increases with each flow augmentation.
Network Flow: Edmonds-Karp
-
Let (, ) denote the hop-length of the shortest path from to in .
Claim 1: For all , , (, ) either remains same or increases with each flow augmentation.
Proof:
Let be the flow just before the first augmentation that decreases the shortest distance of some vertex. Let be the flow after this augmentation.
Let be the vertex with minimum value of (, ) whose shortest path length was reduced.
Let be the vertex just before v in the shortest path from s to in .
Network Flow: Edmonds-Karp
-
Claim 1: For all , , (, ) either remains same or increases with each flow augmentation.
Proof: Let be the flow just before the first augmentation that decreases the shortest
distance of some vertex. Let be the flow after this augmentation.
Let be the vertex with minimum value of (, ) whose shortest path length was reduced.
Let be the vertex just before in the shortest path from to in .
We have:
(, ) = (, ) 1
(, ) (, )
Claim: (, ) is not present in .
Proof: Since otherwise,
(, ) (, ) + 1 (, ) + 1 = (, ).
Network Flow: Edmonds-Karp
-
Claim 1: For all , , (, ) either remains same or increases with each flow augmentation.
Proof: Let be the flow just before the first augmentation that decreases the shortest
distance of some vertex. Let be the flow after this augmentation.
Let be the vertex with minimum value of (, ) whose shortest path length was reduced.
Let be the vertex just before in the shortest path from to in .
We have:
(, ) = (, ) 1
(, ) (, )
Claim: (, ) is not present in .
Proof: Since otherwise,
(, ) (, ) + 1 (, ) + 1 = (, ).
This means that (, ) was in the augmenting path. This means: (, ) = (, ) 1 (, ) 1 (, ) 2
Network Flow: Edmonds-Karp
-
Claim 2: The total number of flow augmentations in the
EdmondsKarp algorithm is ().
Proof: An edge is said to be critical while augmentation if it is the
bottleneck edge.
Claim: Any edge can become critical at most (/2) times.
Proof:
Consider any edge (, ). Let be the flow just before (, ) becomes critical. The we have
(, ) = (, ) + 1 (1)
After this the edge (, ) disappears. Let be the flow just before the augmentation that brings back edge (, ). Then we have (, ) = (, ) + 1 (2)
Using (1) and (2) we get:
Network Flow: Edmonds-Karp
-
Claim 2: The total number of flow augmentations in the
EdmondsKarp algorithm is ().
Proof: An edge is said to be critical while augmentation if it is the bottleneck edge.
Claim: Any edge can become critical at most (/2) times.
Proof:
Consider any edge (, ). Let be the flow just before (, ) becomes critical. The we have
(, ) = (, ) + 1 (1)
After this the edge (, ) disappears. Let be the flow just before the augmentation that brings back edge (, ). Then we have (, ) = (, ) + 1 (2)
Using (1) and (2) we get:
(, ) = (, ) + 1 (, ) + 1 = (, ) + 2
The shortest distance has increased by 2 between the instances when (, ) becomes critical.
Network Flow: Edmonds-Karp
-
Claim 2: The total number of flow augmentations in the
EdmondsKarp algorithm is ().
Theorem: The running time of Edmonds-Karp algorithm is
(2).
Network Flow: Edmonds-Karp
-
End