Graph Theory
Graph Theory
1 Combinatorial Analysis 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Sums and Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Binomial Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Bijections (One-to-One Correspondence) . . . . . . . . . . . . . . . 4
1.5 Combinatorial Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.6 Generating Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.7 Formal Power Series . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.8 The Sum and Product Lemmas . . . . . . . . . . . . . . . . . . . . . 24
iii
iv CONTENTS
5 Trees 125
5.1 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.2 Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.3 Characterizing Bipartite Graphs . . . . . . . . . . . . . . . . . . . . 130
5.4 Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5.5 Applications of Breadth-First Search . . . . . . . . . . . . . . . . . . 139
5.6 Minimum Spanning Tree . . . . . . . . . . . . . . . . . . . . . . . . 141
6 Codes 145
6.1 Vector Spaces and Fundamental Cycles . . . . . . . . . . . . . . . . 145
6.2 Graphical Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
8 Matchings 185
8.1 Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
8.2 Covers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.3 König’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
8.4 Applications of König’s Theorem . . . . . . . . . . . . . . . . . . . . 197
8.5 Systems of Distinct Representatives . . . . . . . . . . . . . . . . . . 198
8.6 Perfect Matchings in Bipartite Graphs . . . . . . . . . . . . . . . . . 200
8.7 Edge-colouring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.8 An Application to Timetabling . . . . . . . . . . . . . . . . . . . . . 204
vi CONTENTS
Chapter 4
4.1 Definitions
Graph theory is the study of mathematical objects known as “graphs" — a word
to which graph theorists have given a rather special meaning. So we must start
by defining exactly what a graph is.
V (G) = {1, 2, 3, 4, 5}
and
E (G) = {{1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 5}, {3, 4}, {3, 5}, {4, 5}}.
For the sorts of results with which we are concerned, it is most convenient to
consider the following geometric representation or diagram or drawing of a
graph. On the page we draw a small circle to correspond to each vertex. For
each edge we then draw a line between the corresponding pair of vertices. The
only restriction on such a line is that it does not intersect the circle correspond-
ing to any other vertex. For example, the above graph is represented in Figure
4.1(i), (ii) and (iii) in three ways.
If e = {u, v} then we say that u and v are adjacent vertices, and that edge e
is incident with vertices u and v. We can also say that the edge e joins u and v.
93
94 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
2
2 2
1 1
1 3 5
3 3
5 5
4
4 4
(i) (ii) (iii)
Example 4.1.3. Given the street map of a city, one can define a street map graph
as follows. There is a vertex for each street intersection, and an edge for each
part of a street joining two intersections and traversing no other intersections.
An example is given in Figure 4.3, where intersections are numbered to make
the correspondence clear. Such graphs are useful in solving certain kinds of
routing and scheduling problems, such as garbage pickup, or delivery of news-
papers to carriers.
4.1. DEFINITIONS 95
rat
ran
cat eat
run
ear
sun
can car
1 2 Euler Way 3 1 2 3
Queen St
King St
Jack St
4 5 Main St 6 4 5 6
7 Erb St 8 7 8
Example 4.1.4. Another way to obtain a graph from a map, is to begin with a
political map, such as the map of the countries of a continent. There is a vertex
for each country and two countries are adjacent if they share a boundary. One
of the most famous problems in graph theory arose from the question of how
many colours are needed to colour such maps so that adjacent countries are
not assigned the same colour. Figure 4.4 shows the graph obtained from South
America.
Gu
Su
Ve FG
Co
Br Ur
Ec
Pa
Pe Bo Ar
Ch
Example 4.1.5. Graphs are often defined from other mathematical objects. For
example, we can define the graph S n,k to have V (S n,k ) equal to the set of k-
element subsets of {1, 2, . . . , n}. Two such subsets are adjacent if they have ex-
actly k ° 1 elements in common. Figure 4.5 shows a drawing of the graph S 4,2 .
Some important points arise from our definition of a graph.
(1) Edges are unordered pairs of vertices. Thus the edge {v 1 , v 2 } is not from v 1
to v 2 or vice versa; it is simply “between" v 1 and v 2 . If we change Definition
4.1.1 to read “ordered pairs" we obtain the definition of a different kind of
graph, a directed graph or digraph.
(2) E (G), being a set, either contains a pair {v 1 , v 2 } or it does not. Thus we
do not allow the possibility of “multiple edges” such as exist between the
vertices a and b in Figure 4.6.
4.1. DEFINITIONS 97
{1, 2}
{2, 3} {2, 4}
{3, 4}
{1, 3} {1, 4}
d a
c e
f b
(3) The edges are pairs of distinct vertices. Hence we cannot have a loop, i.e.,
an edge joining a vertex to itself as shown in Figure 4.6 at vertex c. Neverthe-
less in some circumstances it can be convenient to consider loops and/or
multiple edges. If we wish to allow loops and multiple edges we will use the
term multigraph instead of graph. (In some texts “graph” is used to mean
“multigraph”, and if loops and multiple edges are not allowed the term ”sim-
ple graph” is used.)
(4) Note that V (G), and hence E (G), is a finite set. If we remove this condition
we find ourselves in the realm of infinite graphs—and that is a whole new
ballgame!
4.2 Isomorphism
Figure 4.7(i) is the diagram of the graph G, where
V (G) = {p, q, r, s}, E (G) = {{p, q}, {p, r }, {q, r }, {q, s}}.
The graphs G and H are not the same—G has vertices p, q, r, s and H has ver-
tices a, b, c, d —but for almost all purposes they are indistinguishable. We make
this idea precise.
p c
q s a b
r d
(i) (ii)
Definition 4.2.1. Two graphs G 1 and G 2 are isomorphic if there exists a bijec-
tion f : V (G 1 ) ! V (G 2 ) such that vertices f (u) and f (v) are adjacent in G 2 if and
only if u and v are adjacent in G 1 . (We might say that f preserves adjacency.)
Figure 4.8 shows two other graphs, G and H , that are isomorphic. One iso-
morphism is the mapping f : V (G) ! V (H ) given by
1 a
b i
6
5 2
8 9 c h
j
10 7
d g
4 3
e f
G H
in its isomorphism class have the property. Thus we generally regard isomor-
phic graphs as ‘the same’ even if formally they might not be equal. Even if G
has only one vertex, there are infinitely many graphs in its isomorphism class.
Fortunately though, the number of isomorphism classes of graphs with a given
finite set of vertices is finite. For example, there are exactly 11 isomorphism
classes of graphs on 4 vertices, pictured in Figure 4.9. Note that in this figure,
the vertices of the graphs are not given explicitly, because however we assign
vertices to the drawing, we will still get a graph in the same isomorphism class.
The identity map on V (G) is an isomorphism from the graph G to itself. An
isomorphism from G to itself is called an automorphism of G.
4.3 Degree
The number of edges incident with a vertex v is called the degree of v, and is
denoted by deg(v). For example in G of Figure 4.7 we have deg(p) = deg(r ) =
2, deg(q) = 3, deg(s) = 1; in G of Figure 4.8, all vertices have degree 3. In what
follows we generally use ‘p’ for the number of vertices and ‘q’ for the number
of edges.
4.4. BIPARTITE GRAPHS 101
Proof: Each edge has two ends, and when we sum the degrees of the vertices,
we are counting the edges twice, once for each end.
This is known as the Handshaking Lemma or the Degree-Sum Formula.
Corollary 4.3.2. The number of vertices of odd degree in a graph is even.
Proof: The sum of all vertex degrees is 2q, an even number. The sum of the
vertices of even degrees is even. Hence the sum of the vertices of odd degrees
is also an even number. This implies that there must be an even number of
vertices with odd degree.
Figure 4.10: K 4
Definition 4.4.1. For n ∏ 0, the n-cube is the graph whose vertices are the {0, 1}-
strings of length n, and two strings are adjacent if and only if they differ in ex-
actly one position.
Problem 4.4.2. Determine the numbers of vertices and edges in the n-cube, for
n ∏ 0.
n2n = 2q,
so the n-cube has q = n2n°1 edges, for n ∏ 0.
4.4. BIPARTITE GRAPHS 103
000 001
010 011
100 101
110 111
Solution: Let V be the set of all {0, 1}–strings of length n; V is the vertex set of
the n-cube. Partition V into the set A of strings containing an even number of
ones and the set B of strings containing an odd number of ones. If vertices x
and y are adjacent then the strings x and y differ in exactly one position. Thus,
exactly one of x and y contain an even number of ones. Therefore (A, B ) is a
bipartition and hence the n-cube is bipartite.
2. A cubic graph is one in which every vertex has degree three. Find all the
nonisomorphic cubic graphs with 4, 6 and 8 vertices.
3. For the subset graph S n,k defined in Example 4.1.5, find the number of ver-
tices and the number of edges.
4. The odd graph O n is the graph whose vertices are the n-subsets of a (2n +1)-
set, two such subsets being adjacent if and only if they are disjoint.
104 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
G1 G2 G3
5. The line-graph L(G) of a graph G is the graph whose vertex set is E (G) and
in which two vertices are adjacent if and only if the corresponding edges of
G are incident with a common vertex.
6. For integer n ∏ 0, define the graph G n as follows: V (G n ) is the set of all binary
strings of length n having at most one block of 1’s. Two vertices are adjacent
if they differ in exactly one position.
(a) Find |V (G n )|
(b) Make drawings of G 3 and G 4 .
(c) Find |E (G n )|.
8. The complement of the graph G, denoted Ḡ is the graph with V (Ḡ) = V (G)
and the edge {u, v} 2 E (Ḡ) if and only if {u, v} 62 E (G).
(a) Let G have vertices 1, 2, 3, 4 and edges {1, 2}, {2, 3}, {3, 4}, {1, 4}. Draw Ḡ.
(b) Find a 5-vertex graph that is isomorphic to its complement.
(c) Prove that no 6-vertex graph is isomorphic to its complement.
(d) Let G 1 and G 2 be two graphs. Prove that G 1 is isomorphic to G 2 if and
only if Ḡ 1 is isomorphic to G¯2 .
(e) Find all 2-regular non-isomorphic graphs on 6 vertices (prove that these
are the only ones).
(f) Prove that there are only two 3-regular non-isomorphic graphs on 6
vertices.
9. Make drawings of the 15 nonisomorphic graphs having six vertices and six
edges, such that every vertex has degree at least one.
10. Are the graphs in Figure 4.14 isomorphic? Justify your answer.
106 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
1 2 a b
8 3 h c
7 4 g d
6 5 f e
11. For n a positive integer, define the prime graph B n to be the graph with
vertex set {1, 2, . . . , n}, where {u, v} is an edge if and only if u + v is a prime
number. Prove that B n is bipartite.
12. (a) Are the two graphs in Figure 4.15 isomorphic? Prove your claim.
(b) Are the two graphs in Figure 4.16 isomorphic? Prove your claim.
1 2 A B
8 3 H C
7 4 G D
6 5 F E
1 2 A B
7 3 G C
6 4 F D
5 E
Clearly A is a symmetric matrix and, since we do not allow loops, its diago-
nal elements are all zero.
To define an incidence matrix we must name the edges of G; we shall call
them e 1 , e 2 , . . . , e q .
For i 6= j this sum is the number of edges incident with both v i and v j ; for i = j
it is the number of edges incident with v i , which is deg(v i ). Thus
Another way of specifying a graph is to give, for each vertex, a list of the
vertices adjacent to it. For example:
e1 e4
e2 e3
5 6 7 2
e5 e6 e7
e8 e9 e11 e12
4 3
e10
Figure 4.17: Graph for problem 1
which begins with vertex v 0 , ends with vertex v n and, for 1 ∑ i ∑ n, edge e i =
{v i °1 , v i }. Such a walk can also be called a v 0 , v n -walk. Note that the length of a
walk is the number of edges in it (in this case, n). Also, because we can reverse a
walk to get a walk from v n to v 0 , we refer, where convenient, to a walk between
a pair of vertices, instead of from one to the other. A walk is said to be closed if
v0 = vn .
A path is a walk in which all the vertices are distinct. A path that starts at
v 0 and ends at v n is called a v 0 , v n -path. Observe that since all the vertices in a
path are distinct, so are all the edges.
Figure 4.19 shows (by heavy lines) a path in a graph, from vertex 1 to vertex
2.
Since graphs have no multiple edges, consecutive vertices v i °1 and v i de-
termine the edge e i of a walk. Hence, in describing a walk we often omit the
edges.
5 6
1 4
2 3
8
7 9
10
since graphs have no loops, a graph has no cycle of length one. A cycle of length
2 has two vertices, v 0 and v 1 , and two distinct edges, called multiple edges, join-
ing v 0 and v 1 . Therefore, a graph has no cycle of length two. Thus the shortest
possible cycle in a graph is a 3-cycle, often called a triangle.
Note that for a cycle with n ∏ 3 vertices, v 0 , . . . , v n°1 , then v i v i +1 . . . v n°1 v 0 . . . v i
and v i v i °1 . . . v 0 v n°1 . . . v i are both closed walks for each i = 0, . . . , n ° 1, and in
this way there are 2n closed walks of length n associated with a given n-cycle.
Figure 4.20 shows (by heavy lines) an 8-cycle in a graph.
5 6
1 4
2 3
8
7 9
10
In a cycle, every vertex has degree exactly 2. There’s one condition that guar-
antees that a graph contains a cycle.
Theorem 4.6.4. If every vertex in G has degree at least 2, then G contains a cycle.
The girth of a graph G is the length of the shortest cycle in G, and is denoted
by g (G). If G has no cycles, then g (G) is infinite (but you may choose to ignore
this fact).
4.6. PATHS AND CYCLES 113
4. Let G be the graph whose set of vertices is the set of all “lower 48” states of
the United States, plus Washington, DC, with two vertices being adjacent if
they share a boundary. (For example, California is adjacent to Arizona.) Let
H be the subgraph of G whose vertices are those of G whose first letter is one
of W, O, M, A, N, and whose edges are the edges of G whose ends have this
property. (For example, California is not a vertex of H , but Arizona and New
Mexico are, and they are adjacent in H .) Find a path in H from Washington
to Washington, DC.
7. Prove that the complete bipartite graph K m,n has a Hamilton cycle if and
only if m = n and m > 1.
8. Show that if there is a closed walk of odd length in the graph G, then G con-
tains an odd cycle (that is, G has a subgraph which is a cycle on an odd num-
ber of vertices).
9. A diagonal of a cycle in a graph is an edge that joins vertices that are not
consecutive in the cycle.
(a) Prove that a shortest cycle (if one exists) has no diagonal.
(b) Prove that a shortest odd cycle (if one exists) has no diagonal.
(c) Give an example of a graph in which a shortest even cycle has a diago-
nal.
10. (a) Prove that a k-regular graph of girth 4 has at least 2k vertices (k ∏ 2).
(b) For k = 2, 3, find a k-regular graph of girth 4 with precisely 2k vertices.
Generalize these examples, i.e. find one for each k ∏ 2.
(c) Prove that a k-regular graph of girth 5 has at least k 2 + 1 vertices (k ∏ 2).
Remark: The only values of k for which such a graph with exactly k 2 +1
vertices can exist are k = 2, 3, 7, 57. This surprising result can be proved
using elementary matrix theory (i.e., what you study in MATH 235). Ex-
amples are known for k = 2, 3, 7, but no example has yet been found for
k = 57. Such a graph would have 572 + 1 = 3250 vertices.
t
(d) Prove that a k-regular graph of girth 2t , where t ∏ 2, has at least 2(k°1)
k°2
°2
vertices.
(e) Prove that a k-regular graph of girth 2t + 1, where t ∏ 2, has at least
k(k°1)t °2
k°2 vertices.
(f) For k = 2, 3, give an example of a k-regular graph of girth five with ex-
actly k 2 + 1 vertices.
4.7. EQUIVALENCE RELATIONS 115
You have met equivalence relations in your first algebra course, but these are
important in nearly all areas of mathematics, including graph theory.
Formally, if S and T are sets, then a relation R between S and T is a subset
of S £ T . The idea is that if a 2 S and b 2 T , then a and b are related if and only
if (a, b) belongs to the subset. If a and b are related we may say that they are
incident. Thus if G is a graph, then “is contained in” is a relation on V (G)£E (G).
We will be most concerned with the case where S = T . In this case we usu-
ally refer to a relation on S, and do not mention S £ S. By way of example, “is
adjacent to” is a relation on the vertices of a graph. A relation on S is reflexive if
each element of S is related to itself. So “is adjacent to” is not a reflexive relation
on the vertex set V (G) of a graph G. However this relation is symmetric, that is,
if a is related to b then b is related to a. On the integers, the relation “divides” is
reflexive but not symmetric.
There is a third important property a relation may have. Suppose that we
are given a relation on a set V and, if a, b 2 V , we write a º b to denote that a
and b are related. We say the relation is transitive if whenever a º b and b º c,
then a º c. The relation “divides” on the integers is transitive, as is the relation
∑ on R. The relation “is a subgraph of” on the subgraphs of G is reflexive and
transitive.
We say a relation is an equivalence relation if it is reflexive, symmetric and
transitive.
As an example, the relation “is joined by a walk to” on the vertices of a graph
G is an equivalence relation—each of the three properties is very easy to verify.
The canonical example is equality. Another example you have met is “con-
gruent modulo m” on the integers. We generally use equivalence relations to
partition things. Thus the equivalence relation “congruent mod 5” splits the in-
tegers into five classes. The key is that if º is an equivalence relation on a set V
and C (a) is the set
{v 2 V : v º a}
then any two elements of C (a) are equivalent, and any element of v that is
equivalent to something in C (a) is itself an element of C (a). Hence if b 2 V
then either C (a) = C (b) or C (a) \C (b) = ;.
116 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
4.8 Connectedness
Definition 4.8.1. A graph G is connected if, for each two vertices x and y, there
is a path from x to y.
Theorem 4.8.2. Let G be a graph and let v be a vertex in G. If for each vertex w
in G there is a path from v to w in G, then G is connected.
Proof: For any vertices x and y in G, there is a path from v to x and a path from
v to y. If we reverse the path from v to x we obtain a path from x to v, and now
Corollary 4.6.3 implies that there is a path from x to y in G, so G is connected
by Definition 4.8.1.
If G is a graph on n vertices, then to certify that G is connected
°n ¢ according
to the definition of connected, we must provide a total of 2 paths. The above
theorem reduces the workload: only n paths are needed.
Solution: We use Theorem 4.8.2, and prove that there is a path from vertex
v 0 = 0 . . . 0 (with n 0’s) to x for all other vertices x in the n-cube. Now x is a {0, 1}-
string of length n, and suppose that x has k 1’s in positions i 1 , . . . , i k , where
1 ∑ i 1 < . . . < i k ∑ n, with 1 ∑ k ∑ n. Now let v j be the {0, 1}-string with 1’s in
positions i 1 , . . . , i j , and 0’s elsewhere for j = 1, . . . , k. Then v 0 v 1 . . . v k is a path
from 0 . . . 0 to x, so the n-cube is connected, by Theorem 4.8.2.
(a) C is connected.
Figure 4.21 shows a graph having three components. Note that there are
paths between every pair of vertices in the same component, but not between
pairs of vertices in different components.
While it is easy to convince someone of the existence of a path between two
vertices (show them the path), it is less clear how you might convince them that
a path does not exist. We introduce a convenient way of doing this.
If we are given a partition (X , Y ) of V (G) such that there are no edges having
an end in X and an end in Y , then there is no path from any vertex in X to any
vertex in Y . So, if X and Y are both nonempty, G is not connected. Given a
subset X of the vertices of G, the cut induced by X is the set of edges that have
exactly one end in X .
Theorem 4.8.5. A graph G is not connected if and only if there exists a proper
nonempty subset X of V (G) such that the cut induced by X is empty.
The question is that can a resident of the city leave home, cross every bridge
exactly once, and then return home? We can formulate the layout of the city as
a graph: Create 4 vertices representing the land areas (two shores and two is-
lands), and create an edge for each bridge, joining the vertices representing the
two land areas on either side of the bridge. In this case, we obtain the following
graph (with multiple edges):
In terms of graph theory, the question becomes “is there a closed walk that
uses every edge exactly once?” We use a definition for this type of walk.
4.9. EULERIAN CIRCUITS 119
v2
v1
vk
120 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
C2
C1
C3
v a2
v a1
W2
W1
W3
v a3
v a2
v a1
W2
W1
v2
W3
v a3
v1
vk
4.10 Bridges
If e 2 E (G), we denote by G °e (or by G\e) the graph whose vertex set is V (G) and
whose edge set is E (G)\{e}. (So G ° e is the graph obtained from G by deleting
the edge e.)
Proof: Let e = {x, y}. If e is a bridge, then G ° e has at least two components. Let
Vx be the set of vertices in the same component of G °e as x. Let z be any vertex
of G ° e not in Vx . Because there exists a path from x to z in G but not in G ° e,
every path from x to z in G contains edge e and so must be of the form
xe ye 2 v 2 e 3 v 3 · · · v n°1 e n z.
x, e 1 , v 1 , e 2 , v 2 , . . . , v n°1 , e n , y, e, x
in G. Then
x, e 1 , v 1 , e 2 , v 2 , . . . , v n°1 , e n , y
is a path from x to y in G °e. Hence e is not a bridge of G by Lemma 4.10.2. This
establishes the implication.
To complete the proof, we must establish the converse – if edge e is not a
bridge of graph G, then e is an edge of some cycle. Suppose e = uv is not a
bridge. Then u and v must lie in the same component of G ° e, and so there is
a path P that joins them. Together with e this path forms a cycle that contains
e.
Corollary 4.10.4. If there are two distinct paths from vertex u to vertex v in G,
then G contains a cycle.
x i , x i °1 , . . . , x 0 = u = y 0 , y 1 , . . . , y m = v = x n , x n°1 , . . . , x i +1 .
It is a walk from x i to x i +1 that does not use the edge e. So it is also a walk in
G ° e, hence x i , x i +1 are in the same component in G ° e. By Lemma 4.10.2, e is
not a bridge. By Theorem 4.10.3, e must be part of a cycle. Hence G contains a
cycle.
We will often use the contrapositive form of this result: If graph G has no
cycles, then each pair of vertices is joined by at most one path.
2. Prove that, if G is connected, any two longest paths have a vertex in com-
mon.
3. Which graphs, with at least one edge, have the property that every edge is a
bridge?
4. If every vertex of a graph H with p vertices has degree at least p/5, prove that
H cannot have more than 4 components.
7. Let A n be the graph whose vertices are the {0, 1}-strings of length n, and
edges are between strings that differ in exactly two positions, n ∏ 2.
8. Let B n be the graph whose vertices are the {0, 1}-strings of length n, and
edges are between strings that differ in exactly two consecutive positions,
n ∏ 2.
124 CHAPTER 4. INTRODUCTION TO GRAPH THEORY
9. Let G be a graph in which exactly two of the vertices u, v have odd degree.
Prove that G contains a path from u to v.
Trees
5.1 Trees
A very special and important kind of graph is a tree.
Definition 5.1.1. A tree is a connected graph with no cycles.
Figure 5.1 shows a typical tree.
125
126 CHAPTER 5. TREES
Theorem 5.1.8. A tree with at least two vertices has at least two leaves.
Proof: Let P be a longest path in the tree T with end vertices u and v. Since any
edge gives a path of length 1, P must have length at least 1, so u 6= v.
Now one vertex adjacent to v is in P . If deg(v) > 1, then there must be an-
other vertex, w, adjacent to v. Vertex w cannot be in P , since this would imply
a cycle in T , whereas T has no cycles. Since w is not in P , we can extend P by
adding the edge {v, w} to it to get a longer path. This is a contradiction. Hence
deg(v) = 1. Similarly deg(u) = 1, which proves the theorem.
This proof works if, instead of choosing a longest path, we choose a path
which is not a subgraph of a path in T with more edges. (We might say that
our path is “maximal under inclusion”.) The advantage of this choice is that it
is easier to decide if a path is maximal under inclusion than to decide if it is a
longest path—for to do the latter we must consider all paths in the tree.
The following alternate proof gives more detailed information about how
many vertices of degree one a tree can have given the degrees of other vertices.
Alternate proof of Theorem 5.1.8: Let T be a tree and let n r denote the number
of vertices of degree r in T . Set p = |V (T )| and assume p ∏ 2. By Theorem 4.3.1
we have X
2p ° 2 = deg(v)
v2V (T )
and therefore
X p°1
X
°2 = (deg(v) ° 2) = n r (r ° 2).
v r =0
In the last sum, n 0 = 0 (because in a connected graph with at least two vertices,
every vertex has degree at least 1) and so we find that
X
°2 = °n 1 + (r ° 2)n r .
r ∏3
Therefore X
n1 = 2 + (r ° 2)n r .
r ∏3
4. Find the smallest number r of vertices in a tree having two vertices of degree
3, one vertex of degree 4, and two vertices of degree 6. Justify your answer by
proving that any such tree has at least r vertices, and by giving an example
of such a tree with exactly r vertices.
5. A cubic tree is a tree whose vertices have degree either 3 or 1. Prove that a
cubic tree with exactly k vertices of degree 1 has 2(k ° 1) vertices.
Proof: (“if” part.) We are given that G has a spanning tree T . Then Lemma 5.1.3
implies that there is a path in T between every pair of vertices of T . But each
5.2. SPANNING TREES 129
5 6
1 4
2 3
8
7 9
10
of these paths is also contained in G, and G has the same vertices as T , so from
Definition 4.8.1 we conclude that G is connected.
(“only if” part.) We are given that G is connected. If G has no cycles, then
G itself is a spanning tree of G. Otherwise G has a cycle. Remove any edge e of
some cycle. Then G ° e is connected, by Theorem 4.10.3, and has fewer cycles
than G.
Repeat this process, removing an edge on a cycle at each stage, until we have
a connected, spanning subgraph with no cycles. This subgraph is a spanning
tree of G.
To show that a graph is connected, using the definition, you need to give
a path between any pair of vertices. However, Theorem 5.2.1 provides a much
more succinct method: give a spanning tree.
Proof: Let e = {u, v}. Any cycle in T +e must use e, since T has no cycles. Such a
cycle consists of e along with a u, v-path in T . By Lemma 5.1.3, there is a unique
u, v-path in T , hence there is exactly one cycle C in T + e.
If e 0 is any edge in C , then e 0 is not a bridge (Theorem 4.10.3). So T + e ° e 0 is
still connected. Since it has n ° 1 edges, by Corollary 5.2.2, it is a tree.
Proof: The first statement is a direct consequence of Lemma 4.10.2. Let C 1 and
C 2 be the two components of T ° e. Suppose e 0 = {u, v} where u 2 V (C 1 ) and
v 2 V (C 2 ).
We wish to show that T ° e + e 0 is connected using Theorem 4.8.2. Let x 2
V (C 1 ). For any y 2 V (C 1 ), there exists an x, y-path since C 1 is connected. Sup-
pose y 2 V (C 2 ). Since C 1 and C 2 are connected, there exist an x, u-path P 1 and
a v, y-path P 2 . Then P 1 , e 0 , P 2 form an x, y-path. Since there exists an x, y-path
for any vertex y, T ° e + e 0 is connected.
Since T ° e + e 0 has n ° 1 edges, by Corollary 5.2.2, it is a tree.
{°k, °k + 1, . . . , k}
Proof: Given Lemma 5.3, it suffices to prove that if G is not bipartite, then it
contains an odd cycle.
Since G is not bipartite, at least one component H of G is not bipartite. (If
all components are bipartite, then we could find a bipartition of G by combin-
ing the bipartitions of the individual components.) Since H is connected, by
Theorem 5.2.1, there exists a spanning tree T in H .
Trees are bipartite (see Problem Set 5.1, Problem 2), so let (A, B ) be a bipar-
tition of T . Since H is not bipartite, (A, B ) is not a bipartition of H and therefore
there exists an edge {u, v} of H such that both u and v are in A, or both are in B .
By swapping A and B if needed, we may assume that u, v 2 A.
Since T is connected, there exists a u, v-path P in T , with vertices x 0 x 1 . . . x n
where u = x 0 and v = x n . Since x 0 = u 2 A and T is bipartite, the vertices along P
must alternate between A and B . So x 0 , x 2 , x 4 , . . . 2 A and x 1 , x 3 , x 5 , . . . 2 B . Since
x n 2 A, n must be even, hence P has even length. However, x 0 x n = uv 2 E (H ),
so P + {u, v} is an odd cycle in H , which is in G. Hence G contains an odd cycle,
as claimed.
(b) for each vertex x of T other than r , there exists a unique vertex y such
that y is adjacent to x and d (y) < d (x).
Claim:
If |V (D)| = |V (G)| when the algorithm terminates, then D is a spanning tree
of G. If |(D)| < |V (G)| when the algorithm terminates, then G is not connected
and so, from Theorem 5.2.1, G has no spanning tree.
Proof:
We begin by using mathematical induction on the number of iterations to
show that the subgraphs D produced by the algorithm are subtrees of graph G.
Basis Case: Initially, D is a tree with 1 vertex.
Induction Hypothesis: For k ∏ 0, assume that the subgraph D produced in
the k-th iteration is a tree with k + 1 vertices and k edges.
Inductive Step: If the algorithm terminates in the (k + 1)st iteration, then
there is nothing to prove. Otherwise, the (k +1)st iteration produces a subgraph
E by adding vertex v and edge {u, v} to D. Therefore E has k +2 vertices and k +1
edges. Since D is tree, there is a path from u to every vertex in D. Since u, v is
a path from u to v, there is a path from u to every vertex in E . Therefore, E is
connected by Theorem 4.8.2. By Corollary 5.2.2, E is a tree. The iteration ends
by redefining D to be the subtree E . By Mathematical Induction, D is a subtree
of G in every iteration.
If D has p vertices when the algorithm terminates, then D is a spanning tree
because it includes all the vertices of G, as required.
If D has fewer that p vertices when the algorithm terminates, then V (D) is a
nonempty, proper subset of V (G). Since the algorithm has terminated, no edge
joins a vertex u in D to a vertex v not in D. Therefore, the cut induced by V (D)
is empty. This implies that G is not connected by Theorem 4.8.5, as required.
Spanning trees have the important property of being connected. If u and v
are vertices of a connected graph, then in any spanning tree there is a unique
path joining u and v. Hence spanning trees provide a nice “small" structure
by which one can search all the vertices in a graph using only edges of the tree.
This is the reason for the parent function pr(v) = u, in which vertex v is referred
to as a child of u. In a diagram we display this information by placing an arrow
on the edge between u and v, pointing from the child v to the parent u, as in
Figure 5.3. The initial vertex r is called the root vertex, and has no parent. One
can now easily recover paths in the tree. For vertex v 6= r , there is a unique
134 CHAPTER 5. TREES
positive integer k such that prk (v) = r , and the path from v to r is
A path between two vertices u, v can be recovered from Corollary 4.6.3, using
the paths from u and v to the root r . Alternatively, we examine parents from
u and v until we find a common “ancestor". A spanning tree with this extra
structure, provided by the parent functions (the pointers, or the arrows on the
diagram) is often called a search tree. If prk (v) = r we say that the level of v is
k, and write level (v) = k. We define level (r ) to be 0.
r
pr(r) =
pr(u) = r
pr(y) = r
u y
pr(v) = u
pr(w) = u
pr(x) = u
v w x
In Figure 5.3, r is at level 0, u and y are at level 1, while v, w and x are at level
two.
In Algorithm 5.4.1, we looked for edges incident with a vertex in the tree and
a vertex not in the tree. Thus it is convenient at each stage to say that a vertex in
the tree is exhausted if it is not adjacent to a vertex outside the tree. Of course,
if a vertex is exhausted at any stage, then it will remain exhausted at all later
stages. In Algorithm 5.4.1, we can ignore edges incident with exhausted vertices,
since the only possible edges that will allow the tree to increase in size must be
incident with an unexhausted vertex in the tree. Now we consider a refinement
of Algorithm 5.4.1 called breadth-first search, in which the unexhausted vertex
u at each stage is chosen in a special way.
Algorithm 5.4.2. Breadth-first search. Follow Algorithm 5.4.1 with the follow-
ing refinement: At each stage consider the unexhausted vertex u that joined
the tree earliest among all unexhausted vertices (called the active vertex), and
choose an edge incident with this vertex and a vertex v not in the tree.
5.4. BREADTH-FIRST SEARCH 135
1 2 3 4
5 6 G
7 8 9 10
3 8 10
B
4 2 7 5 6
In Figure 5.5, the edges of B have an arrow to specify the parent. The edges
of G that are not contained in the breadth-first search tree B (called non-tree
edges) have been added to the drawing of B , without arrows. This gives a re-
drawing of G that will illustrate the primary property of breadth-first search,
given below. First we need a preliminary lemma.
Proof: We prove this by induction on the number of vertices in the tree at each
stage of the algorithm. The first vertex in the tree is the root vertex, with level 0,
and the result is true for this first stage.
Now we make the induction hypothesis, that the result is true for the first
m vertices in the tree, m ∏ 1, and consider the next vertex v, that joins the tree
at stage m + 1. Now pr(v) = u, where u is active when v joins the tree, and
level(v) = level(u) + 1. Consider any other non-root vertex x in the tree at stage
m + 1. Then pr(x) = y, and level(x) = level(y) + 1. But either y = u or y is ac-
tive before u. In the latter case, y joined the tree before u, so by the induction
hypothesis, in either case we have level(y) ∑ level(u). Thus we have
so level(v) ∏ level(x) for all other vertices x in the tree at stage m + 1, so the
result is true at stage m + 1.
Hence, the result is true by mathematical induction.
For example, it is easy to check that Lemma 5.4.3 holds for the breadth-first
search tree B given in Figure 5.5.
This result allows us to establish the following important fact about breadth-
first search.
Theorem 5.4.4. (The primary property of breadth-first search.)
In a connected graph with a breadth-first search tree, each non-tree edge in the
graph joins vertices that are at most one level apart in the search tree (of course
each tree edge joins vertices that are exactly one level apart).
Proof: Suppose that vertices u and v are joined by an edge, and without loss of
generality, that u joins the tree before v. Thus u is active before v, and there are
two cases:
Case 1. v is in the tree when u first is active. Then u and v are joined by a non-
tree edge, and pr(v) = w, where w joined the tree before u. Thus level(w) ∑
level(u), by Lemma 5.4.3, so we have
But also level(v) ∏ level(u), by Lemma 5.4.3, so we conclude in this case that u
and v are joined by a non-tree edge with
2. Consider a graph G with V (G) = {3, 4, 5, . . . , 25} and with {p, q} 2 E (G) if and
only if either p|q or q|p. (Definition: p|q if and only if q = pr for some
integer r .) Give a spanning forest of G with the largest number of edges and
hence determine the number of components of G.
3. Construct a breadth-first search tree for the graph below, taking vertex la-
belled 1 as root. When considering the vertices adjacent to the vertex being
examined, take them in increasing order of their labels.
1 2 5
13 14 6 4
11 10 7 3
12 9 8
4. What graphs have the property that, for a suitable choice of root, the breadth-
first search algorithm yields a tree in which all vertices (except the root) are
at level 1?
5. Explain why the search tree, rooted at d and indicated by dotted lines in the
graph below is not a breadth-first search tree.
a b c
d e f g
h i j
5.5. APPLICATIONS OF BREADTH-FIRST SEARCH 139
6. Prove that if a non-tree edge joins vertices u and v in adjacent levels, say
level (v) = level (u)+1, then the parent of v is at the same level as u, and was
active before u.
Proof: (i) Suppose G has a non-tree edge joining distinct vertices u, v at the
same level in T . Then the paths from u and v to the root vertex first meet at a
vertex (possibly the root vertex) which is m levels less than u and v, for some
m ∏ 1. Then the path in T between u and v has length 2m, and together with
the non-tree edge {u, v} this gives a cycle of length 2m + 1 in G, so G has an odd
cycle. (ii) If G has no non-tree edge joining vertices at the same level, then G is
bipartite, with bipartition into sets of vertices A = {v 2 V (G) : level(v) is odd },
B = {v 2 V (G) : level(v) is even}. All edges in G are incident with vertices whose
levels differ by one; hence one level must be even and one must be odd, so
every edge of G is incident with one vertex in A and one vertex in B . But, from
Lemma 5.3, this means that G has no odd cycles.
The length of the shortest path between two vertices is often called the dis-
tance between the vertices. Theorem 5.5.2 implies that we can determine the
distance between vertex u and any other vertex in a connected graph G by find-
ing a breadth-first search tree of G rooted at u.
2. The diameter of a graph is the largest of the distances between the pairs of
vertices in the graph. Let G be a connected graph of diameter three with
exactly 20 vertices at distance three from a given vertex v. Prove that G has
some spanning tree T with exactly 20 vertices of degree one at level three.
5. Suppose that a connected graph G has a breadth-first search tree T for which
every non-tree edge joins vertices at equal levels. Prove that every cycle of G
contains an even number of tree edges.
5.6. MINIMUM SPANNING TREE 141
a 9 a 9
b b
4 8 4 8
5 8 7 5 8 7
c d c d
8 3 8 3
e f e f
7 7
Prim’s algorithm:
(b) Let e = uv be an edge with the smallest weight in the cut (where
u 2 V (T ), v 62 V (T )).
In the second iteration, we look at the edges in the cut induced by {a, c},
which are {ab, cd , ce, ae}. Since ae has the smallest weight, we add it to the tree
along with the vertex e.
We repeat this process until we have a spanning tree. We claim that the tree
we produce is a minimum spanning tree.
5.6. MINIMUM SPANNING TREE 143
a 9 a 9
b b
4 8 4 8
5 8 7 5 8 7
c d c d
8 3 8 3
e f e f
7 7
a 9 a 9
b b
4 8 4 8
5 8 7 5 8 7
c d c d
8 3 8 3
e f e f
7 7
a 9 a 9
b b
4 8 4 8
5 8 7 5 8 7
c d c d
8 3 8 3
e f e f
7 7
Codes
0· H = Z , 1· H = H.
The set of all spanning subgraphs of G forms a vector space under the oper-
ation of mod 2 sum.
Proof: Look up the definition of a vector space in your linear algebra text. You
will find that the scalar multiplication and vector addition defined above must
satisfy a list of axioms. These are all easy to verify.
145
146 CHAPTER 6. CODES
Z © H = H © Z = H,
H ©H = Z,
so each element of S(G) has an additive inverse, namely itself. We have defined
0·H = Z,
1 · H © 1 · H = H © H = Z = 0 · H = (1 © 1) · H .
Proving that all the axioms of a vector space are satisfied by S(G) is left as an
exercise.
Suppose that the edges of G are e 1 , e 2 , . . . , e q , and let A i be the element of
S(G) that contains edge e i , and no other edges, for i = 1, 2, . . . , q.
Theorem 6.1.3. {A 1 , A 2 , . . . A q } forms a basis for S(G).
Proof: The graphs A 1 , A 2 , . . . A q are all contained in S(G). To prove that they
form a basis for S(G), it is sufficient to prove that they (i) span S(G) and (ii) form
a linearly independent set.
(i) The elements of S(G) are uniquely specified by their edges. For H 2 S(G),
if H contains edges e i 1 , e i 2 , . . . , e i k , then H can be written as the linear com-
bination
H = Æ1 A 1 © · · · © Æq A q
where Æi 1 = Æi 2 = · · · = Æi k = 1, and all other Æ’s are equal to 0. Thus
{A 1 , A 2 , . . . , A q } spans S(G).
Ø1 A 1 © · · · © Ø q A q = Z .
If Ø j = 1 for some j , then the graph on the LHS contains edge e j . But the
graph on the RHS contains no edges, so for equality to hold, we must have
Ø j = 0 for all j = 1, . . . , q. Thus {A 1 , A 2 , . . . , A q } is a linearly independent
set.
6.1. VECTOR SPACES AND FUNDAMENTAL CYCLES 147
This means that S(G) is a vector space of dimension q and contains 2q ele-
ments. Now we look at a subspace of S(G).
Definition 6.1.4. A graph in which all degrees are even non-negative integers is
called an even graph.
Let C (G) be the set of even spanning subgraphs of a graph G, so C (G) is a
subset of S(G).
Theorem 6.1.5. The set C (G) forms a vector space over GF (2). (This is a sub-
space of S(G).)
Proof: Clearly Z 2 C (G), so C (G) is not empty. Thus, to prove that C (G) is a
subspace of S(G), it is sufficient to prove that (i) C (G) is closed under scalar
multiplication and (ii) C (G) is closed under addition.
(i) Suppose H 2 C (G). Then 1 · H = H 2 C (G), and 0 · H = Z 2 C (G), since Z
has all vertex degrees equal to zero, which is an even non-negative inte-
ger.
(ii) Suppose H1 , H2 2 C (G), and let d 1 (v) and d 2 (v) denote the degree of v in
H1 and H2 , respectively, for all v 2 V (G). Let m(v) be the number of edges
incident with v that are contained in both H1 and H2 . Then the degree of
v in H1 © H2 is
which is even, since both d 1 (v) and d 2 (v) are even, and non-negative,
since d 1 (v) ∏ m(v) and d 2 (v) ∏ m(v). Thus H1 © H2 2 C (G).
Edges e as described in the above result are called non-tree edges. If G has
q edges and p vertices, then T has p ° 1 edges, so G has q ° (p ° 1) = q ° p + 1
non-tree edges. Suppose that the non-tree edges are e 1 , e 2 , . . . , e q°p+1 . Let C i
be the spanning subgraph of G whose edges are the edges of the unique cycle
in T + e i , for i = 1, . . . , q ° p + 1. Then C i is called a fundamental cycle, and
{C 1 ,C 2 , . . . ,C q°p+1 } is the set of fundamental cycles of G determined by T .
Lemma 6.1.7. For a fixed spanning tree T of a connected graph G, no two ele-
ments of C (G) contain exactly the same set of non-tree edges.
Proof: We have C i 2 C (G), for i = 1, . . . q °p +1, since the vertex degrees in C i are
either 2 (for vertices on the cycle in T +e i ) or 0 (for the remaining vertices). Thus,
to prove that {C 1 , . . . ,C q°p+1 } forms a basis for C (G), it is sufficient to prove that
(i) it spans C (G) and (ii) it is a linearly independent set.
(i) From Lemma 6.1.7, the elements of C (G) are uniquely specified by their
non-tree edges. For H 2 C (G), where H contains non-tree edges e i 1 , e i 2 , . . . , e i m ,
then H can be written as the linear combination
If Ø j = 1 for some j , then the graph on the LHS contains non-tree edge e j ,
since C j is the only fundamental cycle containing non-tree edge e j . But
the graph on the RHS contains no edges, so for equality to hold, we must
have Ø j = 0 for all j = 1, . . . , q ° p + 1. Thus {C 1 , . . . ,C q°p+1 } is a linearly
independent set.
This means that C (G) has dimension q °p +1 and contains 2q°p+1 elements.
The cycles of G (together with some isolated vertices) are elements of C (G) and
thus can be uniquely expressed as a mod 2 sum of fundamental cycles. We call
C (G) the cycle space of G. The number q ° p + 1 is known as the cyclomatic
number of G.
e3 e4 e5 e6
e7 e8
e9 e10 e11 e12
e13 e14
1. (a) Find the fundamental cycles corresponding to the spanning tree T with
edges
e 1 , e 2 , e 5 , e 7 , e 10 , e 11 , e 14
in the above graph. (List their edges.)
(b) Express the spanning even subgraphs with the following edge sets as
modulo 2 sums of fundamental cycles from (a):
(i) E (H1 ) = {e 1 , e 2 , e 4 , e 5 , e 7 , e 8 , e 10 , e 11 , e 13 , e 14 }
(ii) E (H2 ) = {e 3 , e 7 , e 9 , e 11 , e 12 , e 14 }
2. (a) Let T be the spanning tree given by dotted lines in the graph below.
Write down the edges in each of the fundamental cycles determined by
T.
150 CHAPTER 6. CODES
1
e1 e7 e2
6
5 e6 e12 e13 2
8 9 e8
e11 e14
e5 e15 e3
10 7
e10
e9
4 3
e4
3. In the graph shown below, let T be the spanning tree with edges
e 1 , e 5 , e 6 , e 8 , e 9 , e 10 , e 13 , e 14 , e 15 .
Write down the fundamental cycles determined by T . Also, express the cycle
C , whose edges are
e 2 , e 7 , e 12 , e 11 , e 15 , e 14 , e 8
e1 e7 e2
e6 e12 e13 e8
e11 e14
e5 e15 e3
e10
e9
e4
4. (a) In the graph below, a spanning tree has been constructed. Find the fun-
damental cycles C a ,C b and C c that are determined by the edges a, b
and c.
13 16
12 17
14 15
10 11 18 19
a
1 9
b 8 7 6
2 3 4 5
6. Prove that a graph which is connected, with 13 vertices and 18 edges, must
have at least 6 distinct cycles. Can you find such a graph with 6 edge-disjoint
cycles (edge-disjoint means that no edge may belong to more than one of
the cycles)?
9. Let F(G) be the set of spanning subgraphs with an even number of edges of
a graph G. (The spanning subgraph containing no edges belongs to F(G).
Note: F(G) is not the set of even spanning subgraphs of G.)
We can equally well speak about the Hamming distance between subgraphs,
using their characteristic vectors.
We have essentially proved the following:
Lemma 6.2.2. In the cycle space of a graph G, any two distinct vectors have
Hamming distance at least three.
Now let us see how to use this observation. Suppose that two people want
to communicate over a “channel” (such as a telephone line), capable of send-
ing 0, 1-sequences, but this channel on rare occasions introduces an error by
transmitting a 0 when a 1 was intended, or vice versa.
The two people, say Alice and Bob, can agree on a graph G = (V, E ) and
a labelling E = {e 1 , . . . , e q } of its edges, and further agree only to transmit as
messages the characteristic vectors of even subgraphs of G. Suppose that Alice
sends a message m to Bob and that Bob receives a message m 0 ; both m and m 0
are binary vectors of length q. Bob can check whether m 0 is an even subgraph
easily, but can he be sure that the message m 0 is in fact the message m? If m 0 is
not an even subgraph, Bob is absolutely sure that m 0 6= m (naturally, assuming
that Alice is playing by the rules and transmitting an even subgraph). But if m 0
is an even subgraph, Bob can only be sure that either
- m 0 is indeed m; or
Lemma 6.2.3. If fewer than t errors are made in the transmission of a code-
word, then the received message is either the original codeword, or it is not a
codeword at all.
Lemma 6.2.5. The cycle space of a connected graph G on p vertices and q edges
is a
(q, q ° p + 1, t )-code for some t ∏ 3.
This code is called the even graphical code of G. What is the distance of
such a code?
If G has a cycle of length `, this cycle has Hamming distance ` from the void
graph Z . So evidently the girth g of G is an upper bound on the distance. Can
two even subgraphs S 1 and S 2 have Hamming distance less than g ? Consider
S 1 © S 2 . If S 1 6= S 2 , then S 1 © S 2 is an even subgraph, and hence it contains a
cycle. But all cycles have at least g edges, and so
Lemma 6.2.6. The distance of the even graphical code of G equals the girth of
G.
As an aside, let’s observe that we can extend our definition of cycle space to
multigraphs in which repeated edges are permitted. If we choose the two vertex
multigraph with q edges between the vertices, the cycle space is just the set of
all binary vectors of length q with an even number of 1’s. This is the standard
even parity code.
We are left with a significant question: correcting errors. Suppose that an
even subgraph M is transmitted, but that a subgraph S is received which is not
even. Now S = M © E , where E marks the positions in which a transmission
error was made; equivalently, M = S © E . Both E and M are unknown to us;
however, we do know all of the valid codewords, and when G has girth g , we
g °1
assume that at most b 2 c errors were introduced. Under this assumption, E
cannot contain a cycle (why?). To find E , let’s observe that a vertex v has odd
degree in S if and only if it has odd degree in E (for it surely has even degree
in M ). So E is a subgraph of G with a specified set of odd degree vertices and
as few edges as possible. There is only one candidate for E , since if S © E 1 and
6.2. GRAPHICAL CODES 155
2. Produce all codewords in the even graphical code of K 3,3 . Determine the
length, distance and dimension.
3. Prove that every connected graph on an even number of vertices has a span-
ning subgraph in which all vertices have odd degree. (Hint: consider modulo
2 sums of paths.)
5. Using Problem 4, extend the (15, 6, 5)-code from the Petersen graph to a
(15, 7, 5)-code. Describe all codewords.
156 CHAPTER 6. CODES
Chapter 7
Planar Graphs
7.1 Planarity
Definition 7.1.1. A graph G is planar if it has a drawing in the plane so that its
edges intersect only at their ends, and so that no two vertices coincide. The
actual drawing is called a planar embedding of G, or a planar map.
For example, the 3-cube, which we previously considered in Figure 4.12, is a
planar graph, with a planar embedding given in Figure 7.1. A planar graph may
have a number of essentially different embeddings.
000 001
010 011
110 111
100 101
It is clear that a graph is planar if and only if each of its components is planar.
So it is often sufficient to consider only connected planar graphs and connected
157
158 CHAPTER 7. PLANAR GRAPHS
planar embeddings.
A planar embedding partitions the plane into connected regions called faces;
one of these regions, called the outer face, is unbounded. For example, the pla-
nar embedding given in Figure 7.2 has 4 faces, identified as f 1 , f 2 , f 3 , f 4 in the
diagram. In this case, the outer face is f 4 .
f4
f1 f3
f2
W f = (v 0 , e 1 , v 1 , e 2 , v 2 , . . . , v n°1 , e n , v n )
In Figure 7.1, all faces have degree 4. Note that a bridge of a planar embedding
is incident with just one face, and is contained in the boundary walk of that
face twice, once for each side. Thus a bridge contributes 2 to the degree of
the face with which it is incident. On the other hand, if e is an edge of a cycle
7.2. EULER’S FORMULA 159
Proof: Each edge has two sides, and when we sum the degrees of the faces we
are counting the edges twice, once for each side.
Note the similarity between Theorem 7.1.2 and Theorem 4.3.1. This the-
orem is colloquially known as the Faceshaking Lemma or the Handshaking
Lemma for Faces. We shall make a direct link between these results later when
we consider the dual of a planar embedding.
Corollary 7.1.3. If the connected graph G has a panar embedding with f faces,
the average degree of a face in the embedding is 2|Ef(G)| .
So far our discussion deals with planar embeddings that are connected. For
a planar embedding of a disconnected graph, there could be faces whose bound-
aries lie on several components, and a closed walk around the boundary is not
possible. For such faces, we alternatively define their degrees to be the sum
of the lengths of the boundaries around each component. For example, in the
embedding in Figure 7.3, the face f is incident with 3 components of the graph.
The boundary walks around these 3 components have lengths 5, 4, and 2, so
the degree of face f is 11.
Note that each edge is still counted twice among all boundaries walks, so
Theorem 7.1.2 also holds for disconnected graphs.
Theorem 7.3.1. A graph is planar if and only if it can be drawn on the surface of
a sphere.
Any drawing on the plane can be converted to a drawing on the sphere via
stereographic projection. Let the sphere be tangent to the plane at point A,
and let B be antipodal to A on the sphere. In stereographic projection, the im-
age of each point x on the plane is the unique point x 0 on the surface of the
sphere that lies on the line between x and B . This is illustrated in Figure 7.4.
B
x0
A
On the other hand, given any face f of an embedding G on the sphere, stere-
ographic projection provides a way to obtain a planar embedding H in which
the outer (unbounded) face corresponds to f —turn the sphere so that point B
lies in face f , and then project the embedding G to the plane to get H . If we
redraw an embedding so that a different face becomes the outside face, we con-
sider this to be the same as the original embedding. Roughly speaking, we have
the same graph, and the same faces, and the same faces are incident with the
the same edges, so they are essentially the same embedding. In particular the
number of faces of degree i in two embeddings related in this way will be equal.
A graph may have a number of essentially different planar embeddings. Fig-
ure 7.5 exhibits two embeddings of a planar graph. In the first embedding there
are two faces of degree three and two of degree five; in the second, there are two
faces of degree three, one of degree four and one of degree six. It is reassuring
to note that in both embeddings there are four faces (so Euler is happy) and the
sum of the faces degrees is 16 in both embeddings, as it should be by Theorem
7.1.2.
5 5
1 2 1 2
4 3 4 3
2. Prove that each of the graphs shown in Figure 7.6 is planar, by exhibiting a
planar embedding.
7.4. PLATONIC SOLIDS 163
a f
a b
b g
f g c
c h
i h
d i
e d
e
(a) (b)
see Figure 7.9. We call a graph platonic if it admits a planar embedding in which
each vertex has the same degree d ∏ 3 and each face has the same degree d § ∏ 3.
We will show that the only platonic graphs are those given in Figure 7.9, from
which it is easy to deduce that there are just five platonic solids.
Theorem 7.4.1. There are exactly five platonic graphs.
(d) (e)
Figure 7.9: (a) the tetrahedron; (b) the octahedron; (c) the cube;(d) the icosahe-
dron; (e) the dodecahedron
Proof: Assume p = |V (G)|, q = |E (G)| and that there are exactly f faces in the
embedding. From Euler,
p ° q + f = 2.
Since G is regular with degree d , we have 2q = d p by Theorem 4.3.1. Since
each face of the embedding has degree d § , we have 2q = d § f by Theorem 7.1.2.
Hence p = 2q/d and f = 2q/d § . So we can write Euler’s equation as
µ ∂
2q 2q 2 2
2= °q + § = q °1+ § .
d d d d
We rewrite this in turn as
2 2 2
+ § = 1+ . (7.4.1)
d d q
The basic idea now is to note that the right side of this equality is greater than
1, while the left is struggling to reach 1.
If d = 3 and d § ∏ 6, then
2 2 2 2
+ § ∑ + = 1.
d d 3 6
If d = 4 and d § ∏ 4, then
2 2 2 2
+ § ∑ + = 1.
d d 4 4
If d = 5 and d § ∏ 4, then
2 2 2 2 18
+ §∑ + = < 1.
d d 5 4 20
Finally, if d ∏ 6 and d § ∏ 3, then
2 2 2 2
+ § ∑ + = 1.
d d 6 3
It follows that (d , d § ) must be one of the five pairs in the statement of lemma.
Lemma 7.4.3. If G is a platonic graph with p vertices, q edges and f faces, where
each vertex has degree d and each face degree d § , then
2d d §
q=
2d + 2d § ° d d §
and p = 2q/d and f = 2q/d § .
7.4. PLATONIC SOLIDS 167
and the formula for q follows at once from this. We also saw that 2q = pd = f d § ,
which yields the other two claims.
To prove Theorem 7.4.1, we look at the five possible values for (d , d § ) given
in the previous lemma, and show that in each case there is a unique planar
embedding with the required parameters. We will consider the first two cases;
the remaining three cases are left as exercises.
Case 1: d = 3, d § = 3.
2·3·3
Thus q = 2·3+2·3°3·3 = 6, p = 2·6 3
= 4, and s = 2·63
= 4. Note that K 4 is the only
graph having 4 vertices and 6 edges.
Case 2: d = 3, d § = 4.
2·3·4
Thus q = 2·3+2·4°3·4 = 12, p = 2·12 3
= 8, and s = 2·12
4
= 6. Consider a planar
embedding G with these parameters. Since each face has degree 4, no vertex
can be repeated in a boundary walk, so each face boundary is a 4–cycle. Let
C = (v 1 , v 2 , v 3 , v 4 , v 1 ) be the boundary of one of the faces of G. If v 1 is adjacent to
v 3 then (v 2 , v 3 , v 1 , v 2 ) is part of some boundary walk. This contradicts that each
face is bounded by a 4–cycle. Therefore, v 1 is not adjacent to v 3 , and, similarly,
v 2 is not adjacent to v 4 . Since each vertex has degree 3, v i has a unique neigh-
bour u i not in C , for i = 1, 2, 3, 4. Note that u 1 , v 1 , v 2 , u 2 is part of the boundary
walk of some face, so u 1 6= u 2 and u 1 u 2 is an edge. Similarly u 2 u 3 , u 3 u 4 , and
u 4 u 1 are also edges. If u 1 = u 3 then u 4 is only incident with two faces, namely
(u 4 , v 4 , v 1 , u 1 , u 4 ) and (u 4 , v 4 , v 3 , u 1 , u 4 ). This contradicts that u 4 has degree 3,
and, hence, u 1 6= u 3 . By symmetry, u 2 6= u 4 . Therefore G is the 3–cube.
2. Show that there is a unique planar embedding in which each vertex has de-
gree 3 and each face has degree 5.
3. Show that there is a unique planar embedding in which each vertex has de-
gree 5 and each face has degree 3.
168 CHAPTER 7. PLANAR GRAPHS
W f = (v 0 , e 1 , v 1 , e 2 , v 2 , . . . , v n°1 , e n , v 0 )
be the boundary walk of H . Since the edge e 1 is incident with both f and g , it is
contained in W f precisely once.
The edge e 1 is not a bridge of H because
(v 1 , e 2 , v 2 , . . . , v n°1 , e n , v 0 )
Lemma 7.5.2. Let G be a planar embedding with p vertices and q edges. If each
face of G has degree at least d § , then (d § ° 2)q ∑ d § (p ° 2).
Proof: We first deal with the case when G is connected. Let f 1 , f 2 , . . . , f s be the
faces of G. Thus, applying Theorem 7.1.2, we have
s
X s
X
2q = deg( f i ) ∏ d § = d § s.
i =1 i =1
2q ∏ d § s = d § (q + 2 ° p) = d § q + 2d § ° d § p.
e1
e2
u . v
.
.
eq
q ∑ 3p ° 6.
q ∑ 3(p ° 2)/(3 ° 2) = 3p ° 6.
Theorem 7.5.3 gives an inequality that holds for all planar graphs. Therefore,
if a graph does not satisfy the inequality, then it is not planar. We illustrate this
idea below on K 5 .
Proof: We have √ !
5
|E (K 5 )| = = 10.
2
But 3p ° 6 = 15 ° 6 = 9, so for K 5 we have
q = 10 > 9 = 3p ° 6,
and the inequality q ∑ 3p ° 6 does not hold. We conclude from Theorem 7.5.3
that K 5 is not a planar graph.
Notice that Theorem 7.5.3 is only a necessary condition for a graph to be
planar. If a graph satisfies |E (G)| ∑ 3|V (G)|°6, it does not follow that it is planar.
As an example, consider the graph of Figure 7.11. Since it has K 5 as a subgraph,
it cannot be planar, but |E (G)| = 11 < 12 = 3|V (G)| ° 6.
and therefore
2q 12
∑ 6° .
p p
This shows that the average degree of a vertex in G is less than six, and therefore
G contains a vertex of degree at most five.
7.5. NONPLANAR GRAPHS 171
After a few attempts to make a planar embedding of K 3,3 , you will conclude
that it also is not planar. However, neither Theorem 7.5.3 nor Corollary 7.5.5
implies that K 3,3 is not planar. (You should check this.) Nevertheless, one can
repeat the proof of Theorem 7.5.3 with an additional observation to obtain a
result strong enough to prove that K 3,3 is not planar.
q ∑ 4(p ° 2)/(4 ° 2) = 2p ° 4.
Proof: We have
|E (K 3,3 )| = 3 · 3 = 9.
But 2p ° 4 = 2 · 6 ° 4 = 8, so for K 3,3 we have
q = 9 > 8 = 2p ° 4
and the inequality q ∑ 2p ° 4 does not hold. We conclude from Theorem 7.5.6
that K 3,3 is not a planar graph.
Theorem 7.6.1. A graph is not planar if and only if it has a subgraph that is an
edge subdivision of K 5 or K 3,3 .
(We omit the proof of this result as it is beyond the scope of our current
study.)
Note that Kuratowski’s Theorem has the following surprising consequence.
Suppose we begin with a nonplanar graph G and do the following operation
as long as it is possible. Delete a vertex v or an edge e whose deletion leaves
0
a nonplanar graph. When this process ends, what will the final graph G be?
7.6. KURATOWSKI’S THEOREM 173
1 2 3 4 5
M5
6 7 8 9 10
1
6 2
7 3
G
8 4
9 5
10
6 3
8 5
10
0
According to Kuratowski’s Theorem, G must be an edge subdivision of K 5 or
K 3,3 !
For example, in Figure 7.12, the graph M 5 has subgraph G, and G is an edge
subdivision of H . Also, H is actually K 3,3 , where the vertices in the two vertex
classes are {1, 5, 8} and {3, 6, 10}. Thus we conclude from Kuratowski’s Theorem
that M 5 is nonplanar. Figure 7.12 illustrates one convenient strategy when look-
ing for an edge subdivision of K 3,3 or K 5 : first find a long cycle in the graph – in
this case the cycle has 10 vertices; then find edges or paths (subdivided edges)
across the cycle – in this case edges {1, 10} and {5, 6}, together with any one of
edges {2, 7}, {3, 8}, {4, 9}, would create an edge subdivision of K 3,3 .
Note that M 5 has 10 vertices, 15 edges and girth 4, so our counting results
are not strong enough to prove that M 5 is not planar.
2. Let G be a connected planar graph with p vertices and q edges and girth k.
Show that
k(p ° 2)
q∑ .
k °2
Show also that if equality holds, all faces of G have degree k.
3. Prove that the Petersen graph is nonplanar, without using any form of Kura-
towski’s theorem.
5. Prove that the n-cube is not planar when n ∏ 4, without using any form of
Kuratowski’s theorem.
1
1 8
11 2
2 9 10 3
3 10 9 4
4 11
8 5
7 6
5 12
(b)
6 13
a f
7 14
b g
(a)
a
j c h
b
i c
d i
h d
e j
g e
f
(c) (d)
Figure 7.13:
176 CHAPTER 7. PLANAR GRAPHS
(c) Show that no matter which 3 edges are deleted from a 4-cube, the re-
sulting graph is not planar.
(a) Find the largest value k such that G k is planar and give a planar embed-
ding of G k .
(b) Prove that G k+1 is not planar using Kuratowski’s Theorem.
(c) Find n < 50 so that G n has K 5 as a subgraph.
(d) Find n < 40 so that G n has K 3,3 as a subgraph.
9. Prove that every planar bipartite graph G has a vertex of degree at most three.
10. Let G denote the graph below. (You may assume, without proof, that G has
girth six.)
(a) Let H be any graph obtained from G by deleting two edges. Prove that
H is not planar.
(b) Prove that there exist three edges that can be deleted from G so that the
resulting graph is planar.
11. Prove that every planar graph having girth at least six has a vertex of degree
at most two. Prove that this is false if the girth is five.
12. Prove that if G is a planar graph in which every vertex has degree at least five,
then |V (G)| ∏ 12. Find such a graph with |V (G)| = 12.
a b
n c
m d
l e
k f
j g
i h
For example, Figure 7.15 gives a 4-colouring of a graph. The colours in this
case are the integers 1, 2, 3, 4, and the colour assigned (by the function) to each
vertex is written beside the vertex in the diagram.
1 2 3
4 3 4
1 2
Proof: The proof is by induction on the number p of vertices. First note that all
graphs on one vertex are 6-colourable, so the result is true for p = 1.
For the induction hypothesis, assume the result is true for all planar graphs
on p ∑ k vertices, where k ∏ 1.
Now consider a planar graph G on p = k + 1 vertices. From Corollary 7.5.5,
G has a vertex v with deg(v) ∑ 5. Suppose we remove vertex v, and all edges
7.7. COLOURING AND PLANAR GRAPHS 179
incident to v, from G, and call the resulting graph G 0 . Then G 0 has k vertices,
and is a planar graph (all subgraphs of a planar graph are planar). Thus we
can apply the induction hypothesis to G 0 , so G 0 is 6-colourable. Now find a 6-
colouring of G 0 . There are at most 5 vertices in G 0 that are adjacent to v in G,
so these vertices are assigned at most 5 different colours in the 6-colouring of
G 0 . Thus there is at least one of the 6 colours remaining. Assign one of these
remaining colours to v, so that v has a different colour from all of its adjacent
vertices in G. Thus we have a 6-colouring of G, and the result is true for p = k +1.
We have now proved that the result is true by mathematical induction.
Let us proceed to the Five-Colour Theorem. The proof relies on the notion
of edge-contraction which we now define.
Definition 7.7.5. Let G be a graph and let e = {x, y} be an edge of G. The graph
G/e obtained from G by contracting the edge e is the graph with vertex set
V (G) \ {x, y} [ {z}, where z is a new vertex, and edge set
{{u, v} 2 E (G) : {u, v}\{x, y} = ;}[{{u, z} : u › {x, y}, {u, w} 2 E (G) for some w 2 {x, y}}.
5 2 5 2
13
e
!
4 3 4
G G/e
Figure 7.16: Contraction
!
e
K3,3 K3,3/e
Figure 7.17: Contraction
7.8. DUAL PLANAR MAPS 181
as follows: G § has one vertex for each face of G. Two vertices of G § are joined by
an edge whenever the corresponding faces of G have an edge in common (one
side for each face), and the edge in G § is drawn to cross this common boundary
edge in G. For example, Figure 7.18 illustrates the construction of G § from a
planar embedding G. Note that the faces of G § now correspond to the vertices
of G.
There are a number of things to note about the relationship between G and
G . First, a face of degree k in G becomes a vertex of degree k in G § , and a
§
2. Prove that if G is a planar graph with girth at least six, then G is 3-colourable.
(You may use the result of Problem 11 in Problem Set 7.6.)
4. Let G be a connected planar embedding in which every face has even degree.
Prove that G is a bipartite graph.
7.8. DUAL PLANAR MAPS 183
6. Show that a planar graph with p > 2 vertices and 2p°3 edges is not 2-colourable.
8. Show that K 5 can be obtained by contracting five edges of the Petersen graph.
Hence deduce from the nonplanarity of K 5 and the remark following the def-
inition of edge-contraction, that the Petersen graph is nonplanar.
Chapter 8
Matchings
8.1 Matching
A matching in a graph G is a set M of edges of G such that no two edges in
M have a common end. (Another way to express the condition is that in the
spanning subgraph of G with edge set M , every vertex has degree at most 1.) So
M matches certain pairs of adjacent vertices—hence the name. The thick edges
in Figure 8.1 form a matching. We say that a vertex v of G is saturated by M , or
that M saturates v, if v is incident with an edge in M . Of course, every graph has
a matching; for example the empty set ; is always a matching. The question we
will be most interested in is to find a largest matching in G, called a maximum
matching of G. In Figure 8.1 the matching M indicated there has size 3, and
therefore is not a maximum matching, since it is easy to find a matching of size
4. A special kind of maximum matching is one having size p/2, that is, one that
saturates every vertex, called a perfect matching. Of course, not every graph
has a perfect matching.
We will be concentrating on matching problems for bipartite graphs. Here
is a way to restate the problem in case G is bipartite.
Job assignment problem. We are given a set A of workers and a set B of jobs,
and for each job, the set of workers capable of doing the job. We want to as-
sign as many jobs as possible to workers able to do them, but each worker is to
be assigned to at most one job, and each job is to be assigned to at most one
worker.
For example, suppose that A = {a, b, c, d , e, f } and B = {g , h, i , j , k, l }, and the
lists of workers that can do the jobs are:
185
186 CHAPTER 8. MATCHINGS
a b c d
i h g e
For g : c, e
For h : a, c
For i : a, b, c, d , f
For j : c, e
For k : c, e
For l : b, d , f
Why is the job assignment problem equivalent to the maximum matching prob-
lem of bipartite graphs? From the data of the job assignment problem we can
construct a bipartite graph G with vertex set A [ B and with u 2 A adjacent to
v 2 B if and only if worker u can do job v. (The graph corresponding to the sam-
ple data above is shown in Figure 8.2.) Conversely, given a bipartite graph with
bipartition A, B we make a worker for each element of A and a job for each ele-
ment of B and declare worker u to be able to do job v if and only if {u, v} 2 E (G).
The condition that jobs be assigned to workers that can do them, means that an
assignment is a set of edges. The condition that each worker be assigned to at
most one job and that each job be assigned to at most one worker, corresponds
to the condition that the assigned edges form a matching.
If we have a matching M of G, certain kinds of paths are useful for obtaining
a larger matching. We say that a path v 0 v 1 v 2 . . . v n is an alternating path with
respect to M if one of the following is true:
{v i , v i +1 } 2 M if i is even and {v i , v i +1 } › M if i is odd
{v i , v i +1 } › M if i is even and {v i , v i +1 } 2 M if i is odd.
8.2. COVERS 187
A a b c d e f
B g h i j k l
That is, edges of the path are alternately in and not in M . In the graph of Figure
8.1, with respect to the matching indicated there, the following are examples
of alternating paths: (i) ahbg , (ii) i ahg b, (iii) i ahbg f . An augmenting path
with respect to M is an alternating path joining two distinct vertices neither of
which is saturated by M . The path (iii) above is an augmenting path in Figure
8.1. Note that augmenting paths have odd length because they begin and end
with nonmatching edges.
8.2 Covers
A cover of a graph G is a set C of vertices such that every edge of G has at least
one end in C . In Figure 8.1 {a, h, g , c, e} is a cover. It is easy to find large covers,
just as it is easy to find small matchings. For example, in any graph G, V (G) is a
cover. Also, if G is bipartite with bipartition A, B , then A is a cover, and so is B .
A very useful observation about matchings and covers is the following.
Proof: For each edge {u, v} of M , u or v is in C . Moreover, for two different edges
of M , any vertices of C they saturate must be different, since M is a matching.
Therefore, |M | ∑ |C |.
Sometimes we can use a cover to prove that a matching is maximum.
|M 0 | ∑ |C | = |M |.
3. How many perfect matchings has the graph L n of Figure 8.3? (There are n
vertical edges.) (Hint: where a n denotes the number of perfect matchings of
L n , find a recurrence relation for a n .)
6. Show that if two opposite corner squares of a chessboard are removed, then
the resulting board cannot be covered with 31 dominoes.
7. Let G be a graph with even number of vertices. Prove that if G has a Hamilton
cycle, then G has a perfect matching.
8.2. COVERS 189
···
Figure 8.3: L n
9. Show that if two squares of the chessboard having opposite colours are re-
moved, then the resulting board can be covered by 31 dominoes. Hint: Use
the previous exercise.
10. Consider the prime graph B n introduced in Problem 11 of Problem Set 4.4.
Use induction on n to show that, if n is even, B n has a perfect matching. You
may use without proof the fact that there is a prime number between k and
2k for k ∏ 2.
11. Prove that C is a cover of G if and only if V (G) \ C is a set of pairwise nonad-
jacent vertices.
12. Show that it is not always true that there exist a matching M and a cover C
of the same size.
14. In the previous problem interpret the meaning of a cover of the bipartite
graph in terms of the matrix N .
15. Find a bipartite graph G with bipartition A, B where |A| = |B | = 5, and having
the following properties. Every vertex has degree at least 2, the total number
190 CHAPTER 8. MATCHINGS
of edges is 16, and G has no perfect matching. Why does your graph not have
a perfect matching?
16. Suppose that for some n ∏ 1, graph G with p vertices satisfies p = 2n and
d eg (v) ∏ n for every vertex v. Prove that G has a perfect matching. (Hint:
Prove that if M is a matching that is not perfect, then there exists an aug-
menting path of length 1 or 3.)
17. Suppose that M is a matching of G that is not contained in any larger match-
ing, and that M 0 is a maximum matching of G. Prove that |M 0 | ∑ 2|M |.
(b) Y = B \ Z .
For example, in the graph of Figure 8.2 we have
X 0 = {b, d }, X = {a, b, c, d , e, f }, Y = {g , h, i , j , k, l }.
As a second example, consider the same graph but with a different matching,
shown in Figure 8.4. Then we have
X 0 = {d }, X = {d , b, f }, Y = {i , l }.
8.3. KÖNIG’S THEOREM 191
A a b c d e f
B g h i j k l
Notice that any alternating path P (v) has even length if v 2 X and odd
length if v 2 Y . Since the first edge of any alternating path beginning at a ver-
tex in X 0 is not a matching edge, and every second edge is a matching edge, it
follows that
(b) C = Y [ (A \ X ) is a cover of G;
Proof: Suppose that (a) is false, and let u 2 X , v 2 B \ Y , {u, v} 2 E (G). Then
adding v to the even-length alternating path P (u) from X 0 to u, gives us an
odd-length alternating path to v, which implies that v 2 Y , a contradiction.
192 CHAPTER 8. MATCHINGS
For (b), the only edges of G that are not incident with an element of C are
those from X to B \ Y . However, no such edges exist by part (a), so C is a cover.
Now suppose that (c) is false, and let u 2 Y , v 2 A\X , {u, v} 2 M . Then adding
v to the odd-length alternating path P (u) from X 0 to u, gives us an even-length
alternating path to v, which implies that v 2 X , a contradiction.
For (d ), from part (c), every edge of M joins a vertex in Y to a vertex in X , or
joins a vertex in A \ X to a vertex in B \ Y . The number of edges of the first type
is |Y | ° |U |. Also, by the fact that X 0 µ X , every vertex in A \ X is saturated by M ,
so the number of edges of the second type is |A \ X |. It follows that
|M | = |Y | ° |U | + |A \ X | = |C | ° |U |.
Finally, (e) is easy—if such a vertex v exists, then P (v) is an augmenting path.
We can check that the conclusions of Lemma 8.3.2 are satisfied in the two
examples above. Notice in particular, that in Figure 8.2 we have U = {g , j }, and,
for example, augmenting paths to g and j are given by bi c g and bi c j . If we use
the latter path to get a larger matching, then we get the matching of Figure 8.4.
In Figure 8.4, there are no unsaturated vertices in Y , so U = ;.
Proof of Theorem 8.3.1: Let M be a maximum matching of G. Then from
Lemma 8.1.1 and part (e) of Lemma 8.3.2, U must be the empty set, so |U | = 0.
Therefore, from parts (b) and (d ) of Lemma 8.3.2, C = Y [ (A \ X ) is a cover of G
with |C | = |M |, and the result follows immediately from Lemma 8.2.2.
Notice in the example of Figure 8.4 that there is no unsaturated vertex in
Y . The construction of the proof of König’s Theorem then gives the cover C =
Y [ (A \ X ) = {a, c, e, i , l }. It has size 5, and therefore shows that the matching
shown there is maximum.
Problem 8.3.3. Let G be a bipartite graph with bipartition A, B , where |A| =
|B | = n. Prove that if G has q edges, then G has a matching of size at least q/n.
Solution: Notice that what is needed, is to prove that the maximum size of
a matching is at least q/n. By König’s Theorem, it is enough to show that the
minimum size of a cover is at least q/n. Suppose that C is a cover of G. There
can be at most n edges incident to any element of C , so there can be at most
n|C | edges incident with one or more elements of C . But C is a cover, so every
edge must be incident with one or more elements of C . Therefore, n|C | ∏ q,
or |C | ∏ q/n. Since every cover contains at least q/n vertices, therefore, the
minimum size of a cover is at least q/n, and we are done.
8.3. KÖNIG’S THEOREM 193
1 2 3 4
5 6 7 8
(q + 1)/n. (In other words, show that the value q/n is the best possible in
Problem 8.3.3.)
5. Find a maximum matching and a minimum cover in the graph of Figure 8.6,
by applying the algorithm, beginning with the matching indicated.
A 1 2 3 4 5
B a b c d e
6. Find a maximum matching and a minimum cover in the graph of Figure 8.7,
by applying the algorithm, beginning with the matching indicated.
7. Find a maximum matching and a minimum cover in the graph of Figure 8.8,
by applying the algorithm, beginning with the matching of size 18 consisting
of all the edges oriented from northwest to southeast.
8. Let G be bipartite with bipartition A, B . Suppose that C and C 0 are both cov-
ers of G. Prove that Ĉ = (A \C \C 0 ) [ (B \ (C [C 0 )) is also a cover of G.
9. In the previous exercise, prove that if C and C 0 are minimum covers, then so
is Ĉ .
196 CHAPTER 8. MATCHINGS
|N (D)| ∏ |D|.
Let D = A \ C . Then
A A\C C \A
B C \B B\C
q i 2 Q i for i = 1, 2, . . . , n.
8.5. SYSTEMS OF DISTINCT REPRESENTATIVES 199
1 2 3 4
a b c d
|N (D)| ∏ |D|.
Proof: Clearly, if |A| 6= |B |, then G has no perfect matching. On the other hand,
if |A| = |B |, then G has a perfect matching if and only if it has a matching satu-
rating every vertex in A, and then the result follows from Hall’s Theorem.
Another application is to regular bipartite graphs. We can show that these
always have perfect matchings, since it is easy to show that they always satisfy
the condition of Corollary 8.6.1. This result will be used in the next section,
when we discuss edge-colouring.
Proof: Let A, B be a bipartition of G. Then since every edge has one end in A
P P
and the other in B , we have v2A d eg (v) = v2B d eg (v). It follows that k|A| =
k|B |, and therefore, since k > 0, that |A| = |B |. Now let D µ A. Then since every
edge incident with a vertex in D has its other end in N (D), we have
X X
d eg (v) ∑ d eg (v).
v2D v2N (D)
It follows that k|D| ∑ k|N (D)|, and therefore (again, since k > 0) that |N (D)| ∏
|D|. Now by Corollary 8.6.1, G has a perfect matching.
Note: Theorem 8.6.2 works even if G contains multiple edges.
8.6. PERFECT MATCHINGS IN BIPARTITE GRAPHS 201
2. In the graph of Problem Set 8.3, #7, find a set D of vertices such that
|N (D)| < |D|.
5. Let G be a bipartite graph with bipartition A, B such that |A| = |B |, and for
every proper nonempty subset D of A, we have |N (D)| > |D|. Prove that
for every edge e 2 E (G) there is a perfect matching containing e.
6. Check that the proof of Theorem 8.6.2 works even for bipartite multi-
graphs. (Note that a bipartite multigraph can have multiple edges, but
is not allowed to have loops.)
12. Let G be a bipartite graph with bipartition A, B where |A| = |B | = 2n. Sup-
pose that, for every subset X µ A and every subset X µ B such that |X | ∑ n,
|N (X )| ∏ |X |. Prove that G has a perfect matching.
202 CHAPTER 8. MATCHINGS
8.7 Edge-colouring
An edge k-colouring of a graph G is an assignment of one of a set of k colours
to each edge of G so that two edges incident with the same vertex are assigned
different colours. Consider the set of edges M that are assigned a particular
colour. Then for any vertex v, there can be at most one edge of M incident
with v. That is, M is a matching, and so an edge k-colouring of G amounts to
a partitioning of the edges of G into k matchings. Figure 8.11 shows an edge
3-colouring of a graph, where the colours are indicated by different ways of
drawing the edges.
Note that the proof of Lemma 8.7.2 suggests a modification of the matching
algorithm which will efficiently find a matching saturating all vertices of max-
imum degree. Therefore, since the proof of Theorem 8.7.1 just requires us to
find and delete such a matching and repeat, there is an efficient algorithm for
finding an edge ¢-colouring of a given bipartite graph.
204 CHAPTER 8. MATCHINGS
The answer turns out to be the smallest integer that is at least q/m and also
is at least ¢. This follows from the next result.
Theorem 8.8.1. Let G be a graph with q edges, and suppose k, m are positive
integers such that
8.8. AN APPLICATION TO TIMETABLING 205
(b) q ∑ km.
Then G has an edge k-colouring in which every colour is used at most m times.
Proof: Suppose that the colouring does not already have the desired property,
so that some colour, say red, is used at least m + 1 times. If every other colour is
used at least m times, then
a contradiction. So there exists a second colour, say blue, that is used at most
m ° 1 times.
Now the red edges and the blue edges form disjoint matchings M and M 0 of
G. Consider the spanning subgraph H of G having edgeset M [ M 0 . Then every
vertex of this graph has degree 0 or 1 or 2. Therefore, each component of H
consists of a path or a cycle with edges alternately in M and M 0 . Moreover, any
cycle is even. Since |M | > |M 0 |, there must exist a component of H containing
more edges of M than of M 0 . Such a component must consist of an augmenting
path for M 0 . If we use that path to make M 0 larger by one and to make M smaller
by one, then we have a new edge k-colouring of G such that red is used fewer
times, and blue is still used at most m times. We can repeat this argument until
we find a colouring with the desired property.
Now we can solve the bounded edge-colouring problem for bipartite graphs by
combining Theorems 8.7.1 and 8.8.1.
(a) ¢ ∑ k, and
(b) q ∑ km.
3. Prove that a k-regular bipartite graph has an edge k-colouring, using Theo-
rem 8.6.2.
5. Show that Theorem 8.8.1 does not work for vertex-colouring. That is, show
that if a graph can be k-coloured and mk ∏ p, it is not necessarily true that
there is a k-colouring in which each colour is used at most m times.
207
208 INDEX
Terquem Problem, 38
tree, 125
Unambiguous expression, 43
unique, 153
vertices, 93
walk, 110
XY-construction, 190