Date post: | 18-Jan-2018 |
Category: |
Documents |
Upload: | ashley-shaw |
View: | 225 times |
Download: | 0 times |
Flow Networks
Ching-Chen HuangHsi-Yue Hsiao
CONTENTS
Network flows on directed acyclic graphs
Ford-fulkerson Algorithms -Residual networks
Network flows on directed acyclic graphsNetwork flows on directed acyclic graphs
DAG is a directed graph with no cycles. Flow network: a flow network G = (V,E) is a directed graph in which each edge (u,v) ∈ E has a nonnegative capacity c(u,v) >= 0. if (u,v) E , we assume that c(u,v) = 0.∉ We distinguish two vertices in flow network , source ss and sink tt. The source produces the material at a steady rate . The sink consumes the material at a steady rate.
Objective : how much of material can be imposed through the network that it can handle.
Flow: A flow in G is a real-valued function f : V × V → R that satisfies three properties:
1. Capacity constraint : For all u,v ∈ V, we require f(u,v) ≤ c(u,v). The net flow from one vertex to another must not exceed the given c
apacity. 2. Skew symmetry : For all u,v ∈ V, we require f(u,v) = -f(v,u). The net flow from a vertex u to a vertex v is the negative of the net fl
ow in the 3. Flow conservation : For all u ∈ V - {s,t}, we require ∑ f(u,v) = 0. v ∈ V The quantity f(u,v),which can be positive or negative , is called the n
et flow from vertex u to v. The value of the flow is defined as | f | = ∑ f(s,v) that is the totat net v ∈ V
Flow out of the source.
Residual Capacity Given a flow f in network G = (V, E). Consider a pair of vertices u, v ∈ V. Residual capacity:
The amount of additional flow we can push directly from u to v.
cf (u, v) = c(u, v) f (u, v) ≥ 0 (since f (u, v) ≤ c(u, v))
Example: c(u,v) = 16, f(u,v) = 5 cf (u, v) = 11
Residual Network
Residual network: Gf = (V, Ef ),Ef = {(u, v) ∈ V × V : cf (u, v) > 0} .
Each edge of the residual network can admit a positive flow.
Given flows f1 and f2, the flow sum f1 + f2 is (f1 + f2)(u, v) = f1(u, v) + f2(u, v)
for all u, v ∈ V.
Consider the network G=(V,E) shown in the figure below. Eachedge (u,v) ∈ E in the network is labeled with its capacity c(u,v).
s
b
t
a
5
4
3
1
2
s
b
t
a
5
4
3
1
2
Flow: 1
1
1 1
Residual graph
s
b
t
a
5
4
2
1
1
1
1
s
b
t
a
5
1/4
1/3
1/1
2/2
Residual graph
s
b
t
a
5
3
2
1
2
1
1
s
b
t
a
1/5
2/4
1/3
0/1
2/2
s
b
t
a
4
2
2
1
2
1 1
2
s
b
t
a
3/5
2/4
3/3
1
2/2
s
b
t
a
2
2
3
1
2
3
2
Max Flow : 5
Ford-Fulkerson Algorithm The Ford_Fulkerson method is iterative,
Starts with f(u,v) for (u,v) ∈ V, initial flow of value 0.
The method is based on the augmenting path which is
defined as a path from s to t along which we can push
more flow and then augment flow along this path.
Procedure Ford_Fulkerson_method(G,s,t): For each edge (u,v) ∈ E[G]
do f[u,v] 0 f[v,u] 0 While there exists a path p from s to t in the resi
dual network G1 do c1(p) min{ c1(u,v):(u,v) is in p} for each edge (u,v) in p do f[u,v] f[u,v] + c1(p) f[u,v] -f[u,v]
Running time for this algorithms is O(E * |f*|) where f* is the maximum flow found by algorithm.
First three Lines take time θ(E).
The while loop of last five lines is executed at most |f*| times, since the flow value increases by at least one unit in each iteration.
Ford-Fulkerson Algorithm
Ford-Fulkerson(G, s, t) ; G = (V, E) 1 for each edge (u,v) in E 2 f(u,v) = f(v,u) = 0 3 while exists path p from s to t in residual network Gf 4 do cf (p) = min{cf (u, v) : (u, v) is in p}
5 for each edge (u,v) on p 6 f(u,v) = f(u,v) + cf (p) 7 f(v,u) = -f(u,v)
s t
v1 v2
v4v313
16
1220
144
10 4 9
s t
v1 v2
v4v313
4/16
4/1220
4/144/4
10 4 4/9
7
7
Example:
s t
v1 v2
v4v313
12
820
104
10 4 5
474
4
s t
v1 v2
v4v313
11/16 7/20
11/144/4
7/10 4 4/97/7
4/12
4
s t
v1 v2
v4v313
5
813
34
3 11 5
4 711
11
4
7
s t
v1 v2
v4v38/13
11/16 15/20
11/144/4
10 1/4 4/97/7
12/12
s t
v1 v2
v4v3
8
512
5
34
11 3 5
4 711 15
5
11
s
v1 v2
v4v312/13
11/16
11/144/4
10 1/4 97/7
12/12
t
19/20
s t
v1 v2
v4v31
512
1
3 4
11 3 97
11 19
12
11
Reference
Class Notes from Dr. Istvan Jonyer of Oklahoma State University
Class Notes from CSE 5311 of 2004, made by Hiren Patel, Ujjval Patel