graph theory chapter 5 networks 大葉大學 (da-yeh univ.) 資訊工程系 (dept. csie) 黃鈴玲...
Post on 13-Jan-2016
249 Views
Preview:
TRANSCRIPT
Graph TheoryGraph Theory
Chapter 5Chapter 5 Networks Networks
大葉大學大葉大學 (Da-Yeh (Da-Yeh Univ.)Univ.)資訊工程系資訊工程系 (Dept. (Dept. CSIE)CSIE)黃鈴玲黃鈴玲 (Lingling (Lingling Huang)Huang)
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-22
OutlineOutline
5.1 An Introduction to Networks5.1 An Introduction to Networks
5.2 The Max-Flow Min-Cut Theorem5.2 The Max-Flow Min-Cut Theorem
5.3 A Max-Flow Min-Cut Algorithm5.3 A Max-Flow Min-Cut Algorithm
5.5 Connectivity and Edge-5.5 Connectivity and Edge-ConnectivityConnectivity
5.6 Menger5.6 Menger’’s Theorems Theorem
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-33
5.1 An Introduction to 5.1 An Introduction to Networks Networks ※ Motivation:
Suppose that a World Series baseball gameis to be played in city B. Since the team from city A is playing in this game, many fans from Awish to fly to B on short notice. Several flight routes exist from A to B. The maximum numberof seats available on every such flight is known.We wish to determine the maximum number offans that can be flown from A to B and the routesthey should take. How can this be done?
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-44
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.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-55
s
z
y
x
t
1
3 5
2
4
1
A network N :
source sink
c(x, y)=4, c(t, z)=5
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-66
Definition: For a vertex x in a digraph D,
the out-neighborhood and in-neighborhood of x are defined by N+(x) = { y V(D) | (x, y) E(D) } andN(x) = { y V(D) | (y, x) E(D) } , respectively.
s
z
y
x
t
1
3 5
2
4
1
N+(x) = { y, z }
N(x) = { s }
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-77
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
The net flow out of a vertex x is defined as
While the net flow into x is
(5.2)
(5.1)
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-88
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 Condition (5.2) is referred to as the conservation equation. ( 出 = 進 )
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-99
Definition:
The The value value ff((NN)) of the flow of the flow ff in in NN is the is the net flow out of the source net flow out of the source ss that is, that is,
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1010
N:
tSvu
y
w
x z3,3
5,3
5,3
1,16,2
4,2
3,2
3,24,1
4,4
3,1
Figure 5-2
The numbers on an arc : capacity, flow
f (N) = 4f (s, x) = 3, c(s, x)=5
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1111
Definition:
SupposeSuppose c is the capacity of the cut. is the capacity of the cut. Further, if Further, if f is a flow in is a flow in N, then the , then the flow flow from from PP to to is is f ((PP, , )) and the flow and the flow from from to to PP is is f ( , P).
Definition: Let X, Y V(D),
(X,Y) = {(x, y) E(D) | x X, y Y }. AA cut cut in in N is a set of arcs of the type ( is a set of arcs of the type (PP, ), ) in in D, where , where P V(D), containing containing s but not but not t
and where and where = V(D) P.
P
P
( 有時需考慮由一群點 X 流進另一群點 Y 的 flow 量 )
PPPP
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1212
N:
tSvu
y
w
x z3,3
5,3
5,3
1,16,2
4,2
3,2
3,24,1
4,4
3,1
Figure 5-2
eg: If P = {s, x} then {(x,y), (s,u)} is a cut.
c(P, )=16, f(P, )=9P P
If P = {s, y, w} then {(s,x), (s,u), (y,u), (y,z), (w,v)} is a cut.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1313
Thm 5.1Thm 5.1
Let Let N be a network and be a network and f a flow in a flow in N. If . If (P, )is a cut of is a cut of N, then the value of the , then the value of the flow in flow in N is given by is given by
) to from (flow - ) to from (flow
)( )(
)( )( )()()()()(
PPPP
PP,fPP,f
y ,xfx ,yfNf,PPy, xPP,x, y
pf: By definition,
)()(
)( )( )(sNxsNx
x, sfs, xfNf
P
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1414
which is the net flow out of source which is the net flow out of source s. If . If x P – {s}, then it follows from equation then it follows from equation (5.2) that the net flow out of the vertex (5.2) that the net flow out of the vertex x is given byis given by
Hence, if we sum the net flow out of a Hence, if we sum the net flow out of a vertex vertex x over all vertices over all vertices x of of P (including (including s), we obtain), we obtain
)()(
)( )( 0xNyxNy
y, xfx,yf
Px xNyPx xNy
Px xNyxNy
y, xfx,yf
y, xfx,yfNf
)()(
)()(
)( )(
))( )(( )(
Copyright Copyright 黃鈴玲黃鈴玲
)( )f()(
),(
;)( )()(
)()()()(
)()()()(
Px , PPy, xP, Py, xNy
Px PP, x, yP, Px, yNy
x, yfx, yx, yf
DVPP
x, yfx, yfx, yf
-
Ch5-Ch5-1515
NowNow
and sinceand since
Since both and Since both and
sum the flow in all arcs that have both sum the flow in all arcs that have both end-vertices in P, these two quantities are end-vertices in P, these two quantities are equal. Hence, we obtainequal. Hence, we obtain
)()()()(
)( )(P, Py, xP, Px, y
y, xfx , yf
)()()()(
)( )( )(,PPy, xPP,x, y
y ,xfx ,yfNf#
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1616
Corollary 5.1aCorollary 5.1a
Let Let N be a network and be a network and ff a flow in a flow in N. . Then the value of the flow in Then the value of the flow in N cannot cannot exceed the capacity of any cut exceed the capacity of any cut (P, ) in in N, , that is,that is,
f(N) min {c(P, )},
Where the minimum is taken over all Where the minimum is taken over all cuts cuts (P, ) in in N.
PP
P
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1717
Corollary 5.1bCorollary 5.1b
Let Let N be a network and be a network and f a flow in a flow in N. . Then the value of the flow in Then the value of the flow in N equals equals the flow into the sink the flow into the sink t of of N, that is,, that is,
)()(
)( ) ,( )(tNxtNx
t, xftxfNf
pf:
Let D be the underlying digraph of N, and let P = V(D) – {t}; so ={t}. Then, (x, y) (P, ) iff y = t and x N-(t). Moreover, (y, x) ( ,P) iff y = t and x N+(t).
Hence, the result follows.
PP
P
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1818
HomeworkHomework
N:
tSyx
v
w
u 2
3
3
1
4
4
53
1
2
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.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-1919
HomeworkHomework2. 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.
tSx
x
v
z
u 1
1
3
2
a
6
14
c
3
2
y
7
b
2’: Let P = {s, u, w, y}. What is f (P, P )?
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2020
OutlineOutline
5.1 An Introduction to Networks5.1 An Introduction to Networks
5.2 The Max-Flow Min-Cut Theorem5.2 The Max-Flow Min-Cut Theorem
5.3 A Max-Flow Min-Cut Algorithm5.3 A Max-Flow Min-Cut Algorithm
5.5 Connectivity and Edge-5.5 Connectivity and Edge-ConnectivityConnectivity
5.6 Menger5.6 Menger’’s Theorems Theorem
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2121
5.2 The Max-Flow Min-Cut 5.2 The Max-Flow Min-Cut TheoremTheoremDefinition: 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, ) is a minimum cut of N if c(P, ) c(X, ) for every cut (X, ) of N.P
P X X
Note. A maximum flow and a minimum cut exist.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2222
Definition: A u0 – un semipath:
Q: u0 , a1 , u1 , a2 , u2 , …, un1 , an ,un 去掉邊的方向性時 , 看起來是 path.
u3u0 u1 un-1u2 un
a2a1
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2323
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).
ui-1
ui-1
ui
ui
(b).
且 f < c 方向性一致 , 還有剩下的位置 f 可再上昇
ai
ai 方向相反 , 至少載了一個人 f 可再下降 .
NOTE: An f-unsaturated s-t semipath is called on f-augmenting path
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2424
Thm 5.2:Thm 5.2:
N: network with underlying digraph : network with underlying digraph D. . A flowA flow f in in N is maximum iff there is no is maximum iff there is no ff-augmenting semipath in -augmenting semipath in D..
Let i = c(ai) f(ai) if ai satisfies condition (a).
e.g.,
u3u0 u1 u2 u4
1,14,2 3,2 6,2
If there is aIf there is a f f-augmenting semipath:-augmenting semipath:
Let i = f(ai) if ai satisfies condition (b).
Let = min {i | i }.
1 =2, 2 =1, 3 =1, 4 =44,3 1,0 3,3 6,3
=1
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2525
tsy
x
2
3
1
12
2
33
0
e.g. c(a)=3 arc a
tsy
x
2
3
0
12
3
33
1
f(N)=5
f(N)=6
ff-augmenting semipath-augmenting semipath
<3 >0 <3 =1
Copyright Copyright 黃鈴玲黃鈴玲
HomeworkHomework3. For the following network and flow f,find a f-augmenting semipath.
Ch5-Ch5-2626
N:
tSvu
y
w
x z3,3
5,3
5,3
1,16,2
4,2
3,2
3,24,1
4,4
3,1
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2727
OutlineOutline
5.1 An Introduction to Networks5.1 An Introduction to Networks
5.2 The Max-Flow Min-Cut Theorem5.2 The Max-Flow Min-Cut Theorem
5.3 A Max-Flow Min-Cut Algorithm5.3 A Max-Flow Min-Cut Algorithm
5.5 Connectivity and Edge-5.5 Connectivity and Edge-ConnectivityConnectivity
5.6 Menger5.6 Menger’’s Theorems Theorem
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2828
5.3 A Max-Flow Min-Cut 5.3 A Max-Flow Min-Cut AlgorithmAlgorithm
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)
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-2929
sy
x
u v
w
Algorithm 5.1 (Max-Flow Min-Cut Algorithm)
t
3,1
2,13,2
1,14,4 3,3 1,1
3,1 5,1
Initial flow 可假設為 f(a)=0 a, 此處假設已做了部份 Stage 1 : find D’
2,2 syx
u v
w
t
Stage 1’ : Find shortest s-t path
s, (w, s), w, (w, t), t
=1
3,1
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3030
Algorithm 5.1 (Max-Flow Min-Cut Algorithm)
Stage 3 : find D’ again
syx
u v
w
t
Stage 3’ : Find shortest s-t path
s, (s, u), u, (u,v), v, (v, t), t
=1
sy
x
u v
w
t3,1
2,13,2
1,14,4 3,3 1,1
3,0 5,22,2
Stage 2 : 改變 path 中的 flow 值
f(a)= f(a) – 若 a 為反向f(a)= f(a) + 若 a 為同向
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3131
Algorithm 5.1 (Max-Flow Min-Cut Algorithm)
Stage 5 : find D’ again
syx
u v
w
t
Stage 5’ : Find shortest s-t path
No
sy
x
u v
w
t3,2
2,23,3
1,14,4 3,3 1,1
3,0 5,22,2
Stage 4 : 改變 path 中的 flow 值
f(a)= f(a) – 若 a 為反向f(a)= f(a) + 若 a 為同向
令 P 為 s 在 D’中可以走到的點的集合f(N) = 6
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3232
(P, ) is a minimum cut, c(P, )=6
P={s, u}
={x, v, w, y, t}
P
P
sy
x
u v
w
t3,2
2,23,3
1,14,4 3,3 1,1
3,0 5,22,2
P
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3333
HomeworkHomework4. Shown below is a network 4. Shown below is a network NN and a flow and a flow ff11, each arc is , each arc is labeled with its capacity and the flow along the arc. labeled with its capacity and the flow along the arc. (a) What if the value of (a) What if the value of ff11? ? (b) Construct the corresponding digraph (b) Construct the corresponding digraph DD’.’.(c) Use the digraph (c) Use the digraph DD’ to find an ’ to find an ff11-augmenting semipath in -augmenting semipath in NN..(d) Find a maximum flow (d) Find a maximum flow ff and a minimum cut for and a minimum cut for NN..
s
y
x
u v
t
3,1
2,2
2,24,3
1,1 1,1
5,3 5,4
2,2
1,1
w
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3434
HomeworkHomework5. Use Algorithm 5.1 to find a maximum flow and 5. Use Algorithm 5.1 to find a maximum flow and a minimum cut for the network shown below.a minimum cut for the network shown below.(Assume (Assume ff((aa)=0 for each arc )=0 for each arc a.a.))
s
yx
u v
t
3
4
52
4
21 6
2
1 1
3
w
z
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3535
OutlineOutline
5.1 An Introduction to Networks5.1 An Introduction to Networks
5.2 The Max-Flow Min-Cut Theorem5.2 The Max-Flow Min-Cut Theorem
5.3 A Max-Flow Min-Cut Algorithm5.3 A Max-Flow Min-Cut Algorithm
5.5 Connectivity and Edge-5.5 Connectivity and Edge-ConnectivityConnectivity
5.6 Menger5.6 Menger’’s Theorems Theorem
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3636
5.5 Connectivity and 5.5 Connectivity and Edge-ConnectivityEdge-Connectivity
Definition: G: connected graph
1. U E(G) is an edge cutset of G if GU is disconnected. 2. S V(G) is a vertex cutset of G if GS is disconnected.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3737
Figure 5.7 v5
v1 v6
v3v4
v2
G
S={ v1, v2, v3 }U={ v1v5, v2v5, v2v6, v3v6 }
GU v5
v1 v6
v3v4
v2
v1
v3
v2
v5
v6
v4
GS
{v1v4, v1v5} is an edge cutset smaller than U.{v4, v5} is a vertex cutset smaller than S.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3838
Definition: G: graph,
The edge connectivity of G λ(G) = min {|U|: U E(G), GU is disconnected or trivial (G K1) }
(λ(G) = 0 G is disconnected or trivial)
The (vertex) connectivity (G) = min{ |S|: S V(G) , GS is disconnected or trivial }
Consider trivial graph :
K1 λ(G) = 0
(G) = 0
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-3939
Consider complete graphs :
Kp λ(Kp) = p-1
(Kp) = p-1
If a graph G is not complete, then (G) is the minimum cardinality of a vertexcutset of G.Moreover, a graph G has (G) = 0 if and onlyif G is disconnected or trivial.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4040
Thm 5.5:Thm 5.5:
For every graph For every graph GG,,
(G) λ λ((GG)) δ δ((GG))
pf: (λλ((GG)) δ δ((GG) )) )
Gv
edge cutset
v
Choose a vertex v with deg(v) = δδ((GG).).
λλ((GG)) δ δ((GG) )
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4141
(((G) λ λ((GG)) ))1. If 1. If λλ((GG)) = 0 = 0 thenthen GG is disconnected or trivialis disconnected or trivial (G)
= 0= 02. If2. If λλ((GG)) = 1= 1
thenthen GG has a bridge has a bridge (G) = 1= 13. If3. If λλ((GG)) 2 2 LetLet UU be an edge cutset withbe an edge cutset with | |UU| = | = λλ((GG),),
then then G G U U has two components.has two components.
Since |S| | |UU||
∴ ∴ (G) λ λ((GG))
Note: If G G UU has at least 3 has at least 3 components, then there exists a components, then there exists a smaller edge cutset.smaller edge cutset.
G1
U
vertex cutset S
Let G1 be a nontrivial component of GU.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4242
Definition: A graph G is n-edge-connected
(n1) if λλ((GG)) n (delete n-1 edges 此圖仍會 connected)
A graph G is n-connected if ((GG)) n (delete n-1 點 此圖仍會 connected or nontrivial)
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4343
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 ((G) n)
pf: ( 反證 )
(1) If G Kp , (G) = p-1
∵ 1 n p-1
∴ (G) n
∴ G is n-connected
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4444
(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
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4545
HomeworkHomework
Exercise 5.5:Exercise 5.5:1, 2, 3, 4, 5, 6 1, 2, 3, 4, 5, 6
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4646
OutlineOutline
5.1 An Introduction to Networks5.1 An Introduction to Networks
5.2 The Max-Flow Min-Cut Theorem5.2 The Max-Flow Min-Cut Theorem
5.3 A Max-Flow Min-Cut Algorithm5.3 A Max-Flow Min-Cut Algorithm
5.5 Connectivity and Edge-5.5 Connectivity and Edge-ConnectivityConnectivity
5.6 Menger5.6 Menger’’s Theorems Theorem
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4747
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.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4848
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 }
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-4949
Definition: u v V(G), (u, v) = min number of edges that
separate u and v
(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.
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-5050
Thm 5.8Thm 5.8 (( 考慮考慮 edge)edge)
λλ((u, , v) = ) = M’(u, v) u, v V(G)
Thm 5.9Thm 5.9 (( 考慮考慮 vertex) (Menger vertex) (Menger Theorem)Theorem)
((u, , v) = ) = M(u, v) u, v V(G) with uv E(G)( 要 separate 兩點,最少需 delete 的點數
= 它們間 internally disjoint path 的最大個數 )
( 要 separate 兩點,最少需 delete 的邊數 = 它們間 edge-disjoint path 的最大個數 )
Copyright Copyright 黃鈴玲黃鈴玲Ch5-Ch5-5151
HomeworkHomework
Exercise 5.6: Exercise 5.6: 2, 3 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).
top related