Tours and Matchings 3.1 Eulerian graphs The first proper problem in graph theory was the Königsberg bridge problem.. A connected graph has an Euler trail if and only if it has at most tw
Trang 1Tours and Matchings
3.1 Eulerian graphs
The first proper problem in graph theory was the Königsberg bridge problem In general, this problem concerns about travels around a graph such that one tries to avoid using the same edge twice In practice these eulerian problems occur, for instance, in optimizing distribution networks – such as delivering mail, where in order to save time each street should be travelled only once The same problem occurs in mechanical graph plotting, where one avoids lifting the pen off the paper while drawing the lines
Euler tours
DEFINITION A walkW = e
1 e 2 : : e is a trail, ife
i 6= e
j for alli 6= j An Euler trail of
a graph Gis a trail that visits every edge once A connected graphGis eulerian, if it has a
closed trail containing every edge ofG Such a trail is called an Euler tour.
Notice that if W = e
1 e 2 : : e is an Euler tour (and so E
G
= fe 1
; e 2
; : ; e g), also e
i
e
i+1
: : e e
1
: : e
i 1 is an Euler tour for alli 2 [1; n℄ A complete proof of the following
Euler’s Theorem was first given by HIERHOLZER in 1873
Theorem 3.1 (EULER(1736), HIERHOLZER(1873)) A connected graphGis eulerian if and only if every vertex has an even degree.
Proof ()) SupposeW : u
?
! uis an Euler tour Letv (6= u)be a vertex that occursktimes
inW Every time an edge arrives atv, another edge departs fromv, and therefored
G (v) = 2k Also,d
G
(u)is even, sinceW starts and ends atu
(() AssumeGis a nontrivial connected graph such thatd
G (v)is even for allv 2 G Let
W = e 1 e 2 : : e : v
0
?
! v with e
i
= v
i 1 v i
be a longest trail in G It follows that alle = v w 2 E
G are among the edges of W, for, otherwise, W could be prolonged toW e In particular,v
0
= v , that is,W is a closed trail (Indeed, if it werev 6= v
0andv occursktimes inW, thend
G (v n ) = 2(k 1) + 1and that would be odd.)
IfW is not an Euler tour, then, sinceGis connected, there exists an edgef = v
i
u 2 E G for somei, which is not inW However, now
e i+1 : : e e 1 : : e i f
is a trail inG, and it is longer thanW This contradiction to the choice ofW proves the claim
Trang 23.1 Eulerian graphs 31
Example 3.1 Thek-cubeQ
kis eulerian for even integersk, becauseQ
kisk-regular
Theorem 3.2 A connected graph has an Euler trail if and only if it has at most two vertices
of odd degree.
Proof If G has an Euler trail u
?
! v, then, as in the proof of Theorem 3.1, each vertex
w 2 = fu; v has an even degree
Assume then thatGis connected and has at most two vertices of odd degree IfGhas no vertices of odd degree then, by Theorem 3.1, Ghas an Euler trail Otherwise, by the hand-shaking lemma, every graph has an even number of vertices with odd degree, and therefore
Ghas exactly two such vertices, sayuandv LetH be a graph obtained fromGby adding a vertexw, and the edgesuwandvw InHevery vertex has an even degree, and hence it has an Euler tour, sayu
?
! v ! w ! u Here the beginning partu
?
! vis an Euler trail ofG u
The Chinese postman
The following problem is due to GUAN MEIGU(1962) Consider a village, where a postman wishes to plan his route to save the legs, but still every street has to be walked through This problem is akin to Euler’s problem and to the shortest path problem
LetGbe a graph with a weight function : E
G
! R +
The Chinese postman problem
is to find a minimum weighted tour inG(starting from a given vertex, the post office)
IfGis eulerian, then any Euler tour will do as a solution, because such a tour traverses
each edge exactly once and this is the best one can do In this case the weight of the optimal tour is the total weight of the graphG, and there is a good algorithm for finding such a tour:
Fleury’s algorithm:
Letv
0
2 Gbe a chosen vertex, and letW
0be the trivial path onv
0
Repeat the following procedure fori = 1; 2; : : as long as possible: suppose a trailW
i
= e
1
e
2
: : e
ihas been constructed, wheree
j
= v
j 1 v
j Choose an edgee
i+1(6= e
jforj 2 [1; i℄) so that (i) e
i+1has an endv
i, and (ii)e
i+1is not a bridge ofG
i
= G fe
1
; : ; e i
g, unless there is no alternative
Notice that, as is natural, the weights(e)play no role in the eulerian case
Theorem 3.3 If G is eulerian, then any trail of Gconstructed by Fleury’s algorithm is an Euler tour ofG.
Trang 33.2 Hamiltonian graphs 32
IfGis not eulerian, the poor postman has to walk at least one street twice This happens,
e.g., if one of the streets is a dead end, and in general if there is a street corner of an odd
number of streets We can attack this case by reducing it to the eulerian case as follows An edgee = uv will be duplicated, if it is added toGparallel to an existing edgee
0
= uvwith the same weight,(e
0 ) = (e)
2 4
1 3 3
4
1 3 3
4
1
3 3 3
2
Above we have duplicated two edges The rightmost multigraph is eulerian
There is a good algorithm by EDMONDS AND JOHNSON (1973) for the construction of
an optimal eulerian supergraph by duplications Unfortunately, this algorithm is somewhat complicated, and we shall skip it
3.2 Hamiltonian graphs
In the connector problem we reduced the cost of a spanning graph to its minimum There are different problems, where the cost is measured by an active user of the graph For instance,
in the travelling salesman problem a person is supposed to visit each town in his district,
and this he should do in such a way that saves time and money Obviously, he should plan the travel so as to visit each town once, and so that the overall flight time is as short as possible
In terms of graphs, he is looking for a minimum weighted Hamilton cycle of a graph, the vertices of which are the towns and the weights on the edges are the flight times Unlike for the shortest path and the connector problems no efficient reliable algorithm is known for the travelling salesman problem Indeed, it is widely believed that no practical algorithm exists for this problem
Hamilton cycles
DEFINITION A pathP of a graph Gis a Hamilton path,
if P visits every vertex of Gonce Similarly, a cycle C is
a Hamilton cycle, if it visits each vertex once A graph is
hamiltonian, if it has a Hamilton cycle.
Note that ifC : u
1
! u 2
! ! u
n is a Hamilton cycle, then so isu
i
! : : u
n
! u
1
! : : u
i 1for eachi 2 [1; n℄, and thus we can choose where to start the cycle
Example 3.2 It is obvious that eachK
n is hamiltonian whenever n 3 Also, as is easily seen, is hamiltonian if and only if Indeed, let have a bipartition
Trang 43.2 Hamiltonian graphs 33
(X; Y ), wherejXj = nandjY j = m Now, each cycle inK
n;mhas even length as the graph
is bipartite, and thus the cycle visits the sets X; Y equally many times, sinceX and Y are stable subsets But then necessarilyjXj = jY j
Unlike for eulerian graphs (Theorem 3.1) no good characterization is known for hamilto-nian graphs Indeed, the problem to determine ifGis hamiltonian is NP-complete There are, however, some interesting general conditions
Lemma 3.1 IfGis hamiltonian, then for every nonempty subsetS V ,
S) jSj
Proof Let; 6= S V
G,u 2 S, and letC : u
?
! ube a Hamilton cycle ofG AssumeG S has k connected components, G
i,i 2 [1; k℄ The casek = 1is trivial, and hence suppose that
k > 1 Letu
i be the last vertex ofCthat belongs toG
i, and letv
i be the vertex that follows u
iinC Nowv
i
2 Sfor eachiby the choice ofu
i, andv j 6= v
tfor allj 6= t, becauseC is a cycle andu
i
v
i
2 E
Example 3.3 Consider the graph on the right In G,
S) = 3 > 2 = jSjfor the set S of black
ver-tices Therefore G does not satisfy the condition of
Lemma 3.1, and hence it is not hamiltonian
Interest-ingly this graph is(X; Y )-bipartite of even order with
jX j = jY j It is also3-regular
Example 3.4 Consider the Petersen graph on the
right, which appears in many places in graph theory as
a counter example for various conditions This graph
is not hamiltonian, but it does satisfy the condition
S) jSjfor allS 6= ; Therefore the conclusion
of Lemma 3.1 is not sufficient to ensure that a graph is
hamiltonian
The following theorem, due to ORE, generalizes an earlier result by DIRAC(1952)
Theorem 3.4 (ORE(1962)) LetGbe a graph of order
G
3, and letu; v 2 Gbe such that
d G (u) + d G (v)
G :
ThenGis hamiltonian if and only ifG + uvis hamiltonian.
Proof Denote n =
G Letu; v 2 Gbe such thatd
G (u) + d
G (v) n Ifuv 2 E
G, then there is nothing to prove Assume thus thatuv 2 = E
G ()) This is trivial since ifGhas a Hamilton cycleC, thenC is also a Hamilton cycle of
G + uv
(() Denotee = uvand suppose thatG + ehas a Hamilton cycleC IfCdoes not use the edge , then it is a Hamilton cycle of Suppose thus that is on We may then assume
Trang 53.2 Hamiltonian graphs 34
that C : u
?
! v ! u Nowu = v
1
! v 2
! : : ! v = v is a Hamilton path of G There exists ani with1 < i < n such thatuv
i
2 E
G and v
i 1
v 2 E G :For, otherwise, d
G
(v) < n d
G (u)would contradict the assumption
v1 v2
Æ Æ
v
i 1 vi
Æ Æ
v
But nowu = v
1
?
! v
i 1
! v ! v
1
?
! v i+1
! v i
! v 1
= uis a Hamilton cycle in
Closure
DEFINITION For a graphG, define inductively a sequence G
0
; G 1
; : ; G
k of graphs such that
G 0
= G and G
i+1
= G i + uv ; whereuandvare any vertices such thatuv 2 = E
G
iandd G i (u) +d G i (v)
G This procedure stops when no new edges can be added toG
kfor somek, that is, inG
k, for allu; v 2 Geither
uv 2 E
G
k ord
G
k (u) + d
G k (v) <
G The result of this procedure is the closure ofG, and it
is denoted by (G)(= G
k)
In each step of the construction of (G)there are usually alternatives which edgeuvis to
be added to the graph, and therefore the above procedure is not deterministic However, the
final result (G)is independent of the choices
Lemma 3.2 The closure (G)is uniquely defined for all graphsGof order
G
3.
Proof Denoten =
G Suppose there are two ways to closeG, say
H = G + fe
1
; : ; e r
g and H
0
= G + ff
1
; : ; f s
g ; where the edges are added in the given orders Let H
i
= G + fe
1
; : ; e i
g andH
0 i
= G + ff
1
; : ; f
i
g For the initial values, we have G = H
0
= H 0 0 Lete k
= uv be the first edge such thate
k
6= f
ifor alli Thend
H
k 1 (u) + d H
k 1 (v) n, sincee
k
2 E H
k, bute k
=
2 E H
k 1
By the choice ofe
k, we haveH
k 1
H 0 , and thus alsod
H 0 (u) + d H 0(v)
n, which means that e = uv must be inH
0
; a contradiction ThereforeH H
0 Symmetrically, we deduce thatH
0
H, and henceH
0
Theorem 3.5 LetGbe a graph of order
G
3 (i)Gis hamiltonian if and only if its closure (G)is hamiltonian.
(ii) If (G)is a complete graph, thenGis hamiltonian.
Proof First,G (G)andGspans (G), and thus ifGis hamiltonian, so is (G)
In the other direction, letG = G
0
; G 1
; : ; G k
= (G)be a construction sequence of the closure ofG If (G)is hamiltonian, then so areG
k 1
; : ; G
1andG
0by Theorem 3.4 The Claim (ii) follows from (i), since each complete graph is hamiltonian
Trang 63.2 Hamiltonian graphs 35
Theorem 3.6 LetGbe a graph of order
G
3 Suppose that for all nonadjacent verticesu
andv,d
G
(u) + d
G (v)
G ThenGis hamiltonian In particular, ifÆ(G)
1 2
G, thenGis hamiltonian.
Proof Sinced
G
(u) + d G (v)
Gfor all nonadjacent vertices, we have (G) = K
nforn =
G, and thusGis hamiltonian The second claim is immediate, since nowd
G (u)+d G (v)
G
Chvátal’s condition
The hamiltonian problem of graphs has attracted much attention, at least partly because the problem has practical significance (Indeed, the first example where DNA computing was applied, was the hamiltonian problem.)
There are some general improvements of the previous results of this chapter, and quite many improvements in various special cases, where the graphs are somehow restricted We become satisfied by two general results
Theorem 3.7 (CHVÁTAL (1972)) LetGbe a graph withV = fv
1
; v 2
; : ; v g, forn 3, ordered so thatd
1
d 2
d , ford
i
= d G (v i ) If for everyi < n=2,
d i
i = ) d
i
thenGis hamiltonian.
Proof First of all, we may suppose thatGis closed,G = (G), becauseGis hamiltonian if and only if (G)is hamiltonian, and adding edges toGdoes not decrease any of its degrees, that is, ifGsatisfies (3.1), so doesG + efor everye We show that, in this case,G = K
n, and thusGis hamiltonian
Assume on the contrary thatG 6= K
n, and letuv 2 = E
Gwithd
G (u) d
G (v)be such that d
G
(u) +d
G
(v)is as large as possible BecauseGis closed, we must haved
G (u)+ d G (v) < n, and therefored
G
(u) = i < n=2 LetA = fw j vw 2 = E
G
; w 6= v By our choice,d
G (w) i for allw 2 A, and, moreover,
jAj = (n 1) d
G (v) d
G (u) = i :
Consequently, there are at leastiverticeswwithd
G (w) i, and sod
i
d G (u) = i Similarly, for each vertex from B = fw j uw 2 = E
G
; w 6= ug, d
G (w) d
G (v) <
n d
G
(u) = n i, and
jBj = (n 1) d
G (u) = (n 1) i :
Also d
G
(u) < n i, and thus there are at least n i vertices w with d
G (w) < n i Consequently, d
i
< n i This contradicts the obtained bound d
i
iand the condition
Note that the condition (3.1) is easily checkable for any given graph
Trang 73.3 Matchings 36
3.3 Matchings
In matching problems we are given an availability relation between the elements of a set The problem is then to find a pairing of the elements so that each element is paired (matched) uniquely with an available companion
A special case of the matching problem is the marriage problem, which is stated as
fol-lows Given a setXof boys and a setY of girls, under what condition can each boy marry a
girl who cares to marry him? This problem has many variations One of them is the job
as-signment problem, where we are givennapplicants andmjobs, and we should assign each applicant to a job he is qualified The problem is that an applicant may be qualified for several jobs, and a job may be suited for several applicants
Maximum matchings
DEFINITION For a graphG, a subsetM E
Gis a matching ofG, ifMcontains no adjacent edges The two ends of an edgee 2 Mare matched underM A matchingMis a maximum
matching, if for no matchingM
0 ,jM j < jM
0
j The two vertical edges on the right constitute a matchingM
that is not a maximum matching, although you cannot add
any edges to M to form a larger matching This matching
is not maximum because the graph has a matching of three
edges
DEFINITION A matching M saturates v 2 G, if v is an
end of an edge inM Also,M saturatesA V , if it
sat-urates everyv 2 A IfM saturatesV , thenM is a perfect
matching.
It is clear that every perfect matching is maximum
On the right the horizontal edges form a perfect matching
DEFINITION LetM be a matching ofG An odd pathP =
e
1
e
2
: : e
2k+1isM-augmented, if
P alternates betweenE
G
n M andM (that is,e
2i+1
2 E
G M ande
2i
2 M), and
the ends ofP are not saturated
Lemma 3.3 IfGis connected with(G) 2, thenGis a path or a cycle.
Trang 83.3 Matchings 37
We start with a result that states a necessary and sufficient condition for a matching to
be maximal One can use the first part of the proof to construct a maximum matching in an iterative manner starting from any matchingM and from anyM-augmented path
Theorem 3.8 (BERGE (1957)) A matching M ofG is a maximum matching if and only if there are noM-augmented paths inG.
Proof ()) Let a matching M have anM-augmented path P = e
1 e 2 : : e 2k+1 inG Here e
2
; e
4
; : ; e
2k
2 M,e 1
; e 3
; : ; e 2k+1
=
2 M DefineN E
Gby
N = (M n fe
2i
j i 2 [1; k℄g) [ fe
2i+1
j i 2 [0; k℄g :
Now,N is a matching ofG, andjNj = jM j + 1 ThereforeM is not a maximum matching (() AssumeN is a maximum matching, but M is not Hence jNj > jM j Consider the subgraphH = G[M 4 N℄for the symmetric differenceM 4N We haved
H (v) 2for each
v 2 H, becausevis an end of at most one edge inM andN By Lemma 3.3, each connected componentAofHis either a path or a cycle
Since nov 2 Acan be an end of two edges fromN or fromM, each connected component (path or a cycle)Aalternates betweenN andM Now, sincejN j > jM j, there is a connected component AofH, which has more edges fromN than fromM ThisAcannot be a cycle, because an alternating cycle is even, and it thus contains equally many edges from N and
M HenceA : u
?
! vis a path, which starts and ends with an edge fromN BecauseAis a connected component ofH, the endsuandvare not saturated byM, and, consequently,Ais
Example 3.5 Consider thek-cubeQ
kfork 1 Each maximum matching ofQ
khas2
k 1 edges Indeed, the matching M = f(0u; 1u) j u 2 B
k 1
g, has2
k 1 edges, and it is clearly perfect
Hall’s theorem
For a subsetS V
Gof a graphG, denote
N
G
(S ) = fv j uv 2 E
G for some u 2 Sg :
IfGis(X; Y )-bipartite, andS X, thenN
G (S) Y The following result, known as the
Theorem 3.9 (HALL(1935)) LetGbe a(X; Y )-bipartite graph ThenGcontains a matching
M saturatingXif and only if
jSj jN
G (S)j for all S X: (3.2)
Trang 93.3 Matchings 38
Proof ()) LetM be a matching that saturatesX IfjSj > jN
G (S)jfor someS X, then not allx 2 Scan be matched with differenty 2 N
G (S) (() LetGsatisfy Hall’s condition (3.2) We prove the claim by induction onjXj
IfjXj = 1, then the claim is clear Let thenjXj 2, and assume (3.2) implies the existence
of a matching that saturates every proper subset ofX
IfjN
G
(S)j jSj + 1for every nonemptyS XwithS 6= X, then choose an edgeuv 2 E
Gwithu 2 X, and consider the induced subgraphH = G fu; v For allS X n fug,
jN H (S)j jN
G (S)j 1 jSj
and hence, by the induction hypothesis, Hcontains a matching M saturatingX n fug Now
M [ fuvgis a matching saturatingXinG, as was required
Suppose then that there exists a nonempty subset R X with R 6= X such that jN
G
(R )j = jR j The induced subgraphH
1
= G[R [ N
G (R )℄satisfies (3.2) (sinceGdoes), and hence, by the induction hypothesis,H
1contains a matchingM
1that saturatesR(with the other ends inN
G (R ))
Also, the induced subgraphH
2
= G[V G
n A℄, forA = R [ N
G (R ), satisfies (3.2) Indeed,
if there were a subsetS X n Rsuch thatjN
H2 (S)j < jSj, then we would have
jN
G
(S [ R )j = jN
H2 (S )j + jN
H1 (R )j < jSj + jN
G (R )j = jSj + jR j = jS [ R j
(since S \ R = ;), which contradicts (3.2) for G By the induction hypothesis, H
2 has a matchingM
2that saturatesX n R(with the other ends inY n N
G (R )) Combining the match-ings forH
1andH
2, we get a matchingM
1 [ M
Second proof This proof of the direction (()uses Menger’s theorem Let H be the graph obtained fromGby adding two new verticesx; ysuch thatxis adjacent to eachv 2 Xandy
is adjacent to eachv 2 Y There exists a matching saturatingXif (and only if) the number of independent pathsx
?
! yis equal tojXj For this, by Menger’s theorem, it suffices to show that every setSthat separatesxandyinH has at leastjX jvertices
LetS = A [ B, whereA XandB Y Now, vertices in
XnAare not adjacent to vertices ofY nB, and hence we have
N
G
(X nA) B, and thus thatjX nAj jN
G (X nA)j jBj using the condition (3.2)
x
y
X n A Y n B
Corollary 3.1 (FROBENIUS (1917)) IfGis ak-regular bipartite graph withk > 0, thenG
has a perfect matching.
Proof LetGbek-regular(X; Y )-bipartite graph By regularity,k jXj = "
G
= k jY j, and hence jXj = jY j LetS X Denote byE
1 the set of the edges with an end in S, and by E
2 the set of the edges with an end inN
G (S ) Clearly,E
1
E
2 Therefore,k jN
G (S )j = jE
2
j jE
1
j = k jSj, and sojN
G (S )j jSj By Theorem 3.9,Ghas a matching that saturates Since , this matching is necessarily perfect
Trang 103.3 Matchings 39
Applications of Hall’s theorem
DEFINITION LetS = fS
1
; S 2
; : ; S m
gbe a family of finite nonempty subsets of a set S (S
i need not be distinct.) A transversal (or a system of distinct representatives) of Sis a subsetT Sofmdistinct elements one from eachS
i
As an example, let S = [1; 6℄, and let S
1
= S 2
= f1; 2g, S
3
= f2; 3g and S
4
= f1; 4; 5; 6g For S = fS
1
; S 2
; S 3
; S 4
g, the set T = f1; 2; 3; 4g is a transversal If we add the setS
5
= f2; 3gtoS, then it is impossible to find a transversal for this new family
The connection of transversals to the Marriage Theorem is as follows LetS = Y and
X = [1; m℄ Form an(X; Y )-bipartite graphGsuch that there is an edge(i; s)if and only if
s 2 S
i The possible transversals T ofSare then obtained from the matchingsM saturating
XinGby taking the ends inY of the edges ofM
Corollary 3.2 LetSbe a family of finite nonempty sets ThenShas a transversal if and only
if the union of anyk of the subsetsS
iofScontains at leastkelements.
Example 3.6 Anm nlatin rectangle is anm ninteger matrixMwith entriesM
ij
2 [1; n℄ such that the entries in the same row and in the same column are different Moreover, ifm = n, thenMis a latin square Note that in am nlatin rectangleM, we always have thatm n
We show the following: LetM be anm nlatin rectangle (withm < n) Then M can be extended to a latin square by the addition ofn mnew rows.
The claim follows when we show thatMcan be extended to an(m+1) nlatin rectangle LetA
i
[1; n℄be the set of those elements that do not occur in thei-th column ofM Clearly, jA
i
j = n mfor eachi, and hence
P i2I jA i
j = jIj(n m)for all subsetsI [1; n℄ Now j[
i2I
A
i
j jIj, since otherwise at least one element from the union would be in more than
n mof the setsA
iwithi 2 I However, each row has all thenelements, and therefore eachi
is missing from exactlyn mcolumns By Marriage Theorem, the familyfA
1
; A 2
; : ; A n has a transversal, and this transversal can be added as a new row toM This proves the claim
Tutte’s theorem
The next theorem is a classic characterization of perfect matchings
DEFINITION A connected component of a graphGis said to be odd (even), if it has an odd
(even) number of vertices Denote by odd
(G)the number of odd connected components in
G
Denote bym(G)be the number of edges in a maximum matching of a graphG
Theorem 3.10 (Tutte-Berge Formula) Each maximum matching of a graphGhas
m(G) = min
SV G
G + jSj
odd (G S)
2
(3.3)
elements.