Similarly, we define directed paths and directed cycles as directed walks and closed directed walks without repetitions of vertices.. This digraph has a path of length five, but its dire
Trang 1Directed Graphs
6.1 Digraphs
In some problems the relation between the objects is not
symmetric For these cases we need directed graphs, where
the edges are oriented from one vertex to another
As an example consider a map of a small town Can you
make the streets one-way, and still be able to drive from one
house to another (or exit the town)?
Definitions
DEFINITION A digraph (or a directed graph)D = (V
D
; E D )consists of the verticesV
and (directed) edgesE
D
V V
D(without loopsv ) We still writeuvfor(u; v), but note that nowuv 6= vu For each paire = uvdefine the inverse ofease
1
= vu (= (v; u))
Note thate 2 E
D does not implye
1
2 E
D
DEFINITION LetDbe a digraph ThenAis its
subdigraph, ifV
A
V andE
A
E
D,
induced subdigraph,A = D[X℄, ifV = XandE
A
= E D
\ (X X)
The underlying graph U (D) of a digraphD
is the graph on V such that ife 2 E
D, then the undirected edge with the same ends is in
U (D)
A digraphDis an orientation of a graphG, ifG = U (D)ande 2 E
Dimpliese
1
=
2 E
D
In this case,Dis said to be an oriented graph.
DEFINITION LetDbe a digraph A walkW = e
1 e 2 : : e k : u
?
! vofU (D)is a directed
walk, ife
i
2 E
D for alli 2 [1; k℄ Similarly, we define directed paths and directed cycles as
directed walks and closed directed walks without repetitions of vertices
The digraphDis di-connected, if, for allu 6= v, there exist directed pathsu
?
! vand
?
The maximal induced di-connected subdigraphs are the di-components of
Trang 26.1 Digraphs 84
Note that a graph G = U (D) might be connected, although the digraph D is not di-connected
DEFINITION The indegree and the outdegree of a vertex are defined as follows
d
I
D
(v) = jfe 2 E
D
j e = xvgj; d
O D (v) = jfe 2 E
D
j e = vxgj :
We have the following handshaking lemma (You offer and accept a handshake.)
Lemma 6.1 LetDbe a digraph Then
X
v2D d I D (v) = jE
D
j = X
v2D d O D (v):
Directed paths
The relationship between paths and directed paths is in
gen-eral rather complicated This digraph has a path of length
five, but its directed paths are of length one
There is a nice connection between the lengths of directed paths and the chromatic number
(D) = (U (D))
Theorem 6.1 (ROY (1967),GALLAI (1968)) A digraph D has a directed path of length
(D) 1.
Proof LetA E
D be a minimal set of edges such that the subdigraph D A contains no directed cycles Letkbe the length of the longest directed path inD A
For each vertexv 2 D, assign a colour (v) = i, if a longest directed path fromv has lengthi 1inD A Here1 i k + 1
First we observe that ifP = e
1 e 2 : : e
r(r 1) is any directed pathu
?
! vinD A, then
(u) 6= (v) Indeed, if(v) = i, then there exists a directed pathQ : v
?
! wof lengthi 1, andP Qis a directed path, sinceD Adoes not contain directed cycles SinceP Q : u
?
! w,
(u) 6= i = (v) In particular, ife = uv 2 E
D A, then(u) 6= (v) Consider then an edge e = vu 2 A By the minimality of A, (D A) + econtains a directed cycleC : u
?
! v ! u, where the partu
?
! vis a directed path inD A, and hence
(u) 6= (v) This shows thatis a proper colouring ofU (D), and therefore(D) k + 1,
The bound(D) 1is the best possible in the following sense:
Theorem 6.2 Every graph G has an orientation D, where the longest directed paths have lengths(G) 1.
Trang 36.1 Digraphs 85 Proof Letk = (G)and letbe a properk-colouring ofG As usual the set of colours is
[1; k℄ We orient each edgeuv 2 E
G by setting uv 2 E
D, if(u) < (v) Clearly, the so
DEFINITION An orientation D of an undirected graph G is acyclic, if it has no directed
cycles Leta(G)be the number of acyclic orientations ofG
The next result is charming, since
G ( 1)measures the number of proper colourings of
Gusing 1colours!
Theorem 6.3 (STANLEY(1973)) LetGbe a graph of ordern Then the number of the acyclic orientations ofGis
a(G) = ( 1)
n
G ( 1) ;
where
Gis the chromatic polynomial ofG.
Proof The proof is by induction on"
G First, ifGis discrete, then
G (k) = k , anda(G) =
1 = ( 1)
n
( 1)
n
= ( 1)
n
G ( 1)as required
Now
G
(k)is a polynomial that satisfies the recurrence
G (k) =
G e (k)
Ge (k) To prove the claim, we show thata(G)satisfies the same recurrence
Indeed, if
then, by the induction hypothesis,
a(G) = ( 1)
n
G e 1) + ( 1)
n 1
Ge ( 1) = ( 1)
n
G ( 1) :
For (6.1), we observe that every acyclic orientation ofGgives an acyclic orientation ofG e
On the other hand, ifDis an acyclic orientation ofG efore = uv, it extends to an acyclic orientation of G by putting e
1 : u ! v or e
2 : v ! u Indeed, if D has no directed path
u
?
! v, we choosee
2, and ifDhas no directed pathv
?
! u, we choose e
1 Note that since
Dis acyclic, it cannot have both waysu
?
! vandv
?
! u
We conclude thata(G) = a(G e) + b, wherebis the number of acyclic orientationsDof
G ethat extend in both wayse
1ande
2 The acyclic orientationsDthat extend in both ways are exactly those that contain
neitheru
?
! vnorv
?
Each acyclic orientation ofG ecorresponds in a natural way to an acyclic orientationD
ofG ethat satisfies (6.2) Thereforeb = a(G e), and the proof is completed u
One-way traffic
Every graph can be oriented, but the result may not be di-connected In the one-way traffic
problem the resulting orientation should be di-connected, for otherwise someone is not able
to drive home ROBBINS’ theorem solves this problem
Trang 46.1 Digraphs 86
DEFINITION A graphGis di-orientable, if there is a di-connected oriented graphDsuch thatG = U (D)
Theorem 6.4 (ROBBINS(1939)) A connected graphGis di-orientable if and only ifGhas
no bridges.
Proof If Ghas a bridge e, then any orientation of Ghas at least two di-components (both sides of the bridge)
Suppose then that Ghas no bridges Hence G has a cycle C, and a cycle is always di-orientable Let thenH Gbe maximal such that it has a di-orientation D
H IfH = G, then
we are done
Otherwise, there exists an edge e = vu 2 E
G such that
u 2 Hbut v 2 = H (becauseGis connected) The edgeeis
not a bridge and thus there exists a cycle
C
0
= eP Q : v ! u
?
! w
?
! v
inG, wherewis the last vertex insideH
w
P e
Q P
0
In the di-orientationD
H ofHthere is a directed pathP
0 : u
?
! w Now, we oriente : v !
uand the edges ofQin the directionQ : w
?
! vto obtain a directed cycleeP
0 Q: v ! u
?
! w
?
! v In conclusion, G[V
H [ V C
℄has a di-orientation, which contradicts the maximality
Example 6.1 LetDbe a digraph A directed Euler tour ofDis a directed closed walk that
uses each edge exactly once A directed Euler trail of Dis a directed walk that uses each edge exactly once
The following two results are left as exercises
(1) LetDbe a digraph such thatU (D)is connected ThenDhas a directed Euler tour if and only ifd
I
D
(v) = d
O D (v)for all verticesv.
(2) LetDbe a digraph such thatU(D)is connected ThenDhas a directed Euler trail if and only ifd
I
D
(v) = d
O D (v)for all verticesvwith possibly excepting two verticesx; yfor which
jd
I
D
(v) d
O
D
(v)j = 1.
The above results hold equally well for multidigraphs, that is, for directed graphs, where
we allow parallel directed edges between the vertices
Example 6.2 The following problem was first studied by HUTCHINSON AND WILF(1975) with a motivation from DNA sequencing Consider words over an alphabetA = fa
1
; a 2
; : ; a n
of n letters, that is, each word w is a sequence of letters In the case of DNA, the let-ters are A; T; C ; G In a problem instance, we are given nonnegative integers s
i and r
ij for
1 i; j n, and the question is: does there exist a wordw in which each lettera
i occurs exactlys
itimes, anda
iis followed bya
j exactlyr
ij times
For instance, ifn = 2,s
1
= 3, and r
11
= 1,r 12
= 2,r 21
= 1,r 22
= 0, then the word
is a solution to the problem
Trang 56.1 Digraphs 87
Consider a multidigraph DwithV = Afor which there arer
ij edgesa
i a
j It is rather obvious that a directed Euler trail ofDgives a solution to the sequencing problem
Tournaments
DEFINITION A tournamentT is an orientation of a complete graph
Example 6.3 There are four tournaments of four vertices that are not isomorphic with each
other (Isomorphism of directed graphs is defined in the obvious way.)
Theorem 6.5 (RÉDEI(1934)) Every tournament has a directed Hamilton path.
Proof The chromatic number ofK
nis(K
n ) = n, and hence by Theorem 6.1, a tournament
T of ordernhas a directed path of lengthn 1 This is then a directed Hamilton path visiting
The vertices of a tournament can be easily reached from one vertex (sometimes called the
king).
Theorem 6.6 (LAUDAU(1953)) Letvbe a vertex of a tournamentTof maximum outdegree Then for allu, there is a directed pathv
?
! uof length at most two.
Proof LetT be an orientation ofK
n, and letd
O T (v) = dbe the maximum outdegree inT Suppose that there exists an x, for which the directed distance from vtox is at least three
It follows that xv 2 E
T and xu 2 E
T for allu withvu 2 E
T But there are dvertices in
A = fy j v 2 E
T
g, and thusd + 1vertices infy j xy 2 E
T
g = A [ fvg It follows that the outdegree ofxisd + 1, which contradicts the maximality assumption made forv u
Problem Ádám’s conjecture states that in every digraphDwith a directed cycle there exists
an edge uv the reversal of which decreases the number of directed cycles Here the new
digraph has the edgevuinstead ofuv
Example 6.4 Consider a tournament ofnteams that play once against each other, and sup-pose that each game has a winner The situation can be presented as a tournament, where the vertices correspond to the teams v
i, and there is an edge v
i v
j, if v
i won v
j in their mutual game
DEFINITION A teamvis a winner (there may be more than one winner), ifvcomes out with the most victories in the tournament
Trang 66.1 Digraphs 88
Theorem 6.6 states that a winner v either defeated a team u or v defeated a team that defeatedu
A ranking of a tournament is a linear ordering of the teams v
i 1
> v i 2
> > v
i n
that should reflect the scoring of the teams One way of ranking a tournament could be by a Hamilton path: the ordering can be obtained from a directed Hamilton pathP : v
i 1
! v i 2
! : : ! v
i
n However, a tournament may have several directed Hamilton paths, and some of these may do unjust for the ‘real’ winner
Example 6.5 Consider a tournament of six teams
1; 2; : : 6, and let T be the scoring digraph as in
the figure Here1 ! 2 ! 4 ! 5 ! 6 ! 3is a
di-rected Hamilton path, but this extends to a didi-rected
Hamilton cycle (by adding 3 ! 1)! So for every
team there is a Hamilton path, where it is a winner,
and in another, it is a looser
6
5 1
4
2
3
Lets
1
(j) = d
O T (j)be the winning number of the teamj(the number of teams beaten by
j) In the above tournament,
s
1
(1) = 4; s
1 (2) = 3; s
1 (3) = 3; s
1 (4) = 2; s
1 (5) = 2; s
1 (6) = 1 :
So, is team 1 the winner? If so, is 2 or 3 next? Define the second-level scoring for each team
by
s 2 (j) = X
ji2E T s 1 (i) :
This tells us how good teamsjbeat In our example, we have
s
2
(1) = 8; s
2 (2) = 5; s
2 (3) = 9; s
2 (4) = 3; s
2 (5) = 4; s
2 (6) = 3 :
Now, it seems that 3 is the winner,but 4 and 6 have the same score We continue by defining inductively themth-level scoring by
s m (j) = X
ji2E T s
m 1 (i) :
It can be proved (using matrix methods) that for a di-connected tournament with at least four
teams, the level scorings will eventually stabilize in a ranking of the tournament: there exits an
mfor which themth-level scoring gives the same ordering as do the(m + k)th-level scorings for allk 1 IfTis not di-connected, then the level scoring should be carried out with respect
to the di-components
In our example the level scoring gives1 ! 3 ! 2 ! 5 ! 4 ! 6as the ranking of the tournament
Trang 76.2 Network Flows 89
6.2 Network Flows
Various transportation networks or water pipelines are conveniently represented by weighted directed graphs These networks usually possess also some additional requirements Goods are transported from specific places (warehouses) to final locations (marketing places) through a network of roads In modeling a transportation network by a digraph, we must make sure that the number of goods remains the same at each crossing of the roads The problem setting for
such networks was proposed by T.E Harris in the 1950s The connection to Kirchhoff’s
Cur-rent Law (1847) is immediate According to this law, in every electrical network the amount
of current flowing in a vertex equals the amount flowing out that vertex
Flows
DEFINITION A networkN consists of
an underlying digraphD = (V; E),
two distinct verticessand r, called the source and
the sink ofN, and
a capacity function : V V ! R
+(nonnegative real numbers), for which(e) = 0, ife 2 = E
DenoteV = V andE
N
= E
6
5
4
4
5
2
5
2
4 4
LetA V
N be a set of vertices, andf : V V ! R any function such thatf (e) = 0,
ife 2 = E
N We adopt the following notations:
[A; A ℄ = fe 2 E
D
j e = uv; u 2 A; v 2 = Ag ;
f + (A) =
X
e2[A;A℄
f (e) and f (A) =
X
e2[A;A℄
f (e) :
In particular,
f + (u) = X
v2N
f (uv) and f (u) =
X
v2N
f (vu) :
DEFINITION A flow in a networkN is a functionf : V V
N
! R + such that
0 f (e) (e) for all e; and f (v) = f
+ (v) for all v 2 = fs; rg :
Example 6.6 The value f (e) can be taught of as the rate at which transportation actually happens along the channel ewhich has the maximum capacity (e) The second condition states that there should be no loss
Trang 86.2 Network Flows 90
If N = (D; s; r; ) is a network of water
pipes, then the value (e) gives the capacity
(x m
3
=min) of the pipee
The previous network has a flow that is indicated
on the right
4
5
3
4
4
0
4
1
3 4
A flowf in N is something that the network can handle E.g., in the above figure the
source should not try to feed the network the full capacity (11 m
3
=min) of its pipes, because the junctions cannot handle this much water
DEFINITION Every networkN has a zero flow defined byf (e) = 0for alle For a flowf
and each subsetA V
N, define the resultant flow fromAand the value off as the numbers
val(f
A
) = f
+ (A) f (A) and val(f ) = val(f
s (= f + (s) f (s)) :
A flowf of a network N is a maximum flow, if there does not exist any flowf
0
such that
val(f ) < val(f
0 )
The value v al(f ) of a flow is the overall number of goods that are (to be) transported through the network from the source to the sink In the above example,val(f ) = 9
Lemma 6.2 LetN = (D; s; r; )be a network with a flowf.
(i) IfA N n fs; rg, thenval(f
A ) = 0 (ii)v al(f ) = val(f
r .
Proof LetA N n fs; rg Then
0 =
X
v2A
(f
+
(v) f (v)) =
X
v2A f + (v) X
v2A
f (v) = f
+ (A) f (A) = v al(f
A );
where the third equality holds since the values of the edgesuvwithu; v 2 Acancel each out
Improvable flows
Letf be a flow in a networkN, and letP = e
1 e 2 : : e be an undirected path inNwhere an edgee
iis alongP, ife
i
= v i v i+1
2 E
N, and againstP, ife
i
= v i+1 v i
2 E
N
We define a nonnegative number(P )forP as follows:
(P ) = min
e i
(e); where(e) =
( (e) f (e) ifeis alongP ;
f (e) ifeis againstP
DEFINITION Letf be a flow in a networkN A
pathP : s
?
! ris (f-)improvable, if(P ) > 0
On the right, the bold path has value (P ) = 1,
and therefore this path is improvable
5
3 4
0
4 4
4
3
1
Trang 96.2 Network Flows 91
Lemma 6.3 Let N be a network If f is a maximum flow of N, then it has no improvable paths.
Proof Define
f 0 (e) =
8
>
>
f (e) + (P ) ifeis along P;
f (e) (P ) ifeis against P;
f (e) ifeis not in P:
Thenf
0
is a flow, since at each intermediate
ver-tex v 2 = fs; rg, we have (f
0 ) (v) = (f
0 ) + (v), and the capacities of the edges are not exceeded
Nowval(f
0
) = val(f ) + (P ), sinceP has exactly
one edge sv 2 E
N for the source s Hence, if
(P ) > 0, then we can improve the flow
5
3
4
4
0
4 4
5
2
2
u
Max-Flow Min-Cut Theorem
DEFINITION LetN = (D; s; r; )be a network For a subsetS V
Nwiths 2 Sandr 2 = S,
let the cut bySbe
[S℄ = [S; S℄ (= fuv 2 E
N
j u 2 S; v 2 = Sg) :
The capacity of the cut[S℄is the sum
[S℄ =
+ (S) = X
e2[S℄
(e) :
A cut[S℄is a minimum cut, if there is no cut[R ℄
with[R ℄ < [S℄
Example 6.7 In our original network the
capac-ity of the cut for the indicated vertices is equal
to10
5
4
4
5
2
5 6
4
2 4
Lemma 6.4 For a flowf and a cut[S℄ofN,
val(f ) = val(f
S ) = f + (S ) f (S ) :
Proof LetS
I
= S n fsg Nowval(S
I
= 0(sinceS
I
N n fs; rg), andval(f ) = val(f
s Hence
v al(f S ) =val(f
s X
v2S I
f (sv) +
X
v2S I
f (vs)
+ val(f
S I ) + X
v2S I
f (sv)
X
v2S I
f (vs)
=val(f s
= val(f ) :
Trang 106.2 Network Flows 92
Theorem 6.7 For a flowf and any cut[S℄ofN,val(f ) [S℄ Furthermore, equality holds
if and only if for eachu 2 Sandv 2 = S,
(i) ife = uv 2 E
N, thenf (e) = (e), (ii) ife = vu 2 E
N, thenf (e) = 0.
Proof By the definition of a flow,
f + (S) = X
e2[S℄
f (e)
X
e2[S℄
(e) = [S℄
andf (S) 0 By Lemma 6.4,val(f ) = v al(f
S ) = f + (S) f (S), and henceval(f ) [S℄, as required Also, the equalityv al(f ) = [S℄holds if and only if
(1)f
+
(S) = [S℄and (2)f (S) = 0 This holds if and only iff (e) = (e)for alle 2 [S℄
(sincef (e) (e)), and
(2)f (e) = 0for alle = vuwithu 2 S,v 2 = S
In particular, iff is a maximum flow and[S℄a minimum cut, then
val(f ) [S℄
Corollary 6.1 Iff is a flow and[S℄a cut such thatval(f ) = [S℄, thenf is a maximum flow and[S℄a minimum cut.
The following main result of network flows was proved independently by ELIAS, FEIN
-STEIN, SHANNON, by FORD ANDFULKERSON, and by ROBACKERin 1955 – 56 The present approach is due to Ford and Fulkerson
Theorem 6.8 A flowf of a network N is maximum if and only if there are nof-improvable paths inN.
Proof By Lemma 6.3, a maximum flow cannot have improvable paths.
Conversely, assume thatN contains nof-improvable paths, and let
S I
= fu 2 N jfor some pathP : s
?
! u; (P ) > 0g :
SetS = S
I
[ fsg
Consider an edge e = uv 2 E
N, whereu 2 S and v 2 = S Sinceu 2 S, there exists a pathP : s
?
! uwith(P ) > 0 Moreover, sincev 2 = S,(P e) = 0for the pathP e: s
?
! v Therefore(e) = 0, and sof (e) = (e)
By the same argument, for an edgee = vu 2 E
N withv 2 = Sandu 2 S,f (e) = 0
By Theorem 6.7, we haveval(f ) = [S℄ Corollary 6.1 implies now thatf is a maximum