Chapter 5 Networks
Download
Report
Transcript Chapter 5 Networks
Graph Theory
Chapter 5
Networks
大葉大學(Da-Yeh Univ.)
資訊工程系(Dept. CSIE)
黃鈴玲(Lingling Huang)
Outline
5.1
5.2
5.3
5.5
5.6
An Introduction to Networks
The Max-Flow Min-Cut Theorem
A Max-Flow Min-Cut Algorithm
Connectivity and Edge-Connectivity
Menger’s Theorem
Ch5-2
Copyright 黃鈴玲
5.1 An Introduction to
Networks
※ Motivation:
Suppose that a World Series baseball game
is to be played in city B. Since the team from
city A is playing in this game, many fans from A
wish to fly to B on short notice. Several flight
routes exist from A to B. The maximum number
of seats available on every such flight is known.
We wish to determine the maximum number of
fans that can be flown from A to B and the routes
they should take. How can this be done?
Ch5-3
Copyright 黃鈴玲
Definition:
A network N is a digraph D with two
distinguished vertices s and t, called the source
and sink, respectively, and a nonnegative
integer-valued function c on E(D), called the
capacity function of N.
The function c takes on nonnegative integers
and .
The digraph D is called the underlying digraph
of N.
If a = (u, v) is an arc of D, then c(a) = c(u, v) is
called the capacity of a.
Ch5-4
Copyright 黃鈴玲
A network N :
x
3
1
z
5
source s
t sink
4
1
2
y
c(x, y)=4, c(t, z)=5
Ch5-5
Copyright 黃鈴玲
Definition:
For a vertex x in a digraph D,
the out-neighborhood and inneighborhood of x are defined by
N+(x) = { y V(D) | (x, y) E(D) } and
N-(x) = { y V(D) | (y, x) E(D) } ,
respectively.
x
3
1
z
5
4
s
1
t
N+(x) = { y, z }
N-(x) = { s }
2
y
Ch5-6
Copyright 黃鈴玲
Definition:
A flow in N is an integer-valued function
f on E(D) such that
0 f(a) c(a) for every a E(D)
and
(5.1)
(5.2)
The net flow out of a vertex x is defined as
While the net flow into x is
Ch5-7
Copyright 黃鈴玲
Definition:
For an arc a = (x, y) of N, the value
f(a) = f(x, y) is called the flow in or along
arc a, and may be thought of as the amount
of material that is transported under the
flow f along the arc (x, y).
Note.
Equation (5.1) says that flow in an arc can never
exceed its capacity and is called the capacity
constraint.
Condition (5.2) is referred to as the conservation
equation. (出=進)
Ch5-8
Copyright 黃鈴玲
Definition:
The value f(N) of the flow f in N is the net
flow out of the source s that is,
Ch5-9
Copyright 黃鈴玲
Figure 5-2
x
y
3,3
z
3,2
N:
5,3
S
6,2
1,1
4,2
5,3
u
4,4
v
t
3,1
4,1
3,2
w
The numbers on an arc: capacity, flow
f (s, x) = 3, c(s, x)=5 f (N) = 4
Ch5-10
Copyright 黃鈴玲
(有時需考慮由一群點X流進另一群點Y的flow量)
Definition:
Let X, Y V(D),
(X,Y) = {(x, y) E(D) | x X, y Y }.
A cut in N is a set of arcs of the type (P, P )
in D, where P V(D), containing s but not t
and where P= V(D) - P.
Definition:
Suppose c is the capacity of the cut. Further,
if f is a flow in N, then the flow from P to P is
f (P, P ) and the flow from P to P is f ( P , P).
Ch5-11
Copyright 黃鈴玲
Figure 5-2
x
y
3,3
z
3,2
N:
5,3
S
6,2
1,1
4,2
5,3
u
4,4
v
t
3,1
4,1
3,2
w
eg: If P = {s, x} then {(x,y), (s,u)} is a cut.
If P = {s, y, w}
then {(s,x), (s,u), (y,u), (y,z), (w,v)} is a cut.
c(P, P )=16, f(P,P )=9
Ch5-12
Copyright 黃鈴玲
Thm 5.1
Let N be a network and f a flow in N. If
(P, P )is a cut of N, then the value of the flow
in N is given by
f (N )
f
( x ,y) -
( x, y )( P,P )
f
( y ,x )
( y, x )( P,P )
f ( P,P ) - f ( P, P )
(flow from P to P ) - (flow from P to P )
pf: By definition,
f (N )
f ( s, x ) -
x N ( s )
f ( x, s)
-
x N ( s )
Ch5-13
Copyright 黃鈴玲
which is the net flow out of source s. If x
P – {s}, then it follows from equation (5.2)
that the net flow out of the vertex x is given
by
0
y N
f ( x ,y) -
y N
( x)
-
f ( y, x )
( x)
Hence, if we sum the net flow out of a vertex
x over all vertices x of P (including s), we
obtain
f (N )
(
xP
yN
f ( x,y) -
f ( y, x ))
-
yN ( x )
( x)
f ( x,y) -
xP y N ( x )
f ( y, x )
xP y N - ( x )
Ch5-14
Copyright 黃鈴玲
Now
f ( x, y)
xP yN
f ( x, y)
( x, y )( P, P )
f ( x, y);
( x, y )( P, P )
and since P P V ( D ),
f ( x, y)
xP yN -
Since both
f( x, y)
( y, x )( P, P )
f ( x, y)
( y, x )( P, P )
f ( x , y) and
( x, y )( P, P )
f ( y, x )
( y, x )( P, P )
sum the flow in all arcs that have both endvertices in P, these two quantities are equal.
Hence, we obtain
f (N )
f ( x ,y) -
( x, y )( P,P )
f ( y ,x )
( y, x )( P,P )
#
Ch5-15
Copyright 黃鈴玲
Corollary 5.1a
Let N be a network and f a flow in N. Then the
value of the flow in N cannot exceed the
capacity of any cut (P, P ) in N, that is,
f(N) min {c(P,P )},
Where the minimum is taken over all cuts (P, P)
in N.
Ch5-16
Copyright 黃鈴玲
Corollary 5.1b
Let N be a network and f a flow in N. Then
the value of the flow in N equals the flow into
the sink t of N, that is,
f (N )
-
f ( x, t ) -
x N ( t )
f (t, x)
x N ( t )
pf:
Let D be the underlying digraph of N, and let P
= V(D) – {t}; so P={t}.
Then, (x, y) (P, P) iff y = t and x N-(t).
Moreover, (y, x) ( P,P) iff y = t and x N+(t).
Hence, the result follows.
Ch5-17
Copyright 黃鈴玲
Homework
1. Let N be the network shown below, where each
arc is labeled with its capacity. A function f is
defined on the arcs of N as follows:
f (s, u) = 3, f (u, v) = 3, f (v, t) = 4, f (s, x) = 4, f (x, y) = 3,
f (y, t) = 1, f (x, v) = 1, f (w, s) = 0, f (y, w) = 2, f (w, t) = 2
Is f a flow in N? Explain.
u
v
2
N:
3
S
4
1
4
3
1
x
y
t
2
3
5
w
Ch5-18
Copyright 黃鈴玲
Homework
2. For the network shown below, each arc has
unlimited capacity. A flow in the network is
indicated by the labels on the arcs. Determine
the missing flows a, b, c.
u
1
1
2
6
7
x
3
a
S
v
c
x
4
3
b
t
1
2
y
z
2’: Let P = {s, u, w, y}. What is f (P, P )?
Ch5-19
Copyright 黃鈴玲
Outline
5.1
5.2
5.3
5.5
5.6
An Introduction to Networks
The Max-Flow Min-Cut Theorem
A Max-Flow Min-Cut Algorithm
Connectivity and Edge-Connectivity
Menger’s Theorem
Ch5-20
Copyright 黃鈴玲
5.2 The Max-Flow Min-Cut
Theorem
Definition:
A flow f in a network N is called a
maximum flow if f (N) f ’(N) for every
flow f ’ in N.
A cut (P, P) is a minimum cut of N
if c(P, P ) c(X, X ) for every cut (X, X ) of N.
Note. A maximum flow and a minimum cut exist.
Ch5-21
Copyright 黃鈴玲
Definition:
A u0 – un semipath:
Q: u0 , a1 , u1 , a2 , u2 , …, un-1 , an ,un
去掉邊的方向性時,看起來是path.
a1
u0
a2
u1
u2
u3
un-1
un
Ch5-22
Copyright 黃鈴玲
Definition:
A semipath u0, a1, u1, a2, u2, …, un-1,
an ,un in D is said to be f-unsaturated
if i, 1 i n.
either (a). ai = (ui-1, ui ), f(ai) < c(ai)
or
(b). ai = (ui, ui-1), f(ai) > 0
(a).
ai
ui-1
(b). u
i-1
且 f < c 方向性一致, 還有剩下的位置
ui
f 可再上昇
ai
ui
方向相反, 至少載了一個人
f 可再下降.
NOTE: An f-unsaturated s-t semipath is
called on f-augmenting path
Ch5-23
Copyright 黃鈴玲
Thm 5.2:
N: network with underlying digraph D.
A flow f in N is maximum iff there is no
f-augmenting semipath in D.
e.g., If there is a f-augmenting semipath:
u0
4,2
3,2
1,1
4,3 u1 1,0 u2 3,3
6,2
u3 6,3 u4
D1 =2, D2 =1,
D3 =1, D4 =4
D =1
Let Di = c(ai) - f(ai) if ai satisfies condition (a).
Let Di = f(ai)
if ai satisfies condition (b).
Let D = min {Di | i }.
Ch5-24
Copyright 黃鈴玲
e.g. c(a)=3 arc a
f-augmenting semipath
2
2
1
3
x
s
2 <3
y
1 >0
3
t
0 <3
f(N)=5
D =1
3
2
2
1
3
x
s
3
0
3
y
1
t
f(N)=6
3
Ch5-25
Copyright 黃鈴玲
Homework
3. For the following network and flow f,
find a f-augmenting semipath.
x
y
3,3
z
3,2
N:
5,3
S
6,2
1,1
4,2
5,3
u
4,4
v
t
3,1
4,1
3,2
w
Ch5-26
Copyright 黃鈴玲
Outline
5.1
5.2
5.3
5.5
5.6
An Introduction to Networks
The Max-Flow Min-Cut Theorem
A Max-Flow Min-Cut Algorithm
Connectivity and Edge-Connectivity
Menger’s Theorem
Ch5-27
Copyright 黃鈴玲
5.3 A Max-Flow Min-Cut
Algorithm
Thm 5.4:
N: network D: digraph
c: capacity f: flow
Let D’ be a digraph with V(D’) = V(D).
E(D’) = {(x, y) | (x, y) E(D) and c(x, y) > f(x, y)
or (y, x) E(D), and f(y, x)> 0}
Then D’ has a s-t path iff D has an
f-augmenting semipath.(課本P. 143)
Ch5-28
Copyright 黃鈴玲
Algorithm 5.1
(Max-Flow Min-Cut Algorithm)
Initial flow 可假設為f(a)=0 a, 此處假設已做了部份
2,1
u
3,1
s
v
1,1
4,4
3,1
3,3
x 2,2
w
Stage 1 : find D’
v
u
3,2
y 1,1
t
5,1
s
x
t
y
w
Stage 1’ : Find shortest s-t path
s, (w, s), w, (w, t), t
D =1
Ch5-29
Copyright 黃鈴玲
Algorithm 5.1
(Max-Flow Min-Cut Algorithm)
Stage 2 : 改變path中的flow值
Stage 3 : find D’ again
v
u
f(a)= f(a) – D 若 a為反向
f(a)= f(a) + D 若 a為同向
2,1
u
3,1
s
v
1,1
4,4
3,0
3,3
x 2,2
w
s
3,2
y 1,1
5,2
t
x
y
t
w
Stage 3’ : Find shortest s-t path
s, (s, u), u, (u,v), v, (v, t), t
Ch5-30
D =1
Copyright 黃鈴玲
Algorithm 5.1
(Max-Flow Min-Cut Algorithm)
Stage 4 : 改變path中的flow值
Stage 5 : find D’ again
v
u
f(a)= f(a) – D 若 a為反向
f(a)= f(a) + D 若 a為同向
2,2
u
3,2
s
v
1,1
4,4
3,0
3,3
x 2,2
w
s
3,3
y 1,1
5,2
t
x
t
y
w
Stage 5’ : Find shortest s-t path
f(N) = 6
No
令 P 為 s 在 D’中可以走到的點的集合
Ch5-31
Copyright 黃鈴玲
P={s, u}
2,2
u
3,2
s
P ={x, v, w, y, t}
v
1,1
4,4
3,0
3,3
x 2,2
w
3,3
y 1,1
t
5,2
(P, P ) is a minimum cut, c(P, P )=6
Ch5-32
Copyright 黃鈴玲
Homework
4. Shown below is a network N and a flow f1, each arc is
labeled with its capacity and the flow along the arc.
(a) What if the value of f1?
(b) Construct the corresponding digraph D’.
(c) Use the digraph D’ to find an f1-augmenting semipath in N.
(d) Find a maximum flow f and a minimum cut for N.
u
2,2
1,1 w
4,3
2,2
3,1
s
5,3
1,1
v
2,2
x 1,1
t
5,4
y
Ch5-33
Copyright 黃鈴玲
Homework
5. Use Algorithm 5.1 to find a maximum flow and
a minimum cut for the network shown below.
(Assume f(a)=0 for each arc a.)
4
u
3
w
4
s
1
3
1
x
v
2
5
t
1
z 2
2
6
y
Ch5-34
Copyright 黃鈴玲
Outline
5.1
5.2
5.3
5.5
5.6
An Introduction to Networks
The Max-Flow Min-Cut Theorem
A Max-Flow Min-Cut Algorithm
Connectivity and Edge-Connectivity
Menger’s Theorem
Ch5-35
Copyright 黃鈴玲
5.5 Connectivity and
Edge-Connectivity
Definition:
G: connected graph
1. U E(G) is an edge cutset of G if
G-U is disconnected.
2. S V(G) is a vertex cutset of G if
G-S is disconnected.
Ch5-36
Copyright 黃鈴玲
Figure 5.7
v5
G
v1
v2
v3
v4
U={ v1v5, v2v5, v2v6, v3v6 }
G-U
v5
v1
v2
v4
v6
v3
v6
S={ v1, v2, v3 }
v5
G-S
v1
v2
v4
v6
v3
{v1v4, v1v5} is an edge cutset smaller than U.
{v4, v5} is a vertex cutset smaller than S.
Ch5-37
Copyright 黃鈴玲
Definition: G: graph,
The edge connectivity of G
λ(G) = min {|U|: U E(G), G-U is
disconnected or trivial (G K1) }
(λ(G) = 0 G is disconnected or trivial)
The (vertex) connectivity
k (G) = min{ |S|: S V(G) , G-S is
disconnected or trivial }
Consider trivial graph :
K1
λ(G) = 0
k (G) = 0
Ch5-38
Copyright 黃鈴玲
Consider complete graphs :
Kp
λ(Kp) = p-1
k(Kp) = p-1
If a graph G is not complete, then
k (G) is the minimum cardinality of a vertex
cutset of G.
Moreover, a graph G has k (G) = 0 if and only
if G is disconnected or trivial.
Ch5-39
Copyright 黃鈴玲
Thm 5.5:
For every graph G,
k (G) λ(G) δ(G)
pf: (λ(G) δ(G) )
Choose a vertex v with deg(v) = δ(G).
v
G-v
λ(G) δ(G)
edge cutset
Ch5-40
Copyright 黃鈴玲
(k (G) λ(G) )
1. If λ(G) = 0
then G is disconnected or trivial k (G) = 0
2. If λ(G) = 1
then G has a bridge k (G) = 1
3. If λ(G) 2
Let U be an edge cutset with |U| = λ(G),
then G -U has two components.
Note: If G -U has at least 3 components,
then there exists a smaller edge cutset.
U
G1
Let G1 be a nontrivial
component of G-U.
Since |S| |U|
vertex cutset S
∴ k (G) λ(G)
Ch5-41
Copyright 黃鈴玲
Definition:
A graph G is n-edge-connected (n 1)
if λ(G) n (delete n-1 edges 此圖仍會
connected)
A graph G is n-connected if k(G) n
(delete n-1 點 此圖仍會connected or
nontrivial)
Ch5-42
Copyright 黃鈴玲
Thm 5.7:
Let G be a graph of order p, let n,
1 n p-1. If δ(G) (p+n-2)/2, then
G is n-connected (k (G) n)
pf: (反證)
(1) If G Kp , k (G) = p-1
∵ 1 n p-1
∴ k (G) n
∴ G is n-connected
Ch5-43
Copyright 黃鈴玲
(2) If G Kp and assume to the contrary
that G is not n-connected.
Then S V(G) be a cutset and
|S| = k < n
Let G1 be a component of minimum order
in G - S.
∵ |V(G - S)| = p – k
∴ |V(G1)| (p - k)/2
If v V(G1) then,
deg(v) ((p - k)/2 – 1) + k
= ( p + k- 2)/2
< ( p + n -2 )/2
Ch5-44
Copyright 黃鈴玲
Homework
Exercise 5.5:
1, 2, 3, 4, 5, 6
Ch5-45
Copyright 黃鈴玲
Outline
5.1
5.2
5.3
5.5
5.6
An Introduction to Networks
The Max-Flow Min-Cut Theorem
A Max-Flow Min-Cut Algorithm
Connectivity and Edge-Connectivity
Menger’s Theorem
Ch5-46
Copyright 黃鈴玲
5.6 Menger’s Theorem
Definition:
A set S of edges (vertices) of a graph G
is said to separate two vertices u and v
of G if G - S is a disconnected graph in
which u and v lie in different components.
i.e., S separates u and v if G - S contains
no u-v path.
Ch5-47
Copyright 黃鈴玲
Definition:
u, v V(G), Q1 : u - v path, Q2: u - v path
Q1, Q2 are edge-disjoint if
E(Q1) E(Q2) = ,
Q1, Q2 are internally disjoint if
V (Q1) V(Q2) = { u, v }
Ch5-48
Copyright 黃鈴玲
Definition: u v V(G),
l(u, v) = min number of edges that
separate u and v
k(u, v) =
min number of vertices that
separate u and v if uv E(G),
|V(G)|-1 if uv E(G)
M(u, v) = max number of internally disjoint
u - v paths.
M’(u, v) = max number of edge-disjoint
u - v paths.
Ch5-49
Copyright 黃鈴玲
Thm 5.8 (考慮edge)
λ(u, v) = M’(u, v) u, v V(G)
(要separate兩點,最少需delete的邊數
= 它們間edge-disjoint path的最大個數)
Thm 5.9 (考慮vertex) (Menger Theorem)
k(u, v) = M(u, v) u, v V(G) with
uv E(G)
(要separate兩點,最少需delete的點數
= 它們間internally disjoint path的最大個數)
Ch5-50
Copyright 黃鈴玲
Homework
Exercise 5.6:
2, 3
Ex2. Let G be an n-connected graph of order p.
Show that p n (diam(G) - 1) + 2.
Ex3. Let G be an n-edge-connected graph of
size q. Show that q n diam(G).
Ch5-51
Copyright 黃鈴玲