An Introduction To Graph Theory 1691935582
An Introduction To Graph Theory 1691935582
Darij Grinberg*
Spring 2023 edition, August 2, 2023
arXiv:2308.04512v1 [math.HO] 2 Aug 2023
Contents
1. Preface 6
1.1. What is this? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.1. Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2. Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2. Simple graphs 9
2.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2. Drawing graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3. A first fact: The Ramsey number R (3, 3) = 6 . . . . . . . . . . . . 13
2.4. Degrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.5. Graph isomorphism . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.6. Some families of graphs . . . . . . . . . . . . . . . . . . . . . . . . 26
2.6.1. Complete and empty graphs . . . . . . . . . . . . . . . . . 26
* Drexel
University, Korman Center, 15 S 33rd Street, Office #263, Philadelphia, PA 19104
(USA). // darijgrinberg@gmail.com // http://www.cip.ifi.lmu.de/~grinberg/
1
An introduction to graph theory, version August 2, 2023 page 2
3. Multigraphs 74
3.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
3.2. Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.3. Generalizing from simple graphs to multigraphs . . . . . . . . . . 79
3.3.1. The Ramsey number R (3, 3) . . . . . . . . . . . . . . . . . 80
3.3.2. Degrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.3.3. Graph isomorphisms . . . . . . . . . . . . . . . . . . . . . . 82
3.3.4. Complete graphs, paths, cycles . . . . . . . . . . . . . . . . 83
3.3.5. Induced submultigraphs . . . . . . . . . . . . . . . . . . . . 83
3.3.6. Disjoint unions . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.3.7. Walks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
3.3.8. Path-connectedness . . . . . . . . . . . . . . . . . . . . . . . 85
3.3.9. G \ e, bridges and cut-edges . . . . . . . . . . . . . . . . . . 87
3.3.10. Dominating sets . . . . . . . . . . . . . . . . . . . . . . . . 88
3.3.11. Hamiltonian paths and cycles . . . . . . . . . . . . . . . . . 88
3.3.12. Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
An introduction to graph theory, version August 2, 2023 page 3
6. Colorings 273
6.1. Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
6.2. 2-colorings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
6.3. The Brooks theorems . . . . . . . . . . . . . . . . . . . . . . . . . . 283
6.4. Exercises on proper colorings . . . . . . . . . . . . . . . . . . . . . 284
6.5. The chromatic polynomial . . . . . . . . . . . . . . . . . . . . . . . 285
6.6. Vizing’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
6.7. Further exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
8. Matchings 307
8.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
8.2. Bipartite graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
8.3. Hall’s marriage theorem . . . . . . . . . . . . . . . . . . . . . . . . 314
8.4. König and Hall–König . . . . . . . . . . . . . . . . . . . . . . . . . 317
8.5. Systems of representatives . . . . . . . . . . . . . . . . . . . . . . . 322
8.6. Regular bipartite graphs . . . . . . . . . . . . . . . . . . . . . . . . 324
8.7. Latin squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
8.8. Magic matrices and the Birkhoff–von Neumann theorem . . . . . 329
8.9. Further uses of Hall’s marriage theorem . . . . . . . . . . . . . . . 335
8.10. Further exercises on matchings . . . . . . . . . . . . . . . . . . . . 337
1. Preface
1.1. What is this?
This is a course on graphs – a rather elementary concept (actually a cluster of
closely related concepts) that can be seen all over mathematics. We will discuss
several kinds of graphs (simple graphs, multigraphs, directed graphs, etc.) and
study their features and properties. In particular, we will encounter walks on
graphs, matchings of graphs, flows on networks (networks are graphs with
extra data), and take a closer look at certain types of graphs such as trees and
tournaments.
The theory of graphs goes back at least to Leonhard Euler, who in a 1736
paper [Euler36] (see [Euler53] for an English translation) solved a puzzle about
an optimal tour of the town of Königsberg. It saw some more developments in
the 19th century and straight-up exploded in the 20th; now it is one of the most
active fields of mathematics. There are now dozens (if not hundreds) textbooks
available on the subject, such as
These texts are written at different levels of sophistication, rigor and detail, are
tailored to different audiences, and (beyond the absolute basics) often cover
An introduction to graph theory, version August 2, 2023 page 7
1.1.1. Remarks
Prerequisites. These notes target a graduate-level (or advanced undergraduate)
reader. A certain mathematical sophistication and willingness to think along
(as well as invent one’s own examples) is expected. Beyond that, the main
prerequisites are the basic properties of determinants, polynomials and finite
sums. Rings and fields are occasionally mentioned, but the reader can make do
with just the most basic examples thereof (Q, R, polynomial rings and matrix
rings; also the finite field F2 in a few places). No analysis (or even calculus) is
required anywhere in this text.
Course websites. These notes were written for my Math 530 course at Drexel
University in Spring 2022. The website of this course can be found at
https://www.cip.ifi.lmu.de/~grinberg/t/22s .
An older, but similarly structured course is my Spring 2017 course at the Uni-
versity of Minnesota. Its website is available at
https://www.cip.ifi.lmu.de/~grinberg/t/17s ,
1.2. Notations
The following notations will be used throughout these notes:
• If S is a set, then the powerset of S means the set of all subsets of S. This
powerset will be denoted by P (S).
Moreover, if S is a set, and k is an integer, then Pk (S) will mean the set of
all k-element subsets of S. For instance,
2. Simple graphs
2.1. Definitions
The first type of graphs that we will consider are the “simple graphs”, named
so because of their very simple definition:
Definition 2.1.1. A simple graph is a pair (V, E), where V is a finite set, and
where E is a subset of P2 (V ).
Example 2.1.3. For any n ∈ N, we can define a simple graph Copn to be the
pair (V, E), where V = {1, 2, . . . , n} and
(b) The set E is called the edge set of G; it is denoted by E (G ). (Again, the
letter “E” in “E ( G )” is upright, and stands for a different thing than
the “E”.)
The elements of E are called the edges of G. When u and v are two
elements of V, we shall often use the notation uv for {u, v}; thus, each
edge of G has the form uv for two distinct elements u and v of V. Of
course, we always have uv = vu.
Notice that each simple graph G satisfies G = (V ( G ) , E ( G )).
(c) Two vertices u and v of G are said to be adjacent (to each other) if
uv ∈ E (that is, if uv is an edge of G). In this case, the edge uv is said
to join u with v (or connect u and v); the vertices u and v are called
the endpoints of this edge. When the graph G is not obvious from the
context, we shall often say “adjacent in G” instead of just “adjacent”.
Two vertices u and v of G are said to be non-adjacent (to each other) if
they are not adjacent (i.e., if uv ∈
/ E).
(d) Let v be a vertex of G (that is, v ∈ V). Then, the neighbors of v (in
G) are the vertices u of G that satisfy vu ∈ E. In other words, the
neighbors of v are the vertices of G that are adjacent to v.
from Example 2.1.2. Then, its vertex set and its edge set are
(using our notation uv for {u, v}). The vertices 1 and 3 are adjacent (since
13 ∈ E ( G )), but the vertices 1 and 2 are not (since 12 ∈
/ E (G )). The neighbors
of 1 are 3 and 4. The endpoints of the edge 34 are 3 and 4.
An introduction to graph theory, version August 2, 2023 page 11
1 2 3
.
This is (in a sense) the simplest way to draw this graph: The edges are
represented by straight lines. But we can draw it in several other ways as
well – e.g., as follows:
1 3 2
.
Here, we have placed the points representing the vertices 1, 2, 3 differently.
As a consequence, we were not able to draw the edge 12 as a straight line,
because it would then have overlapped with the vertex 3, which would make
the graph ambiguous (the edge 12 could be mistaken for two edges 13 and
32).
Here are three further drawings of the same graph ({1, 2, 3} , {12, 23}):
2 2
1 3 2 .
1 3 1 3
(b) Consider the 5-th coprimality graph Cop5 defined in Example 2.1.3.
An introduction to graph theory, version August 2, 2023 page 12
2
3
4
5
.
Here is another way to draw the same graph Cop5 , with fewer intersections
between edges:
2
3
4
5
.
By appropriately repositioning the points corresponding to the five vertices
of Cop5 , we can actually get rid of all intersections and make all the edges
straight (as opposed to curved). Can you find out how?
(c) Let us draw one further graph: the simple graph
({1, 2, 3, 4, 5} , P2 ({1, 2, 3, 4, 5})). This is the simple graph whose ver-
tices are 1, 2, 3, 4, 5, and whose edges are all possible two-element sets
consisting of its vertices (i.e., each pair of two distinct vertices is adjacent).
We shall later call this graph the “complete graph K5 ”. Here is a simple way
to draw this graph:
2
3
4
5
.
This drawing is useful for many purposes; for example, it makes the ab-
stract symmetry of this graph (i.e., the fact that, roughly speaking, its vertices
An introduction to graph theory, version August 2, 2023 page 13
3
1
4
5
.
In this drawing, we have only one intersection between two curves left. Can
we get rid of all intersections?
This is a question of topology, not of combinatorics, since it really is about
curves in the plane rather than about finite sets and graphs. The answer is
“no”. (That is, no matter how you draw this graph in the plane, you will
always have at least one pair of curves intersect.) This is a classical result
(one of the first theorems in the theory of planar graphs), and proofs of it
can be found in various textbooks (e.g., [FriFri98, Theorem 4.1.2], which is
generally a good introduction to planar graph theory even if it uses termi-
nology somewhat different from ours). Note that any proof must use some
analysis or topology, since the result relies on the notion of a (continuous)
curve in the plane (if curves were allowed to be non-continuous, then they
could “jump over” one another, so they could easily avoid intersecting!).
In other words, Proposition 2.3.1 says that if a graph G has at least 6 vertices,
An introduction to graph theory, version August 2, 2023 page 14
then we can either find three distinct vertices that are mutually adjacent2 or find
three distinct vertices that are mutually non-adjacent (i.e., no two of them are
adjacent), or both. Often, this is restated as follows: “In any group of at least
six people, you can always find three that are (pairwise) friends to each other,
or three no two of whom are friends” (provided that friendship is a symmetric
relation).
We will give some examples in a moment, but first let us introduce some
convenient terminology:
Definition 2.3.2. Let G be a simple graph.
Thus, Proposition 2.3.1 says that every simple graph with at least 6 vertices
contains a triangle or an anti-triangle (or both).
Example 2.3.3. Let us show two examples of graphs G to which Proposi-
tion 2.3.1 applies, as well as an example to which it does not:
V = {1, 2, 3, 4, 5, 6} and
E = {{1, 2} , {2, 3} , {3, 4} , {4, 5} , {5, 6} , {6, 1}} .
3 2
4 1
5 6
.
V = {1, 2, 3, 4, 5, 6} and
E = {{1, 2} , {2, 3} , {3, 4} , {4, 5} , {5, 6} , {6, 1} , {1, 3} , {4, 6}} .
(This graph can be drawn in such a way as to look like a hexagon with
two extra diagonals:
3 2
4 1
5 6
.
V = {1, 2, 3, 4, 5} and
E = {{1, 2} , {2, 3} , {3, 4} , {4, 5} , {5, 1}} .
2
3
4
5
.
) Proposition 2.3.1 says nothing about this graph, since this graph does
not satisfy the assumption of Proposition 2.3.1 (in fact, its number of
vertices |V (G )| fails to be ≥ 6). By itself, this does not yield that the
claim of Proposition 2.3.1 is false for this graph. However, it is easy
to check that the claim actually is false for this graph: It has neither a
triangle nor an anti-triangle.
Remark 2.3.4. Proposition 2.3.1 could also be proved by brute force as well
(using a computer). Indeed, it clearly suffices to prove it for all simple graphs
with 6 vertices (as opposed to ≥ 6 vertices), because if a graph has more than
6 vertices, then we can just throw away some of them until we have only 6
left. However, there are only finitely many simple graphs with 6 vertices (up
to relabeling of their vertices), and the validity of Proposition 2.3.1 can be
checked for each of them. This is, of course, cumbersome (even a computer
would take a moment checking all the 215 possible graphs for triangles and
anti-triangles) and unenlightening.
Proposition 2.3.1 is the first result in a field of graph theory known as Ramsey
theory. I shall not dwell on this field in this course, but let me make a few more
remarks. The first step beyond Proposition 2.3.1 is the following generalization:
(We are only considering the cases r ≤ s, since it is easy to see that R (r, s) =
R (s, r ) for all r and s. Also, the trivial values R (1, s) = 1 and R (2, s) = s + 1
for s ≥ 2 are omitted.) The Ramsey number R (5, 5) is still unknown (although
it is known that 43 ≤ R (5, 5) ≤ 48).
Proposition 2.3.5 can be further generalized to a result called Ramsey’s theo-
rem. The idea behind the generalization is to slightly change the point of view,
and replace the simple graph G by a complete graph (i.e., a simple graph in
which every two distinct vertices are adjacent) whose edges are colored in two
colors (say, blue and red). This is a completely equivalent concept, because
the concepts of “adjacent” and “non-adjacent” in G can be identified with the
concepts of “adjacent through a blue edge” (i.e., the edge connecting them is
colored blue) and “adjacent through a red edge”, respectively. Statements 1
and 2 then turn into “there exist r distinct vertices that are mutually adjacent
through blue edges” and “there exist s distinct vertices that are mutually adja-
cent through red edges”, respectively. From this point of view, it is only logical
4 Indeed, we saw in Example 2.3.3 (c) that 5 vertices would not suffice.
An introduction to graph theory, version August 2, 2023 page 18
to generalize Proposition 2.3.5 further to the case when the edges of a complete
graph are colored in k (rather than two) colors. The corresponding generaliza-
tion is known as Ramsey’s theorem. We refer to the well-written Wikipedia
page https://en.wikipedia.org/wiki/Ramsey’s_theorem for a treatment of
this generalization with proof, as well as a table of known Ramsey numbers
R (r, s) and a self-contained (if somewhat terse) proof of Proposition 2.3.5. Ram-
sey’s theorem can be generalized and varied further; this usually goes under
the name “Ramsey theory”. For elementary introductions, see the Cut-the-knot
page http://www.cut-the-knot.org/Curriculum/Combinatorics/ThreeOrThree.shtml
, the above-mentioned Wikipedia article, as well as the texts by Harju [Harju14],
Bollobas [Bollob98] and West [West01].
There is one more direction in which Proposition 2.3.1 can be improved a bit:
A graph G with at least 6 vertices has not only one triangle or anti-triangle, but
at least two of them (this can include having one triangle and one anti-triangle).
Proving this makes for a nice exercise:
2.4. Degrees
The degree of a vertex in a simple graph just counts how many edges contain
this vertex:
(These equalities are pretty easy to check: Each edge e ∈ E that contains v
contains exactly one neighbor of v, and conversely, each neighbor of v belongs
to exactly one edge that contains v. However, these equalities are specific to
simple graphs, and won’t hold any more once we move on to multigraphs.)
For example, in the graph
3 2
4 1 5
,
Proposition 2.4.3 (Euler 1736). Let G be a simple graph. Then, the sum of
the degrees of all vertices of G equals twice the number of edges of G. In
other words,
∑ deg v = 2 · |E (G)| .
v ∈V( G )
Since these two results must be equal (because they both equal N), we thus
see that ∑ deg v = 2 · | E|. But this is the claim of Proposition 2.4.3.
v ∈V
Proposition 2.4.5. Let G be a simple graph with at least two vertices. Then,
there exist two distinct vertices v and w of G that have the same degree.
Proof. Assume the contrary. So the degrees of all n vertices of G are distinct,
where n = |V (G )|.
In other words, the map
deg : V ( G ) → {0, 1, . . . , n − 1} ,
v 7→ deg v
is injective. But this is a map between two finite sets of the same size (n). When
such a map is injective, it has to be bijective (by the pigeonhole principle).
Therefore, in particular, it takes both 0 and n − 1 as values.
In other words, there are a vertex u with degree 0 and a vertex v with degree
n − 1. Are these two vertices adjacent or not? Yes because of deg v = n − 1; no
because of deg u = 0. Contradiction!
(Fine print: The two vertices u and v must be distinct, since 0 6= n − 1. It is
here that we are using the “at least two vertices” assumption!)
V = {1, 2, 3, 4, 5, 6} ;
E = {12, 23, 34, 45, 56, 61, 14, 25, 36} .
Here is a drawing:
3 2
4 1
5 6
.
This graph has no triangle (which, by the way, is easy to verify without
checking all possibilities: just observe that every edge of G joins two vertices
of different parity, but a triangle would necessarily have two vertices of equal
parity). Thus, by the contrapositive of Mantel’s theorem, it satisfies e ≤ n2 /4
with n = 6 and e = 9. This is indeed true because 9 = 62 /4. But this also
entails that if we add any further edge to G, then we obtain a triangle.
w 4
5
.
• How many red edges can there be? I claim that there are at most n − 2.
Indeed, each vertex other than v and w is connected to at most one of v
and w by a red edge, since otherwise it would form a triangle with v and
w.
• How many blue edges can there be? The vertices other than v and w,
along with the blue edges that join them, form a graph with n − 2 vertices;
this graph has no triangles (since G has no triangles). By the induction
hypothesis, however, if this graph had more than (n − 2)2 /4 edges, then
it would have a triangle. Thus, it has ≤ (n − 2)2 /4 edges. In other words,
there are ≤ (n − 2)2 /4 blue edges.
≤ 1 + (n − 2) + (n − 2)2 /4 = n2 /4.
In other words, e ≤ n2 /4. This contradicts e > n2 /4. This is the contradiction
we were looking for, so the induction is complete.
Quick question: What about equality? Can a graph with n vertices and
exactly n2 /4 edges have no triangles? Yes (for even n). Indeed, for any even n,
we can take the graph
(keep in mind that ij means the 2-element set {i, j} here, notthe product i · j).
We can also do this for odd n, and obtain a graph with n2 − 1 /4 edges (which
is as close to n2 /4 as we can get when n is odd – after all, the number of edges
has to be an integer). So the bound in Mantel’s theorem is optimal (as far as
integers are concerned).
The following exercise can be regarded as a “mirror version” of Mantel’s
theorem:
Exercise 2.2. Let G be a simple graph with n vertices and e edges. Assume
that e < n (n − 2) /4. Prove that G has an anti-triangle (i.e., three distinct
vertices that are pairwise non-adjacent).
[Solution: This is Exercise 2 on homework set #1 from my Spring 2017
course; see the course page for solutions.]
r − 1 n2
e> · .
r 2
Then, there exist r + 1 distinct vertices of G that are mutually adjacent.
Exercise 2.4. Let G be a simple graph with n vertices and k edges, where
k
n > 0. Prove that G has at least 4k − n2 triangles.
3n
[Hint: First argue that for any edge vw of G, the total number of triangles
that contain v and w is at least deg v + deg w − n. Then, use the inequal-
ity n a21 + a22 + · · · + a2n ≥ (a1 + a2 + · · · + an )2 , which holds for any n real
numbers a1 , a2 , . . . , an . (This is a particular case of the Cauchy–Schwarz in-
equality or the Chebyshev inequality or the Jensen inequality – pick your
favorite!)]
Remark 2.4.11. Exercise 2.6 has a converse (the so-called Erdös–Gallai theo-
rem): If d1 , d2 , . . . , dn are n nonnegative integers such that d1 + d2 + · · · + dn
is even and such that d1 ≥ d2 ≥ · · · ≥ dn and such that each k ∈ {1, 2, . . . , n}
satisfies
k n
∑ di ≤ k ( k − 1) + ∑ min {di , k} ,
i =1 i = k+1
then there exists a simple graph with vertex set {1, 2, . . . , n} whose vertices
have degrees d1 , d2 , . . . , dn .
An introduction to graph theory, version August 2, 2023 page 25
1 2 3 1 3 2
and .
1 2 3 1 3 2
and
are isomorphic, because the bijection between their vertex sets that sends
1, 2, 3 to 1, 3, 2 is an isomorphism. Another isomorphism between the
same two graphs sends 1, 2, 3 to 2, 3, 1.
3 2
1 2 3
4 1
5 6 A B C
and
are isomorphic, because the bijection between their vertex sets that sends
1, 2, 3, 4, 5, 6 to 1, B, 3, A, 2, C is an isomorphism.
An introduction to graph theory, version August 2, 2023 page 26
Here are some basic properties of isomorphisms (the proofs are straightfor-
ward):
Proposition 2.5.2. Let G and H be two graphs. The inverse of a graph iso-
morphism φ from G to H is a graph isomorphism from H to G.
Proposition 2.5.4. Let G and H be two simple graphs, and φ a graph isomor-
phism from G to H. Then:
Proposition 2.5.5. Let G be a simple graph. Let S be a finite set such that
|S| = |V ( G)|. Then, there exists a simple graph H that is isomorphic to G
and has vertex set V ( H ) = S.
Proof. Straightforward.
(a) The complete graph on V means the simple graph (V, P2 (V )). It is
the simple graph with vertex set V in which every two distinct vertices
are adjacent.
If V = {1, 2, . . . , n} for some n ∈ N, then the complete graph on V is
denoted Kn .
(b) The empty graph on V means the simple graph (V, ∅). It is the simple
graph with vertex set V and no edges.
The following pictures show the complete graph and the empty graph on the
set {1, 2, 3, 4, 5}:
2 2
3 3
1 1
4 4
5 5
K0 K1 K2 K3 K4
1 2
2
3 1
1
1 2 3 4
Question: Given two finite sets V and W, what are the isomorphisms from
the complete graph on V to the complete graph on W ?
Answer: If |V | 6= |W |, then there are none. If |V | = |W |, then any bijection
from V to W is an isomorphism. The same holds for empty graphs.
This graph has n vertices and n − 1 edges (unless n = 0, in which case it has
0 edges).
Definition 2.6.3. For each n > 1, we define the n-th cycle graph Cn to be the
simple graph
This graph has n vertices and n edges (unless n = 2, in which case it has 1
edge only). (We will later modify the definition of the 2-nd cycle graph C2
somewhat, in order to force it to have 2 edges. But we cannot do this yet,
since a simple graph with 2 vertices cannot have 2 edges.)
The following pictures show the path graph P5 and the cycle graph C5 :
2 2
3 3
1 1
4 4
5 5
Of course, it is more common to draw the path graph stretched out horizontally:
1 2 3 4 5
An introduction to graph theory, version August 2, 2023 page 29
Note that the cycle graph C3 is identical with the complete graph K3 .
Question: What are the graph isomorphisms from Pn to itself?
Answer: One such isomorphism is the identity map id : {1, 2, . . . , n} →
{1, 2, . . . , n}. Another is the “reversal” map
{1, 2, . . . , n} → {1, 2, . . . , n} ,
i 7→ n + 1 − i.
{1, 2, . . . , n} → {1, 2, . . . , n} ,
i 7→ (i + k reduced modulo n to an element of {1, 2, . . . , n}) .
Thus we get n rotations (one for each k ∈ {1, 2, . . . , n}); all of them are graph
isomorphisms.
There are also the reflections, which are the maps
{1, 2, . . . , n} → {1, 2, . . . , n} ,
i 7→ (k − i reduced modulo n to an element of {1, 2, . . . , n})
for k ∈ Z. There are n of them, too, and they are isomorphisms as well.
Altogether we obtain 2n isomorphisms (for n > 2), and there are no others.
(The group they form is the n-th dihedral group.)
Example 2.6.4. If S is a finite set, and if k ∈ N, then we define the k-th Kneser
graph of S to be the simple graph
The vertices of KS,k are the k-element subsets of S, and two such subsets are
adjacent if they are disjoint.
An introduction to graph theory, version August 2, 2023 page 30
The graph K{1,2,...,5},2 is called the Petersen graph; here is how it looks like:
{1, 4}
{2, 5}
{2, 3}
{3, 4}
{1, 2} {3, 5}
{4, 5}
{1, 5}
{1, 3}
{2, 4}
2.7. Subgraphs
Definition 2.7.1. Let G = (V, E) be a simple graph.
(a) A subgraph of G means a simple graph of the form H = (W, F), where
W ⊆ V and F ⊆ E. In other words, a subgraph of G means a simple
graph whose vertices are vertices of G and whose edges are edges of G.
(c) Assume that n > 3. Is Cn−1 a subgraph of Cn ? No, because the edge
(n − 1) 1 belongs to Cn−1 but not to Cn .
Proof. This follows from Proposition 2.7.2, since the completeness of H means
that each 2-element subset {u, v} of the vertex set of H is an edge of H.
We note that triangles in a graph can be characterized in terms of complete
subgraphs. Namely, a triangle “is” the same as a complete subgraph (or, equiv-
alently, induced complete subgraph) with three vertices:
Remark 2.7.6. The situations in Exercise 2.8 are, in a sense, exceptional. Typ-
ically, the degrees of the vertices of a graph do not uniquely determine the
graph up to isomorphism. For example, the two graphs
3 2 2
1 4
4 1 3
5 6 6
and
are not isomorphic5 , but have the same degrees (namely, each vertex of either
graph has degree 3).
5 The easiest way to see this is to observe that the second graph has a triangle (i.e., three
distinct vertices that are mutually adjacent), while the first graph does not.
An introduction to graph theory, version August 2, 2023 page 33
2
2 3
1 4
3
(which makes no sense, because there are two points labelled 1 in this picture,
but a graph can have only one vertex 1), but rather should be
(1, 2)
(2, 2) (2, 3)
(1, 1)
(2, 1) (2, 4)
(1, 3)
.
So here is the formal definition:
Definition 2.8.1. Let G1 , G2 , . . . , Gk be simple graphs, where Gi = (Vi , Ei ) for
each i ∈ {1, 2, . . . , k}. The disjoint union of these k graphs G1 , G2 , . . . , Gk is
defined to be the simple graph (V, E), where
2.9.1. Definitions
Imagine a graph as a road network, where each vertex is a town and each edge
is a (bidirectional) road. By successively walking along several edges, you can
often get from a town to another even if they are not adjacent. This is made
formal in the concept of a “walk”:
Definition 2.9.1. Let G be a simple graph. Then:
(c) A path (in G) means a walk (in G) whose vertices are distinct. In other
words, a path means a walk (v0 , v1 , . . . , vk ) such that v0 , v1 , . . . , vk are
distinct.
(d) Let p and q be two vertices of G. A walk from p to q means a walk that
starts at p and ends at q. A path from p to q means a path that starts at
p and ends at q.
3 2
4 1
5 6
Then:
• A path is a walk whose vertices are distinct (i.e., each vertex appears at
most once in the walk).
Exercise 2.9. Let G be a simple graph. Let w be a path in G. Prove that the
edges of w are distinct. (This may look obvious when you can point to a
picture; but we ask you to give a rigorous proof!)
[Solution: This is Exercise 3 on homework set #1 from my Spring 2017
course; see the course page for solutions.]
An introduction to graph theory, version August 2, 2023 page 36
( a0 , a1 , . . . , ak , b1 , b2 , . . . , bℓ ) = (a0 , a1 , . . . , ak−1 , b0 , b1 , . . . , bℓ )
= (a0 , a1 , . . . , ak−1 , v, b1 , b2 , . . . , bℓ )
Proof. Since a is not a path, two of its vertices are equal. In other words, there
exist i < j such that ai = a j . Consider these i and j. Now, consider the tuple
a , a , . . . , ai , a j +1 , a j +2 , . . . , ak
|0 1{z } | {z }
the first i +1 vertices of a the last k− j vertices of a
(this is just a with the part between ai and a j cut out). This tuple is a walk from u
i + (k − j) < j + (k − j) = k. So we have found a walk
to v, and its length is |{z}
<j
from u to v whose length is smaller than k. This proves the proposition.
An introduction to graph theory, version August 2, 2023 page 37
Proof. Proposition 2.9.5 says that if there is a walk from u to v that is not a path,
then there is a walk from u to v having shorter length. Apply this repeatedly,
until you get a path. (You will eventually get a path, because the length cannot
keep decreasing forever.)
Corollary 2.9.7 reveals that Questions 1 and 2 are equivalent (indeed, the
existence of a walk from u to v entails the existence of a path from u to v
by Corollary 2.9.7, whereas the converse is obvious). Question 3 is clearly a
stronger version of Question 2 (in the sense that any answer to Question 3 will
automatically answer Question 2 as well).
With a bit more thought, it is easily seen that Question 4 is a stronger version
of Question 3. Indeed, Corollary 2.9.7 shows that a shortest walk from u to v (if
it exists) must also be a shortest path from u to v. However, any path from u to
v must have length ≤ n − 1, where n is the number of vertices of G (since a path
An introduction to graph theory, version August 2, 2023 page 38
of length k has k + 1 distinct vertices, but G has only n vertices to spare). Hence,
if there is no walk of length ≤ n − 1 from u to v, then there is no path from u to
v whatsoever. Thus, if we answer Question 4 for all values k ∈ {0, 1, . . . , n − 1},
then we obtain either a shortest path from u to v (by taking the smallest k for
which the answer is positive, and then picking the resulting walk, which must
be a shortest path by what we previously said), or proof positive that no path
from u to v exists (if the answer for each k ∈ {0, 1, . . . , n − 1} is negative).
Thus, answering Question 4 will yield answers to Questions 1, 2 and 3.
Let us now outline a way how Question 4 can be answered using a recursive
algorithm. Specifically, we recurse on k. The base case (k = 0) is easy: A walk
from u to v having length 0 exists if u = v and does not exist otherwise. The
interesting part is the recursion step: Assume that the integer k is positive, and
that we already know how to answer Question 4 for k − 1 instead of k. Now,
let us answer it for k. To do so, we observe that any walk from u to v having
length k must have the form (u, . . . , w, v), where the penultimate vertex w is
some neighbor of v. Moreover, if we remove the last vertex v from our walk
(u, . . . , w, v), then we obtain a walk (u, . . . , w) of length k − 1. Hence, we can
find a walk from u to v having length k as follows:
Thus, a simple graph G is connected if and only if it has at least one compo-
nent (i.e., it has at least one vertex) and it has at most one component (i.e., each
two of its vertices are path-connected).
Example 2.9.13. Let G be the graph with vertex set {1, 2, . . . , 9} and such
that two vertices i and j are adjacent if and only if |i − j| = 3. What are the
components of G ?
The graph G looks like this:
3
4
2
5
1
6
9
7
8
.
This looks like a jumbled mess, so you might think that all vertices are mu-
tually path-connected. But this is not the case, because edges that cross in
a drawing do not necessarily have endpoints in common. Walks can only
move from one edge to another at a common endpoint. Thus, there are
much fewer walks than the picture might suggest. We have 1 ≃ G 4 ≃ G 7
and 2 ≃ G 5 ≃ G 8 and 3 ≃ G 6 ≃ G 9, but there are no further ≃ G -relations. In
fact, two vertices of G are adjacent only if they are congruent modulo 3 (as
numbers), and therefore you cannot move from one modulo-3 congruence
class to another by walking along edges of G. So the components of G are
{1, 4, 7} and {2, 5, 8} and {3, 6, 9}. The graph G is not connected.
Example 2.9.14. Let G be the graph with vertex set {1, 2, . . . , 9} and such that
two vertices i and j are adjacent if and only if |i − j| = 6. This graph looks
An introduction to graph theory, version August 2, 2023 page 41
like this:
3
4
2
5
1
6
9
7
8
.
What are the components of G ? They are {1, 7} and {2, 8} and {3, 9} and
{4} and {5} and {6}. Note that three of these six components are singleton
sets. The graph G is not connected.
Example 2.9.15. Let G be the graph with vertex set {1, 2, . . . , 9} and such that
two vertices i and j are adjacent if and only if |i − j| = 3 or |i − j| = 4. This
graph looks like this:
3
4
2
5
1
6
9
7
8
.
(1, 4, 7, 3, 6, 9, 5, 2, 5, 8) .
This walk traverses every vertex of G; thus, any two vertices of G are path-
connected. Hence, G has only one component, namely {1, 2, . . . , 9}. Thus, G
is connected.
Example 2.9.17. The empty graph on a finite set V has |V | many components
(those are the singleton sets {v} for v ∈ V). Thus, it is connected if and only
if |V | = 1.
An introduction to graph theory, version August 2, 2023 page 42
Proof. Let G [C] be this induced subgraph. We need to show that G [C] is con-
nected. In other words, we need to show that G [ C] has exactly 1 component.
Clearly, G [ C] has at least one vertex (since C is a component, i.e., an equiv-
alence class of ≃ G , but equivalence classes are always nonempty), thus has at
least 1 component. So we only need to show that G [C] has no more than 1
component. In other words, we need to show that any two vertices of G [ C] are
path-connected in G [C].
So let u and v be two vertices of G [C]. Then, u, v ∈ C, and therefore u ≃ G
v (since C is a component of G). In other words, there exists a walk w =
(w0 , w1 , . . . , wk ) from u to v in G. We shall now prove that this walk w is
actually a walk of G [C]. In other words, we shall prove that all vertices of w
belong to C.
But this is easy: If wi is a vertex of w, then (w0 , w1 , . . . , wi ) is a walk from
u to wi in G, and therefore we have u ≃ G wi , so that wi belongs to the same
component of G as u; but that component is C. Thus, we have shown that
each vertex wi of w belongs to C. Therefore, w is a walk of the graph G [C].
Consequently, it shows that u ≃ G [C ] v.
We have now proved that u ≃ G [C ] v for any two vertices u and v of G [C].
Hence, the relation ≃ G [C ] has no more than 1 equivalence class. In other words,
the graph G [C] has no more than 1 component. This completes our proof.
In the following proposition, we are using the notation G [S] for the induced
subgraph of a simple graph G on a subset S of its vertex set.
An introduction to graph theory, version August 2, 2023 page 43
Exercise 2.12. Let V be a nonempty finite set. Let G and H be two simple
graphs such that V ( G ) = V ( H ) = V. Assume that for each u ∈ V and
v ∈ V, there exists a path from u to v in G or a path from u to v in H. Prove
that at least one of the graphs G and H is connected.
[Solution: This is Exercise 8 on homework set #1 from my Spring 2017
course; see the course page for solutions.]
vertices u and v in V are adjacent in G if and only if they are not adjacent in
G.)
Prove that at least one of the following two statements holds:
The following exercise is not explicitly concerned with connectedness and com-
ponents, but it might help to think about components to solve it (although there
are solutions that do not use them):
Exercise 2.15. Let G be a simple graph with n vertices. Assume that each
vertex of G has at least one neighbor.
A matching of G shall mean a set F of edges of G such that no two edges
in F have a vertex in common. Let m be the largest size of a matching of G.
An edge cover of G shall mean a set F of edges of G such that each vertex
of G is contained in at least one edge e ∈ F. Let c be the smallest size of an
edge cover of G.
Prove that c + m = n.
(a) A closed walk of G means a walk whose first vertex is identical with
its last vertex. In other words, it means a walk (w0 , w1 , . . . , wk ) with
w0 = wk . Sometimes, closed walks are also known as circuits (but
many authors use this latter word for something slightly different).
This graph looks as follows (we have already seen it in Example 2.9.2):
3 2
4 1
5 6
Then:
• The sequences (1) and (1, 2, 1) are closed walks, but not cycles of G
(since they fail the k ≥ 3 condition).
Authors have different opinions about whether (1, 2, 3, 1) and (1, 3, 2, 1) count
as different cycles. Fortunately, this matters only if you want to count cycles,
but not for the existence or non-existence of cycles.
We have now defined paths (in an arbitrary graph) and also path graphs Pn ;
we have also defined cycles (in an arbitrary graph) and also cycle graphs Cn .
Besides their similar names, are they related? The answer is “yes”:
Proof. Straightforward.
Certain graphs contain cycles; other graphs don’t. For instance, the complete
graph Kn contains a lot of cycles (when n ≥ 3), whereas the path graph Pn
contains none. Let us try to find some criteria for when a graph can and when
it cannot have cycles7 :
Proof of Proposition 2.10.4. We assume that w is not a path. We must then show
that w contains a cycle.
Write w as w = (w0 , w1 , . . . , wk ). Since w is not a path, two of the vertices
w0 , w1, . . . , wk must be equal. In other words, there exists a pair (i, j) of integers
i and j with i < j and wi = w j . Among all such pairs, we pick one with
minimum difference j − i. We shall show that the walk wi , wi +1, . . . , w j is a
cycle.
First, this walk is clearly a closed walk (since wi = w j ). It thus remains to
show that j − i ≥ 3 and that the vertices wi , wi +1, . . . , w j−1 are distinct. The
distinctness of wi , wi +1, . . . , w j−1 follows from the minimality of j − i. To show
that j − i ≥ 3, we assume the contrary. Thus, j − i is either 1 or 2 (since i < j).
But j − i cannot be 1, since the endpoints of an edge cannot be equal (since our
graph is a simple graph). So j − i must be 2. Thus, wi = wi +2. Therefore, the
two edges wi wi +1 and wi +1 wi +2 are identical. But this contradicts the fact that
no two adjacent edges of w are identical. Contradiction, qed.
Corollary 2.10.6. Let G be a simple graph. Assume that G has a closed walk
w of length > 0 such that no two adjacent edges of w are identical. Then, G
has a cycle.
Proof. More generally, we shall prove this theorem with the word “path” re-
placed by “backtrack-free walk”, where a “backtrack-free walk” means a walk
w such that no two adjacent edges of w are identical. This is a generalization
of the theorem, since every path is a backtrack-free walk (why?).
So we claim the following:
( p 0 , p 1 , . . . , p a − 1 , p a = q b , q b − 1 , . . . , q0 ) .
(a) Prove that if G has a closed walk of odd length, then G has a cycle of
odd length.
(b) Is it true that if G has a closed walk of length not divisible by 3, then G
has a cycle of length not divisible by 3 ?
(c) Does the answer to part (b) change if we replace “walk” by “non-
backtracking walk”? (A walk w with edges e1 , e2 , . . . , ek (in this or-
der) is said to be non-backtracking if each i ∈ {1, 2, . . . , k − 1} satisfies
ei 6= ei +1 .)
(d) A trail (in a graph) means a walk whose edges are distinct (but whose
vertices are not necessarily distinct). Does the answer to part (b) change
if we replace “walk” by “trail”?
Proposition 2.11.1. Let G be a simple graph with at least one vertex. Let
d > 1 be an integer. Assume that each vertex of G has degree ≥ d. Then, G
has a cycle of length ≥ d + 1.
p′ := (u, v0 , v1 , . . . , vm ) .
v0 v1 v2 ··· vi = u ···
c := (u, v0 , v1 , . . . , vi ) .
2.12. Bridges
One question that will later prove crucial is: What happens to a graph if we
remove a single edge from it? Let us first define a notation for this:
Definition 2.12.1. Let G = (V, E) be a simple graph. Let e be an edge of G.
Then, G \ e will mean the graph obtained from G by removing this edge e.
In other words,
G \ e := (V, E \ {e}) .
a (1)
(where we have labeled the edges a and b for further reference). This graph
has 4 components. The edge a is an edge of a cycle of G, whereas the edge
An introduction to graph theory, version August 2, 2023 page 51
Proof of Theorem 2.12.2. We will only sketch the proof. For details, see [21f6,
§6.7].
Let u and v be the endpoints of e, so that e = uv. Note that (u, v) is a path of
G, and thus we have u ≃ G v.
(a) Assume that e is an edge of some cycle of G. Then, if you remove e from
this cycle, then you still have a path from u to v left (as the remaining edges of
the cycle function as a detour), and this path is a path of G \ e. Thus, u ≃ G \e v.
Now, we must show that the components of G \ e are precisely the compo-
nents of G. This will clearly follow if we can show that the relation ≃ G \e is
precisely the relation ≃ G (because the components of a graph are the equiva-
lence classes of its ≃ relation). So let us prove the latter fact.
We must show that two vertices x and y of G satisfy x ≃ G \e y if and only if
they satisfy x ≃ G y. The “only if” part is obvious (since a walk of G \ e is always
a walk of G). It thus remains to prove the “if” part. So we assume that x and y
are two vertices of G satisfying x ≃ G y, and we want to show that x ≃ G \e y.
An introduction to graph theory, version August 2, 2023 page 52
( x, . . . , u, v, . . . , y) .
If we remove the edge e = uv, then this path breaks into two smaller paths
( x, . . . , u) and (v, . . . , y)
(since the edges of a path are distinct, so e appears only once in it). Both of
these two smaller paths are paths of G \ e. Thus, x ≃ G \e u and v ≃ G \e y.
Now, recalling that ≃ G \e is an equivalence relation, we combine these results to
obtain
x ≃ G \e u ≃ G \e v ≃ G \e y.
Hence, x ≃ G \e y. This completes the proof of Theorem 2.12.2 (a).
(b) Assume that e appears in no cycle of G. We must prove that the graph G \
e has one more component than G. To do so, it suffices to show the following:
• Case 1: This path p does not use the edge e. In this case, p is a path of
G \ e, and thus we obtain c ≃ G \e u. In other words, c ∈ A (since A is the
component of G \ e containing u).
• Case 2: This path p does use the edge e. In this case, the edge e must be
the last edge of p (since the path p would otherwise contain the vertex u
twice11 ; but a path cannot contain a vertex twice), and the last two vertices
of p must be v and u in this order. Thus, by removing the last vertex from
p, we obtain a path from c to v, and this latter path is a path of G \ e (since
it no longer contains u and therefore does not use e). This yields c ≃ G \e v.
In other words, c ∈ B (since B is the component of G \ e containing v).
In either of these two cases, we have shown that c belongs to one of A and B.
In other words, c ∈ A ∪ B. This is precisely what we wanted to show. This
completes the proof of Theorem 2.12.2 (b).
We introduce some fairly standard terminology:
(b) We say that e is a cut-edge (of G) if the graph G \ e has more compo-
nents than G.
3 0 1
results in an empty graph on the set {1, 2, 3, 4}, so the number of components
has increased from 1 to 4.
2
3
4
5
C5 = ({1, 2, 3, 4, 5} , {12, 23, 34, 45, 51}) = .
12 When we remove a vertex, we must of course also remove all edges that contain this vertex.
An introduction to graph theory, version August 2, 2023 page 55
The set {1, 3} is a dominating set for C5 , since all three vertices 2, 4, 5 that
don’t belong to {1, 3} have neighbors in {1, 3}. The set {1, 5} is not a dom-
inating set for C5 , since the vertex 3 has no neighbor in {1, 5}. There is no
dominating set for C5 that has size 0 or 1, but there are several of size 2, and
every subset of size ≥ 3 is dominating.
Clearly, the “denser” a graph is (i.e., the more edges it has), the “easier” it
is for a set to be dominating. Often, a graph is given, and one is interested in
finding a dominating set of the smallest possible size13 . As the case of an empty
graph reveals, sometimes the only choice is the whole vertex set. However, in
many cases, we can do better. Namely, we need to require that the graph has
no isolated vertices:
(b) There exist two disjoint dominating subsets A and B of V such that
A ∪ B = V.
13 Supposedly,this has applications in mobile networking: For example, you might want to
choose a set of routers in a given network so that each node is either a router or directly
connected (i.e., adjacent) to one.
An introduction to graph theory, version August 2, 2023 page 56
One proof of this proposition will be given in Exercise 2.19 below (homework
set #2 exercise 4). Another appears in [17s, §3.6].
For specific graphs, the bound |V | /2 in Proposition 2.13.4 (a) can often be
improved. Here is an example:
Exercise 2.17. Let n ≥ 3 be an integer. Find a formula for the smallest size
of a dominating set of the cycle graph Cn . You can use the ceiling function
x 7→ ⌈ x ⌉, which sends a real number x to the smallest integer that is ≥ x.
Exercise 2.19. Let G = (V, E) be a connected simple graph with at least two
vertices.
The distance d (v, w) between two vertices v and w of G is defined to be
the smallest length of a path from v to w. (In particular, d (v, v) = 0 for each
v ∈ V.)
Fix a vertex v ∈ V. Define two subsets
of V.
(c) Prove that there exists a dominating set of G that has size ≤ |V | /2.
(d) Prove that the claim of part (c) holds even if we don’t assume that G is
connected, as long as we assume that each vertex of G has at least one
neighbor. (In other words, prove Proposition 2.13.4 (a).)
Three proofs of this theorem are given in Brouwer’s note [Brouwe09].14 Let
me show the one I like the most. We first need a notation:
3 2
4 1
5 6
C6 = ({1, 2, 3, 4, 5, 6} , {12, 23, 34, 45, 56, 61}) = .
Then, ({1, 2} , {4, 5}) is a detached pair, whereas ({1, 2} , {3, 4}) is not (since
23 is an edge). Of course, there are many other detached pairs; in particular,
any pair of the form (∅, B) or ( A, ∅) is detached.
Let me stress that the word “pair” always means “ordered pair” unless I say
otherwise. So, if ( A, B) is a detached pair, then ( B, A) is a different detached
pair, unless A = B = ∅.
Here is an attempt at a proof of Theorem 2.13.5. It is a nice example of how
to apply known results to new graphs to obtain new results. The only problem
is, it shows a result that is a bit at odds with the claim of the theorem...
Proof of Theorem 2.13.5, attempt 1. Write the graph G as (V, E).
Recall that P (V ) denotes the set of all subsets of V.
Construct a new graph H with the vertex set P (V ) as follows: Two subsets
A and B of V are adjacent as vertices of H if and only if ( A, B) is a detached
pair. (Note that if the original graph G has n vertices, then this graph H has 2n
vertices. It is huge!)
I claim that the vertices of H that have odd degree are precisely the subsets
of V that are dominating. In other words:
[Proof of Claim 1: We let N ( A) denote the set of all vertices of G that have a
neighbor in A. (This may or may not be disjoint from A.)
The neighbors of A (as a vertex in H) are precisely the subsets B of V such
that ( A, B) is a detached pair (by the definition of H). In other words, they are
the subsets B of V that are disjoint from A and also have no neighbors in A (by
the definition of a “detached pair”). In other words, they are the subsets B of
V that are disjoint from A and also disjoint from N ( A). In other words, they
are the subsets of the set V \ ( A ∪ N ( A)). Hence, the number of such subsets
B is 2|V \( A∪ N ( A))| .
The degree of A (as a vertex of H) is the number of neighbors of A in H.
Thus, this degree is 2|V \( A∪ N ( A))| (because we have just shown that the num-
ber of neighbors of A is 2|V \( A∪ N ( A))| ). But 2k is odd if and only if k = 0.
Thus, we conclude that the degree of A (as a vertex of H) is odd if and only if
|V \ ( A ∪ N ( A))| = 0. The condition |V \ ( A ∪ N ( A))| = 0 can be rewritten as
follows:
(|V \ ( A ∪ N ( A))| = 0)
⇐⇒ (V \ ( A ∪ N ( A)) = ∅)
⇐⇒ (V ⊆ A ∪ N ( A))
⇐⇒ (V \ A ⊆ N ( A))
⇐⇒ (each vertex v ∈ V \ A belongs to N ( A))
⇐⇒ (each vertex v ∈ V \ A has a neighbor in A)
⇐⇒ ( A is dominating) (by the definition of “dominating”) .
Thus, what we have just shown is that the degree of A (as a vertex of H) is odd
if and only if A is dominating. This proves Claim 1.]
Claim 1 shows that the vertices of H that have odd degree are precisely the
dominating sets of G. But the handshake lemma (Corollary 2.4.4) tells us that
any simple graph has an even number of vertices of odd degree. Applying this
to H, we conclude that there is an even number of dominating sets of G.
Huh? We want to show that there is an odd number of dominating sets of G,
not an even number! Why did we just get the opposite result?
Puzzle: Find the mistake in our above reasoning! The answer will be revealed
on the next page.
An introduction to graph theory, version August 2, 2023 page 59
Part (a) of this theorem is obvious (recall that if ( A, B) is a detached pair, then
so is ( B, A)). Part (b) is the interesting part. In [17s, §3.3–§3.4], I give a long but
elementary proof.
An introduction to graph theory, version August 2, 2023 page 60
More recently ([HeiTit18]), Heinrich and Tittmann have refined their formula
to allow counting dominating sets of a given size. Their main result is the
following formula (exercise 5 on homework set #2):
Exercise 2.20. Let G = (V, E) be a simple graph with at least one vertex. Let
n = |V |. A detached pair means a pair ( A, B) of two disjoint subsets A and
B of V such that there exists no edge ab ∈ E with a ∈ A and b ∈ B.
Prove the following generalization of the Heinrich–Tittmann formula:
∑ x |S | = (1 + x ) n − 1 + ∑ (−1)| A| x | B| .
S is a dominating ( A,B ) is a detached pair;
set of G A 6 = ∅; B 6 = ∅
v1 . This closed walk will certainly contain each vertex. Conversely, such a walk
cannot exist if G is not connected.
The question becomes a lot more interesting if we replace “closed walk” by
“path” or “cycle”. The resulting objects have a name:
Example 2.14.3. Which of the following eight graphs have hamps? Which
have hamcs?
3 2
5 2
A= 4 1
B= 4 1
5 6 6 3
1 1 2
D=
C=
2 3 3 4
3 2
E= 4 0 1 5 6 7 8
5 6 F= 1 2 3 4
2′ 2′
3′ 3′
2 2
3 3
G= 1 1′ H= 1 1′
4 4
5 5
4′ 4′
5′ 5′
Answers:
• The graph B has a hamp (2, 3, 1, 4, 5, 6), but no hamc. The easiest way
to see that B has no hamc is the following: The edge 14 is a cut-edge
(i.e., removing it renders the graph disconnected), thus a bridge (i.e., an
edge that appears in no cycle); therefore, any cycle must stay entirely
“on one side” of this edge.
• The graph C has a hamp (0, 1, 2, 3), but no hamc. The argument for the
non-existence of a hamc is the same as for B: The edge 01 is a bridge.
• The graph D has neither a hamp nor a hamc, because it is not con-
nected. Only a connected graph can have a hamp.
• The graph E has a hamp (0, 3, 2, 1, 6, 5, 4), but no hamc (checking this
requires some work, though).
• The graph G has a hamc (1, 2, 3, 4, 5, 5′, 4′ , 3′ , 2′ , 1′ , 1), thus also a hamp.
There are various proofs of this theorem scattered around; see [Harju14, The-
orem 3.6] or [Guicha16, Theorem 5.3.2]. We shall give another proof (following
the “Algorithm” section on the Wikipedia page for “Ore’s theorem”):
Proof of Theorem 2.14.4. A listing (of V) shall mean a list of elements of V that
contains each element exactly once. It must clearly be an n-tuple.
The hamness of a listing (v1 , v2 , . . . , vn ) will mean the number of all i ∈
{1, 2, . . . , n} such that vi vi +1 ∈ E. Here, we set vn+1 = v1 . (Visually, it is best
to represent a listing (v1 , v2 , . . . , vn ) by drawing the vertices v1 , v2 , . . . , vn on a
circle in this order. Its hamness then counts how often two successive vertices
on the circle are adjacent in the graph G.) Note that the hamness of a listing
(v1 , v2 , . . . , vn ) does not change if we cyclically rotate the listing (i.e., transform
it into (v2 , v3 , . . . , vn , v1 )).
Clearly, if we can find a listing (v1 , v2 , . . . , vn ) of hamness ≥ n, then all of
v1 v2 , v2 v3 , . . . , vn v1 are edges of G, and thus (v1 , v2 , . . . , vn , v1 ) is a hamc of G.
Thus, we need to find a listing of hamness ≥ n.
To do so, I will show that if you have a listing of hamness < n, then you can
slightly modify it to get a listing of larger hamness. In other words, I will show
the following:
[Proof of Claim 1: Since the listing (v1 , v2 , . . . , vn ) has hamness k < n, there
exists some i ∈ {1, 2, . . . , n} such that vi vi +1 ∈/ E. Pick such an i. Thus, the
vertices vi and vi +1 of G are non-adjacent. The “deg x + deg y ≥ n” assumption
of the theorem thus yields deg (vi ) + deg (vi +1 ) ≥ n.
However,
• First, cyclically rotate the old listing so that it begins with vi +1 . Thus, you
get the listing (vi +1, vi +2 , . . . , vn , v1 , v2 , . . . , vi ).
• Then, reverse the part of the listing starting at vi +1 and ending at v j . Thus,
you get the new listing
v j , v j −1 , . . . , vi +1 , v j +1 , v j +2 , . . . , vi .
| {z } | {z }
This is the reversed part; This is the part that
it may or may not “wrap around” was not reversed.
(i.e., contain ...,v1 ,vn ,... somewhere).
I claim that this new listing has hamness larger than k. Indeed, rotating the
old listing clearly did not change its hamness. But reversing the part from vi +1
to v j clearly did: After the reversal, the edges vi vi +1 and v j v j+1 no longer count
towards the hamness (if they were edges to begin with), but the edges vi v j and
vi +1 v j+1 started counting towards the hamness. This is a good bargain, because
it means that the hamness gained +2 from the newly-counted edges vi v j and
An introduction to graph theory, version August 2, 2023 page 66
vi +1 v j+1 (which, as we know, both exist), while only losing 0 or 1 (since the
edge vi vi +1 did not exist, whereas the edge v j v j+1 may or may not have been
lost). Thus, the hamness of the new listing is larger than the hamness of the
old listing either by 1 or 2. In other words, it is larger than m by at least 1 or 2.
This proves Claim 1.]
Now, we can start with any listing of V and keep modifying it using Claim 1,
increasing its hamness each time, until its hamness becomes ≥ n. But once its
hamness is ≥ n, we have found a hamc (as explained above). Theorem 2.14.4 is
thus proven.
Proof. Follows from Ore’s theorem, since any two vertices x and y of G satisfy
n n
deg x + deg y ≥ + = n.
| {z } | {z } 2 2
n n
≥ ≥
2 2
Exercise 2.22.
(a) Let G = (V, E) be a simple graph, and let u and v be two distinct
vertices of G that are not adjacent. Let n = |V |. Assume that deg u +
deg v ≥ n. Let G ′ = (V, E ∪ {uv}) be the simple graph obtained from
G by adding a new edge uv. Assume that G ′ has a hamc. Prove that G
has a hamc.
3 2
G= 4 0 1
5 6
(For example, if and S = {3, 6}, then
2
G\S = 4 0 1
5
.)
Also, we let b0 ( H ) denote the number of connected components of a sim-
ple graph H.
For example, part (a) of this proposition shows that the graph E from Exam-
ple 2.14.3 has no hamc, because if we take S to be {3, 6}, then b0 ( G \ S) = 3
whereas |S| = 2. Thus, the proposition can be used to rule out the existence of
hamps and hamcs in some cases.
Proof of Proposition 2.14.6. (a) Let S ⊆ V be a nonempty set. If we cut |S| many
vertices out of a cycle, then the cycle splits into at most |S| paths:
† †
Of course, our graph G itself may not be a cycle, but if it has a hamc, then the
removal of the vertices in S will split the hamc into at most | S| paths (according
to the preceding sentence), and thus the graph G \ S will have ≤ |S| many
components (just using the surviving edges of the hamc alone). Taking into
account all the other edges of G can only decrease the number of components.
An introduction to graph theory, version August 2, 2023 page 68
2.14.4. Hypercubes
Now, let us move on to a concrete example of a graph that has a hamc.
Q1 = 0
01 11
Q2 = 00 10
101 111
001 011
100 110
Q3 = 000 010
Such hamcs are known as Gray codes. They are circular lists of bitstrings of
length n such that two consecutive bitstrings in the list always differ in exactly
one bit. See the Wikipedia article on “Gray codes” for applications.
Proof of Theorem 2.14.9. We will show something stronger:
)
An introduction to graph theory, version August 2, 2023 page 70
and
(v, w1 ) (v, w2 ) where w1 w2 ∈ F and v ∈ V.
C5 C5 × P2
(2, 2)
(3, 2)
(2, 1)
(3, 1)
(1, 1) (1, 2)
2
3 (4, 1)
(5, 1)
1 (4, 2)
4
(5, 2)
5
Proof. This is Exercise 1 (a) on homework set #2 from my Spring 2017 course;
see the course page for solutions.
Now, we claim the following:
Theorem 2.14.12. Let G and H be two simple graphs. Assume that each of
the two graphs G and H has a hamp. Then:
An introduction to graph theory, version August 2, 2023 page 72
(b) Now assume furthermore that at least one of the two numbers |V ( G )|
and |V ( H )| is even, and that both numbers |V ( G )| and |V ( H )| are
larger than 1. Then, the Cartesian product G × H has a hamc.
Since Gn ∼
= Qn , we can restate this question equivalently as follows: If n ≥ 3
is odd, and if Q′n is the induced subgraph of Qn on the set
( )
n
n − 1 n + 1
a1 a2 · · · an ∈ {0, 1}n | ∑ ai ∈ , ,
i =1
2 2
Exercise 2.23. Let n and k be two integers such that n > k > 0. Define the
simple graph Qn,k as follows: Its vertices are the bitstrings ( a1 , a2 , . . . , an ) ∈
{0, 1}n ; two such bitstrings are adjacent if and only if they differ in exactly k
bits (in other words: two vertices ( a1 , a2 , . . . , an ) and (b1 , b2 , . . . , bn ) are adja-
cent if and only if the number of i ∈ {1, 2, . . . , n} satisfying ai 6= bi equals k).
(Thus, Qn,1 is the n-hypercube graph Qn .)
(a) Does Qn,k have a hamc when k is even? (Recall that “hamc” is short for
“Hamiltonian cycle”.)
[Hint: One way to approach part (b) is by identifying the set {0, 1} with
the field F2 with two elements. The bitstrings ( a1 , a2 , . . . , an ) ∈ {0, 1}n thus
become the size-n row vectors in the F2 -vector space F2n . Let e1 , e2 , . . . , en be
the standard basis vectors of F2n (so that ei has a 1 in its i-th position and
zeroes everywhere else). Then, two vectors are adjacent in the n-hypercube
graph Qn (resp. in the graph Qn,k ) if and only if their difference is one of the
standard basis vectors (resp., a sum of k distinct standard basis vectors). Try
to use this to find a graph isomorphism from Qn to a subgraph of Qn,k .]
The next exercise extends the idea of our proof of Theorem 2.14.9:
3. Multigraphs
3.1. Definitions
So far, we have been working with simple graphs. We shall now introduce
several other kinds of graphs, starting with the multigraphs.
Definition 3.1.1. Let V be a set. Then, P1,2 (V ) shall mean the set of all
1-element or 2-element subsets of V. In other words,
For instance,
P1,2 ({1, 2, 3}) = {{1} , {2} , {3} , {1, 2} , {1, 3} , {2, 3}} .
Definition 3.1.2. A multigraph is a triple (V, E, ϕ), where V and E are two
finite sets, and ϕ : E → P1,2 (V ) is a map.
2
β
α δ
γ
ǫ
λ 1 3 4 5
κ
V = {1, 2, 3, 4, 5} , E = {α, β, γ, δ, ε, κ, λ} ,
(c) If e is an edge of G, then the elements of ϕ (e) are called the endpoints
of e.
(d) We say that an edge e contains a vertex v if v ∈ ϕ (e) (in other words, if
v is an endpoint of e).
(e) Two vertices u and v are said to be adjacent if there exists an edge e ∈ E
whose endpoints are u and v.
(f) Two edges e and f are said to be parallel if ϕ (e) = ϕ ( f ). (In the above
example, any two of the edges δ, ε, κ are parallel.)
(g) We say that G has no parallel edges if G has no two distinct edges that
are parallel.
(h) An edge e is called a loop (or self-loop) if ϕ (e) is a 1-element set (i.e.,
if e has only one endpoint). (In Example 3.1.3, the edge λ is a loop.)
deg v = degG v
:= |{e ∈ E | v ∈ ϕ (e)}| + |{e ∈ E | ϕ (e) = {v}}| .
| {z } | {z }
this counts all edges this counts all loops
that contain v that contain v once again
(Note that, unlike in the case of a simple graph, deg v is not the number
of neighbors of v, unless it happens that v is not contained in any loops
or parallel edges.)
(For example, in Example 3.1.3, we have deg 1 = 3 and deg 2 = 3 and
deg 3 = 2 and deg 4 = 3 and deg 5 = 3.)
( v0 , e1 , v1 , e2 , v2 , . . . , e k , v k ) (with k ≥ 0) ,
An introduction to graph theory, version August 2, 2023 page 76
ϕ ( ei ) = { vi −1 , vi }
(that is, the endpoints of each edge ei are vi −1 and vi ). Note that we
have to record both the vertices and the edges in our walk, since we
want the walk to “know” which edges it traverses. (For instance, in
Example 3.1.3, the two walks (1, α, 2, β, 3) and (1, α, 2, γ, 3) are distinct.)
The vertices of a walk (v0 , e1 , v1 , e2 , v2 , . . . , ek , vk ) are v0 , v1 , . . . , vk ; the
edges of this walk are e1 , e2 , . . . , ek . This walk is said to start at v0 and
end at vk ; it is also said to be a walk from v0 to vk . Its starting point is
v0 , and its ending point is vk . Its length is k.
(n) A closed walk (or circuit) means a walk (v0 , e1, v1 , e2, v2 , . . . , ek , vk ) with
v k = v0 .
(p) Hamiltonian paths and cycles are defined as for simple graphs.
Nevertheless, the two notions have much in common; thus, they are both
called “graphs”:
Convention 3.1.5. The word “graph” means either “simple graph” or “multi-
graph”. The precise meaning should usually be understood from the context.
(I will try not to use it when it could cause confusion.)
3.2. Conversions
We can turn each multigraph into a simple graph, but at a cost of losing some
information:
In other words, it is the simple graph with vertex set V in which two distinct
vertices u and v are adjacent if and only if u and v are adjacent in G. Thus,
Gsimp is obtained from G by removing loops and “collapsing” parallel edges
to a single edge.
1 3 4 5
.
(V, E, ι) ,
Example 3.2.3. If
G= 1 3 4
,
then
2
{1, 2} {2, 3}
{3, 4}
Gmult = 1 3 4
{1, 3}
.
Proof. This is not completely obvious, since our definitions of a cycle of a simple
graph and of a cycle of a multigraph were somewhat different. The proof boils
down to checking the following two statements:
Checking statement 2 is easy (we cannot have k = 1 since Gmult has no loops,
and we cannot have k = 2 since this would lead to e1 = e2 ). Statement 1
is also clear, since the distinctness of the k vertices v0 , v1 , . . . , vk−1 forces the 2-
element sets formed from these k vertices to also be distinct (and since the edges
{v0 , v1 } , {v1 , v2 } , . . . , {vk−1 , vk } = {vk−1 , v0 } are such 2-element sets).
For all other notions discussed above, it is even more obvious that there is no
ambiguity.
3.3.2. Degrees
In Definition 2.4.1, we defined the degree of a vertex v in a simple graph G =
(V, E) by
Proposition 2.4.2 (which says that if G is a simple graph with n vertices, then
any vertex v of G has degree deg v ∈ {0, 1, . . . , n − 1}) also no longer holds
for multigraphs, because you can have arbitrarily many edges in a multigraph
with just 1 or 2 vertices. (You can even have parallel loops!)
Is Proposition 2.4.3 true for multigraphs? Yes, because we have said that
loops should count twice in the definition of the degree. The proof needs some
tweaking, though. Let me give a slightly different proof; but first, let me state
the claim for multigraphs as a proposition of its own:
However,
since each edge e ∈ E is counted in exactly one addend of this sum. Similarly,
with the property that if e ∈ E, then the endpoints of β (e) are the im-
ages under α of the endpoints of e. (This property can also be restated
as a commutative diagram
β
E // F ,
ϕ ψ
P1,2 (V ) // P1,2 (W )
P ( α)
where P (α) is the map from P1,2 (V ) to P1,2 (W ) that sends each sub-
set {u, v} ∈ P1,2 (V ) to {α (u) , α (v)} ∈ P1,2 (W ). If you are used to
category theory, this restatement may look more natural to you.)
(a) We redefine the 2-nd cycle graph C2 to be the multigraph with two
vertices 1 and 2 and two parallel edges with endpoints 1 and 2. (We
don’t care what the edges are, only that there are two of them and each
1 2
has endpoints 1 and 2.) Thus, it looks as follows: .
(b) We define the 1-st cycle graph C1 to be the multigraph with one vertex
1 and one edge (which is necessarily a loop). Thus, it looks as follows:
1
.
This has the effect that the n-th cycle graph Cn has exactly n edges for each
n ≥ 1 (rather than having 1 edge for n = 2, as it did back when it was a simple
graph).
of G, where
With these definitions, we can now identify cycles in a multigraph with sub-
graphs isomorphic to a cycle graph: A cycle of length n in a multigraph G is
“the same as” a submultigraph of G isomorphic to Cn . (We leave the details to
the reader.)
3.3.7. Walks
We already defined walks, paths, closed walks and cycles for multigraphs back
in Section 3.1. The length of a walk is still defined to be its number of edges.
Now, let’s see which of their basic properties (seen in Section 2.9) still hold for
multigraphs.
First of all, the edges of a path are still always distinct. This is just as easy to
prove as for simple graphs.
Next, let us see how two walks can be “spliced” together:
(a0 , e1 , a1 , . . . , ek , ak , f 1 , b1 , f 2 , b2 , . . . , f ℓ , bℓ )
= (a0 , e1 , a1 , . . . , ak−1 , ek , b0 , f 1 , b1 , . . . , f ℓ , bℓ )
= (a0 , e1 , a1 , . . . , ak−1 , ek , v, f 1 , b1 , . . . , f ℓ , bℓ )
Walks that are not paths contain smaller walks between the same vertices:
3.3.8. Path-connectedness
The relation “path-connected” is defined for multigraphs just as it is for simple
graphs (Definition 2.9.8), and is still denoted ≃ G . It is still an equivalence
relation (and the proof is the same as for simple graphs). The following also
holds (with the same proof as for simple graphs):
An introduction to graph theory, version August 2, 2023 page 86
Proof. The proof of this proposition for multigraphs is more or less the same as
it was for simple graphs (i.e., as the proof of Proposition 2.10.4), with a mild
difference in how we prove that the walk wi , wi +1, . . . , w j is a cycle (of course,
this walk is no longer wi , wi +1, . . . , w j now, but rather wi , ei +1, wi +1, . . . , e j , w j ,
because the edges need to be included).17
The first of these claims follows from the minimality of j − i. The third follows from i < j.
It remains to prove the second claim. In other words, it remains to prove that the edges
ei+1, ei+2, . . . , e j are distinct, i.e., that we have e a 6= eb for any two integers a and b satisfying
An introduction to graph theory, version August 2, 2023 page 87
Proof. For simple graphs, this was proved as Theorem 2.10.7 above. The same
proof applies to multigraphs, once the obvious changes are made (e.g., instead
of p a−1 p a and qb−1 qb , we need to take the last edges of the two walks p and
q).
i < a < b ≤ j. Let us do this. Let a and b be two integers satisfying i < a < b ≤ j. We must
show that e a 6= eb . We distinguish two cases: the case a = b − 1 and the case a 6= b − 1.
• If a = b − 1, then e a and eb are two adjacent edges of w and thus distinct (since we
assumed that no two adjacent edges of w are identical). Thus, e a 6= eb is proved in
the case when a = b − 1.
• Now, consider the case when a 6= b − 1. In this case, we must have a < b − 1 (since
a < b entails a ≤ b − 1). Also, i ≤ a − 1 (since i < a). Hence, i ≤ a − 1 < a < b − 1 ≤
j − 1 (since b ≤ j). Therefore, b − 1, a − 1 and a are three distinct elements of the
set {i, i + 1, . . . , j − 1}. Consequently, wb−1, w a−1 , w a are three distinct vertices (since
the vertices wi , wi+1, . . . , w j−1 are distinct). Therefore, wb−1 ∈ / { w a −1 , w a } = ϕ ( e a )
(since w is a walk, so that the edge e a has endpoints w a−1 and w a ). However, ϕ (eb ) =
{ wb−1 , wb } (since w is a walk, so that the edge eb has endpoints wb−1 and wb ). Now,
comparing wb−1 ∈ {wb−1 , wb } = ϕ (eb ) with wb−1 ∈ / ϕ (e a ), we see that the sets ϕ (eb )
and ϕ (e a ) must be distinct (since ϕ (eb ) contains wb−1 but ϕ (e a ) does not). In other
words, ϕ (eb ) 6= ϕ (e a ). Hence, eb 6= e a . In other words, e a 6= eb . Thus, e a 6= eb is
proved in the case when a 6= b − 1.
We have now proved e a 6= eb in both cases, so we are done.
An introduction to graph theory, version August 2, 2023 page 88
3.3.12. Exercises
Exercise 3.1. Which of the Exercises 2.3, 2.4, 2.7, 2.14, 2.15, 2.5 and 2.8 remain
true if “simple graph” is replaced by “multigraph”?
(For each exercise that becomes false, provide a counterexample. For each
exercise that remains true, either provide a new solution that works for multi-
graphs, or argue that the solution we have seen applies verbatim to multi-
graphs, or derive the multigraph case from the simple graph case.)
Exercise 3.2. Let G be a multigraph with at least one edge. Assume that each
vertex of G has even degree. Prove that G has a cycle.
[Solution: This is Exercise 4 on midterm #1 from my Spring 2017 course;
see the course page for solutions.]
Exercise 3.4. Let G be a multigraph. Assume that G has exactly two vertices
of odd degree. Prove that these two vertices are path-connected.
deg (e/v)
qv = ∑ deg v
.
e∈ E;
v ∈ ϕ (e )
(Note that the denominator deg v on the right hand side is nonzero whenever
the sum is nonempty!)
(Thus, qv is the average degree of the neighbors of v, weighted with the
number of edges that join v to the respective neighbors. If v has no neighbors,
then qv = 0.)
Prove that
∑ qv ≥ ∑ deg v.
v ∈V v ∈V
(In other words, in a social network, your average friend has, on average,
more friends than you do!)
x y
[Hint: Any positive reals x and y satisfy + ≥ 2. Why, and how does
y x
this help?]
An introduction to graph theory, version August 2, 2023 page 90
1 b d g
c
5 4 h
f
[Hint: Feel free to restrict yourself to the case of a simple graph; in this
case, E and F are two subsets of P2 (V ), and you have to show that
This isn’t any easier than the general case, but saves you the hassle of
carrying the map ϕ around.]
(b) Give an example where the inequality (2) does not become an equality.
b
z
a
x
y
c
One possible decomposition of its edge set into disjoint friendly couples is
{a, y} , {b, z} , {c, x }.]
[Hint: Induct on | E| . Pick a vertex v of degree > 1 and consider the
components of G \ v.]
(a) Prove that there exists a multigraph G with vertex set {1, 2, . . . , n} such
that all i ∈ {1, 2, . . . , n} satisfy deg i = di .
(b) Prove that there exists a loopless multigraph G with vertex set
{1, 2, . . . , n} such that all i ∈ {1, 2, . . . , n} satisfy deg i = di if and only
if each i ∈ {1, 2, . . . , n} satisfies the inequality
∑ d j ≥ di . (3)
j∈{1,2,...,n };
j 6 =i
Exercise 3.10. Let G be a loopless multigraph. Recall that a trail (in G) means
a walk whose edges are distinct (but whose vertices are not necessarily dis-
tinct). Let u and v be two vertices of G. As usual, “trail from u to v” means
“trail that starts at u and ends at v”. Prove that
[Hint: Try to pair up the non-path trails into pairs. Make sure to prove that
this pairing is well-defined (i.e., each non-path trail t has exactly one partner,
which is not itself, and that t is the designated partner of its partner!).]
An introduction to graph theory, version August 2, 2023 page 93
Exercise 3.11. Let G be a multigraph such that every vertex of G has even
degree. Let u and v be two distinct vertices of G. Prove that the number of
paths from u to v is even.
[Hint: When you add an edge joining u to v, the graph G becomes a graph
with exactly two odd-degree vertices u and v, and the claim becomes “the
number of paths from u to v is odd” (why?). In this form, the claim turns
out to be easier to prove. Indeed, any path must start with some edge...
Keep in mind that paths can be replaced by trails, by Exercise 3.10.]
Unlike for Hamiltonian paths and cycles, an Eulerian walk or circuit is usu-
ally not a path or cycle. Also, finding an Eulerian walk in a multigraph G is not
the same as finding an Eulerian walk in the simple graph Gsimp . (Nevertheless,
An introduction to graph theory, version August 2, 2023 page 94
some authors call Eulerian walks “Eulerian paths” and call Eulerian circuits
“Eulerian cycles”. This is rather confusing.)
Example 3.4.2. Consider the following multigraphs:
e
2 3 a
a 1 2
A= 1 b d g
B= d b
c
5 4
f 4 3
c
3 3
c
c
b d
C= g 1 2 D= 1 2
a
a e
e
f
4 4
2 2
a a
e
b f b
E= 1 4 F= 1 4
c c
g
d d
3 3
g h
a
1 2
H= 1
G= d b
f e
4 3
c
• The multigraph E has no Eulerian walk. The reason is the same as for
D. Note that E is the famous multigraph of bridges in Königsberg, as
studied by Euler in 1736 (see the Wikipedia page for “Seven bridges of
Königsberg” for the backstory).
Remark 3.4.3. For the pedants: A multigraph can have an Eulerian circuit
even if it is not connected, as long as all its edges belong to the same compo-
nent (i.e., all but one components are just singletons with no edges). Here is
An introduction to graph theory, version August 2, 2023 page 96
an example:
a
1 2
5 d b 6
4 3
c
Exercise 3.13. Let n be a positive integer. Recall from Definition 2.6.1 (a) that
Kn denotes the complete graph on n vertices. This is the graph with vertex
set V = {1, 2, . . . , n} and edge set P2 (V ) (so each two distinct vertices are
adjacent).
Find Eulerian circuits for the graphs K3 , K5 , and K7 .
[Solution: This is Exercise 2 on homework set #2 from my Spring 2017
course; see the course page for solutions.]
(a) The multigraph G has an Eulerian circuit if and only if each vertex of
G has even degree.
(b) The multigraph G has an Eulerian walk if and only if all but at most
two vertices of G have even degree.
We already proved the “=⇒” directions of both parts (a) and (b) in Example
3.4.2. It remains to prove the “⇐=” directions. I don’t think that Euler actually
proved them in his 1736 paper, but Hierholzer did in 1873. The “standard”
proof can be found in many texts, such as [Guicha16, Theorem 5.2.2 and The-
orem 5.2.3]. I will sketch a different proof, which I learnt from [LeLeMe18,
Problem 12.35]. We begin with the following definition:
is to start with some trail, and make it progressively longer until it becomes
Eulerian (hopefully).
This suggests the following approach to proving the “⇐=” directions of The-
orem 3.4.4: We pick the longest trail of G and argue that (under the right
assumptions) it has to be Eulerian, since otherwise there would be a way to
make it longer. Of course, we need to find such a way. Here is the first step:
Lemma 3.4.6. Let G be a multigraph with at least one vertex. Then, G has a
longest trail.
Proof. Clearly, G has at least one trail (e.g., a length-0 trail from a vertex to
itself). Moreover, G has only finitely many trails (since each edge of G can only
be used once in a trail, and there are only finitely many edges). Hence, the
maximum principle proves the lemma.
Our goal now is to show that under appropriate conditions, such a longest
trail will be Eulerian. This will require two further lemmas.
First, one more piece of notation: We say that an edge e of a multigraph G
intersects a walk w if at least one endpoint of e is a vertex of w. Here is how
this can look like:
w w w w
w w w w
w w w w
Proof. We assumed that there exists an edge of G that is not an edge of w. Pick
such an edge, and call it f .
A “w- f -path” will mean a path from a vertex of w to an endpoint of f . Such
a path clearly exists, since G is connected. Thus, we can pick a shortest such
path. If this shortest path has length 0, then we are done (since f intersects w in
this case). If not, we consider the first edge of this path. This first edge cannot
be an edge of w, because otherwise we could remove it from the path and get
an even shorter w- f -path. But it clearly intersects w. So we have found an edge
of G that is not an edge of w but intersects w. This proves the lemma.
Lemma 3.4.8. Let G be a multigraph such that each vertex of G has even
degree. Let w be a longest trail of G. Then, w is a closed walk.
Proof. Assume the contrary. Let u be the starting point and v the ending point
of w. Since we assumed that w is not a closed walk, we thus have u 6= v.
Consider the edges of w that contain v. Such edges are of two kinds: those
by which w enters v (this means that v comes immediately after this edge in
w), and those by which w leaves v (this means that v comes immediately before
this edge in w). 18 Except for the very last edge of w, each edge of the former
kind is immediately followed by an edge of the latter kind; conversely, each
edge of the latter kind is immediately preceded by an edge of the former kind
(since w starts at the vertex u, which is distinct from v). Hence, the walk w has
exactly one more edge entering v than it has edges leaving v. Thus, the number
of edges of w that contain v (with loops counting twice) is odd. However, the
total number of edges of G that contain v (with loops counting twice) is even
(because it is the degree of v, but we assumed that each vertex of G has even
degree). So these two numbers are distinct. Thus, there is at least one edge of
G that contains v but is not an edge of w.
Fix such an edge and call it f . Now, append f to the trail w at the end. The
result will be a trail (since f is not an edge of w) that is longer than w. But this
contradicts the fact that w is a longest trail. Thus, the lemma is proved.
We can now finish the proof of the Euler–Hierholzer theorem:
Proof of Theorem 3.4.4. (a) =⇒: We proved this back in Example 3.4.2.
⇐=: Assume that each vertex of G has even degree.
By Lemma 3.4.6, we know that G has a longest trail. Fix such a longest trail,
and call it w. Then, Lemma 3.4.8 shows that w is a closed walk.
We claim that w is Eulerian. Indeed, assume the contrary. Then, there exists
an edge of G that is not an edge of w. Hence, Lemma 3.4.7 shows that there
exists an edge of G that is not an edge of w but intersects w. Fix such an edge,
and call it f .
Since f intersects w, there exists an endpoint v of f that is a vertex of w.
Consider this v. Since w is a closed trail, we can WLOG assume that w starts
and ends at v (since we can otherwise achieve this by rotating19 w). Then, we
can append the edge f to the trail w. This results in a new trail (since f is not
an edge of w) that is longer than w. And this contradicts the fact that w is a
longest trail of G.
This contradiction proves that w is Eulerian. Hence, w is an Eulerian circuit
(since w is a closed walk). Thus, the “⇐=” direction of Theorem 3.4.4 (a) is
proven.
(b) =⇒: Already proved in Example 3.4.2.
⇐=: Assume that all but at most two vertices of G have even degree. We
must prove that G has an Eulerian walk.
If each vertex of G has even degree, then this follows from Theorem 3.4.4 (a),
since every Eulerian circuit is an Eulerian walk. Thus, we WLOG assume that
not each vertex of G has even degree. In other words, the number of vertices of
G having odd degree is positive.
The handshake lemma for multigraphs (i.e., Corollary 3.3.3) shows that the
number of vertices of G having odd degree is even. Furthermore, this number
is at most 2 (since all but at most two vertices of G have even degree). So this
number is even, positive and at most 2. Thus, this number is 2. In other words,
the multigraph G has exactly two vertices having odd degree. Let u and v be
these two vertices.
Add a new edge e that has endpoints u and v to the multigraph G (do this
even if there already is such an edge!20 ). Let G ′ denote the resulting multi-
graph. Then, in G ′ , each vertex has even degree (since the newly added edge
e has increased the degrees of u and v by 1, thus turning them from odd to
even). Moreover, G ′ is still connected (since G was connected, and the newly
added edge e can hardly take that away). Thus, we can apply Theorem 3.4.4
(a) to G ′ instead of G. As a result, we conclude that G ′ has an Eulerian circuit.
Cutting the newly added edge e out of this Eulerian circuit21 , we obtain an Eu-
19 Rotating a closed walk (w0 , e1 , w1 , e2 , w2 , . . . , ek , wk ) means moving its first vertex and its first
edge to the end, i.e., replacing the walk by (w1 , e2 , w2 , e3 , w3 , . . . , ek , wk , e1 , w1 ). This always
results in a closed walk again. For example, if (1, a, 2, b, 3, c, 1) is a closed walk, then we can
rotate it to obtain (2, b, 3, c, 1, a, 2); then, rotating it one more time, we obtain (3, c, 1, a, 2, b, 3).
Clearly, by rotating a closed walk several times, we can make it start at any of its vertices.
Moreover, if we rotate a closed trail, then we obtain a closed trail.
20 This is a time to be grateful for the notion of a multigraph. We could not do this with simple
graphs!
21 More precisely: We rotate this circuit until e becomes its last edge, and then we remove this
lerian walk of G. Hence, G has an Eulerian walk. Thus, the “⇐=” direction of
Theorem 3.4.4 (b) is proven.
Note: If you look closely at the above proof, you will see hidden in it an
algorithm for finding Eulerian circuits and walks.22
G L (G)
b
b
2 3
.
c a
a c
d
1 4 d
Definition 4.1.1. A simple digraph is a pair (V, A), where V is a finite set,
and where A is a subset of V × V.
(e) An arc (u, v) is called a loop (or self-loop) if u = v. (In other words, an
arc is a loop if and only if its source is its target.)
A = {(i, j) ∈ V × V | i divides j} .
3 2
4 1
5 6
. (4)
Note that simple digraphs (unlike simple graphs) are allowed to have loops
(i.e., arcs of the form (v, v)).
Definition 4.1.4. A multidigraph is a triple (V, A, ψ), where V and A are
two finite sets, and ψ : A → V × V is a map.
(c) If a is an arc of D, and if ψ ( a) = (u, v), then the vertex u is called the
source of a, and the vertex v is called the target of a.
a 2 3
e
D= 1 b d g
c
5 4
f
. (5)
The word “digraph” was originally a shorthand for “directed graph”, but
by now it is a technical term that is perfectly understood by everyone in the
subject. (It is also understood by linguists, but in a rather different way.)
Definition 4.2.1. Let D be a digraph with vertex set V. (This can be either a
simple digraph or a multidigraph.) Let v ∈ V be any vertex. Then:
Recall Euler’s result (Proposition 3.3.2) saying that in a graph, the sum of all
degrees is twice the number of edges. Here is an analogue of this result for
digraphs:
Proposition 4.2.3 (diEuler). Let D be a digraph with vertex set V and arc set
A. Then,
∑ deg+ v = ∑ deg− v = | A| .
v ∈V v ∈V
4.3. Subdigraphs
Just as we defined subgraphs of a multigraph, we can define subdigraphs (or
“submultidigraphs”, to be very precise) of a digraph:
of D, where
In other words, it denotes the subdigraph of D whose vertices are the el-
ements of S, and whose arcs are precisely those arcs of D whose sources
and targets both belong to S. We denote this induced subdigraph by
D [ S] .
4.4. Conversions
4.4.1. Multidigraphs to multigraphs
Any multidigraph D can be turned into an (undirected) graph G by “removing
the arrowheads” (aka “forgetting the directions of the arcs”):
Definition 4.4.1. Let D be a multidigraph. Then, Dund will denote the multi-
graph obtained from D by replacing each arc with an edge whose endpoints
are the source and the target of this arc. Formally, this is defined as follows:
If D = (V, A, ψ), then Dund = (V, A, ϕ), where the map ϕ : A → P1,2 (V )
sends each arc a ∈ A to the set of the entries of ψ ( a) (that is, to the set
consisting of the source of a and the target of a).
For example, if D is the multidigraph from (5), then Dund is the following
An introduction to graph theory, version August 2, 2023 page 106
multigraph:
h
a 2 3
e
Dund = 1 b d g
c
5 4
f
.
Note that the map ψ depends on our choice of se ’s (that is, it depends on
which endpoint of an edge e we choose to be se ). This makes the definition of
Gbidir non-canonical; I don’t know if there is a good way to fix this. Fortunately,
all choices of se ’s will lead to mutually isomorphic multidigraphs Gbidir . (The
notion of isomorphism for multidigraphs is exactly the one that you expect.)
Example 4.4.3. If
3
a
G= g 1 2
c
b
4
,
An introduction to graph theory, version August 2, 2023 page 107
then
3
( a, 1)
( g, 1)
(c, 2)
( a, 2)
Gbidir = 1 2
(b, 1)
(c, 1)
( g, 2)
(b, 2)
4
.
(Here, for example, we have chosen s a to be 2, so that ta = 3 and ψ ( a, 1) =
(2, 3) and ψ ( a, 2) = (3, 2).) Yes, even the loops of G are duplicated in Gbidir !
(V, A, ι) ,
Example 4.4.5. If
D= 1 3 4
,
An introduction to graph theory, version August 2, 2023 page 108
then
2
(1, 2) (2, 3)
(3, 4)
Dmult = 1 3 4
(1, 3)
.
(V, {ψ ( a) | a ∈ A}) .
In other words, it is the simple digraph with vertex set V in which there is an
arc from u to v if there exists an arc from u to v in D. Thus, Dsimp is obtained
from D by “collapsing” parallel arcs (i.e., arcs having the same source and
the same target) to a single arc.
Example 4.4.7. If
2
a b
e
D= 1 c 3 4
g
f
d ,
then
Dsimp = 1 3 4
.
23 I will use a notation that I probably should have introduced before: If u and v are two vertices
of a digraph, then an “arc from u to v” means an arc with source u and target v.
An introduction to graph theory, version August 2, 2023 page 109
Note that the arcs c and d have not been “collapsed” into one arc, since they
do not have the same source and the same target. Likewise, the loop g has
been preserved (unlike for undirected graphs).
Since all three of these operations are injective (i.e., lose no information), we
thus can encode each of our four notions of graphs as a multidigraph. Con-
sequently, any theorem about multidigraphs can be specialized to the other
three types of graphs. This doesn’t mean that any theorem on any other type
of graphs can be generalized to multidigraphs, though (e.g., Mantel’s theorem
holds only for simple graphs) – but when it can, we will try to state it at the
most general level possible, to avoid doing the same work twice.
(c) A path (in D) means a walk (in D) whose vertices are distinct. In other
words, a path means a walk (v0 , v1 , . . . , vk ) such that v0 , v1 , . . . , vk are
distinct.
(d) Let p and q be two vertices of D. A walk from p to q means a walk that
starts at p and ends at q. A path from p to q means a path that starts at
p and ends at q.
(e) A closed walk of D means a walk whose first vertex is identical with
its last vertex. In other words, it means a walk (w0 , w1 , . . . , wk ) with
w0 = wk . Sometimes, closed walks are also known as circuits (but
many authors use this latter word for something slightly different).
D= 1 3 4
.
Then, (1, 2, 3, 4) and (1, 3, 4) are two walks of D, and these walks are paths.
But (2, 3, 1) is not a walk (since you cannot use the arc 13 to get from 3 to 1).
This digraph D has no cycles, and its only closed walks have length 0.
An introduction to graph theory, version August 2, 2023 page 111
D= 1 3 4
.
( v 0 , a1 , v 1 , a2 , v 2 , . . . , a k , v k ) (with k ≥ 0) ,
ψ ( ai ) = ( v i − 1 , v i )
(that is, each arc ai has source vi −1 and target vi ). Note that we have
to record both the vertices and the arcs in our walk, since we want the
walk to “know” which arcs it traverses.
The vertices of a walk (v0 , a1 , v1 , a2 , v2 , . . . , ak , vk ) are v0 , v1 , . . . , vk ; the
arcs of this walk are a1 , a2 , . . . , ak . This walk is said to start at v0 and
end at vk ; it is also said to be a walk from v0 to vk . Its starting point is
v0 , and its ending point is vk . Its length is k.
2
a b
e
D= 1 c 3 4
g
f
d .
(a0 , e1 , a1 , . . . , ek , ak , f 1 , b1 , f 2 , b2 , . . . , f ℓ , bℓ )
= (a0 , e1 , a1 , . . . , ak−1 , ek , b0 , f 1 , b1 , . . . , f ℓ , bℓ )
= (a0 , e1 , a1 , . . . , ak−1 , ek , v, f 1 , b1 , . . . , f ℓ , bℓ )
Proof. The same (trivial) argument as for undirected graphs works here.
However, unlike for undirected graphs, we can no longer reverse walks or
paths in digraphs. Thus, it often happens that there is a walk from u to v, but
no walk from v to u.
Reducing a walk to a path (as we did in Proposition 2.9.5 for simple graphs
and in Proposition 3.3.9 for multigraphs) still works for multidigraphs:
4.5.3. Exercises
Exercise 4.1. Let D be a multidigraph with at least one vertex. Prove the
following:
ai , ai + ai + 1 , ai + ai + 1 + ai + 2 , . . . , ai + ai + 1 + · · · + ai + p − 1
Exercise 4.4. Let D be a simple digraph with n vertices and a arcs. Assume
that D has no loops, and that we have a > n2 /2. Prove the following:
(b) If D has only one toposort, then this toposort is a Hamiltonian path of
D.
Here, a Hamiltonian path in D means a walk of D that contains each
vertex of D exactly once.
An introduction to graph theory, version August 2, 2023 page 115
3 2
Exercise 4.6. Let n be a positive integer. Let D be a digraph that has no cycles
of length ≤ 2. Assume that D has at least 2n−1 vertices. Prove that D has an
induced subdigraph that has n vertices and has no cycles.
24 This is short for “topological sorting”. I don’t know where this name comes from.
An introduction to graph theory, version August 2, 2023 page 116
2
a b
e
D= 1 c 3 4
g
f
d
andthus Theorem 4.5.10 yields (among other things) that the (1, 3)-rd entry
Ck 1,3 of its k-th power Ck equals the number of all walks of D having
starting point 1, ending point 3 and length k.
The adjacency matrix of a multidigraph D determines D up to the iden-
tities of the arcs, and thus is often used as a convenient way to encode a
multidigraph.
Proof of Theorem 4.5.10. Forget that we fixed i, j and k. We want to prove the
following claim:
Before we prove this claim, let us recall that C is the adjacency matrix of D.
Thus, for each i ∈ V and j ∈ V, we have
(by the definition of the adjacency matrix). In other words, for each i ∈ V and
j ∈ V, we have
Ci,j = (the number of arcs from i to j) ,
where we agree that an “arc from i to j” means an arc a ∈ A with source i and
target j.
Renaming i as w in this statement, we obtain the following: For each w ∈ V
and j ∈ V, we have
for any i ∈ V and j ∈ V. (Indeed, this is just the rule for how matrices are
multiplied.)
We can now prove Claim 1:
[Proof of Claim 1: We shall prove Claim 1 by induction on k:
Induction base: We shall first prove Claim 1 for k = 0.
Indeed, let i ∈ V and j ∈ V. The 0-th power of any n × n-matrix is defined to
be the n × n identity matrix In ; thus, C0 = In . Hence,
(
1, if i = j;
C0 = ( In )i,j = (8)
i,j 0, if i 6= j
Now, forget that we fixed i and j. We thus have proven (9) for any i ∈ V and
j ∈ V. In other words, Claim 1 holds for k = 0. Thus, the induction base is
complete.
Induction step: Let g be a positive integer. Assume that Claim 1 holds for
k = g − 1. We must show that Claim 1 holds for k = g as well.
We have assumed that Claim 1 holds for k = g − 1. In other words, for any
i ∈ V and j ∈ V, we have
C g−1 = (the number of walks from i to j that have length g − 1) .
i,j
• First, we choose a vertex w of D to serve as the vertex v g−1 (that is, as the
penultimate vertex of the walk w). This vertex w must belong to V.
• Now, we choose the vertices v0 , v1 , . . . , v g−1 (that is, all vertices of our
walk except for the last one) and the arcs a1 , a2 , . . . , a g−1 (that is, all arcs
of our walk except for the last one) in such a way that v g−1 = w. This is
tantamount to choosing a walk v0 , a1 , v1 , a2 , v2 , . . . , a g−1 , v g−1 from i to
w that has length g − 1. This choice can be made in C g−1 i,w many ways
(because (10) shows
that the number of walks from i to w that have length
g − 1 is C g − 1 ).
i,w
• We have now determined all but the last vertex and all but the last arc of
our walk w. We set the last vertex v g of our walk to be j. (This is the only
possible option, since our walk w has to be a walk from i to j.)
• We choose the last arc a g of our walk w. This arc a g must have source v g−1
and target v g ; in other words, it must have source w and target j (since
v g−1 = w and v g = j). In other words, it must be an arc from w to j. Thus,
it can be chosen in Cw,j many ways (because (6) shows that the number of
arcs from w to j is Cw,j ).
we obtain
Now, forget that we fixed i and j. We thus have proven (11) for any i ∈ V
and j ∈ V. In other words, Claim 1 holds for k = g. Thus, the induction step is
complete. Hence, Claim 1 is proven by induction.]
Theorem 4.5.10 follows immediately from Claim 1.
E= 2 3
2 5 7
D= 3
1 4 6
.
25 Someauthors use the word “diconnected” for “strongly connected”. As this word is just a
single letter away from “disconnected”, I cannot recommend it.
An introduction to graph theory, version August 2, 2023 page 121
Example 4.6.9. The digraph from Example 4.5.2 is weakly connected, but not
at all strongly connected (indeed, each of its strong components has size 1).
The digraph from Example 4.5.3, on the other hand, is strongly connected.
(a) The walks of G are “more or less the same as” the walks of the multi-
digraph Gbidir . More precisely, each walk of G gives rise to a walk of
Gbidir (with the same starting point and the same ending point), and
conversely, each walk of Gbidir gives rise to a walk of G. If G has no
loops, then this is a one-to-one correspondence (i.e., a bijection) be-
tween the walks of G and the walks of Gbidir .
(b) The paths of G are “more or less the same as” the paths of the multi-
digraph Gbidir . This is always a one-to-one correspondence, since paths
cannot contain loops.
(c) The closed walks of G are “more or less the same as” the closed walks
of the multidigraph Gbidir .
(d) The cycles of G are not quite the same as the cycles of Gbidir . In fact, if e
is an edge of G with two distinct endpoints u and v, then (u, e, v, e, u) is
An introduction to graph theory, version August 2, 2023 page 122
not a cycle of G, but either (u, (e, 1) , v, (e, 2) , u) or (u, (e, 2) , v, (e, 1) , u)
is a cycle of Gbidir (this is best seen on a picture: G has the edge
(e, 1)
u v
e
u v (e, 2)
whereas Gbidir has the arc-pair ), so Gbidir
usually has more cycles than G has. But it is true that each cycle of G
gives rise to a cycle of Gbidir .
[Note: Keep in mind that the multidigraph with 0 vertices does not count
as strongly connected.]
[Solution: This is a generalization of Exercise 7 on midterm #2 from my
Spring 2017 course; see the course page for solutions.]
(a) The multidigraph D has an Eulerian circuit if and only if each vertex v
of D satisfies deg+ v = deg− v.
(b) The multidigraph D has an Eulerian walk if and only if all but two
vertices v of D satisfy deg+ v = deg− v, and the remaining two vertices
v satisfy deg+ v − deg− v ≤ 1.
Proof. The definition of Gbidir yields that each vertex v of Gbidir satisfies deg+ v =
deg v and deg− v = deg v, where deg v denotes the degree of v as a vertex of
G. Hence, each vertex v of Gbidir satisfies deg+ v = deg v = deg− v. In other
words, Gbidir is balanced.
Combining this proposition with Theorem 4.7.2 (a), we can obtain a curious
fact about undirected(!) multigraphs:
Proof. The multidigraph Gbidir is balanced (by Proposition 4.7.4) and weakly
connected (this follows easily from the connectedness of G). Hence, Theorem
4.7.2 (a) can be applied to D = Gbidir . Thus, Gbidir has an Eulerian circuit.
Reinterpreting this circuit as a circuit of G, we obtain a circuit of G that con-
tains each edge exactly twice, and uses it once in each direction. This proves
Theorem 4.7.5.
We might wonder what can be said about hamps and hamcs for digraphs. Is
there an analogue of Ore’s theorem? The answer is “yes”, but it is significantly
harder to prove:
Arev = {( j, i ) | (i, j) ∈ A} .
Thus, Drev is the digraph obtained from D by reversing each arc (i.e.,
swapping its source and its target). This is called the reversal of D.
(d) We define D as the simple digraph (V, (V × V ) \ A). This is the di-
graph that has the same vertices as D, but whose arcs are precisely the
non-arcs of D. This digraph D is called the complement of D.
3 4
D= .
Then,
1 2 1 2
3 4 3 4
Drev = and D= .
Convention 4.9.3. In the following, the symbol # means “number”. For ex-
ample,
(# of subsets of {1, 2, 3}) = 8.
and where
A = {(i, j) | i < j} .
Then, (# of hamps of D ) = 1.
Proof. The hamps of Drev are obtained from the hamps of D by walking back-
wards.
So far, so boring. What about this:
1 2 3
D= .
This digraph has 3 hamps: (1, 2, 3) and (2, 3, 1) and (3, 1, 2).
Its complement D looks as follows:
1 2 3
D= .
Proof of Theorem 4.9.6. (This is an outline; see [17s-lec7, proof of Theorem 1.3.6]
for more details.)
Write the simple digraph D as D = (V, A), and assume WLOG that V 6= ∅.
Set n = |V |.
A V-listing will mean a list of elements of V that contains each element of
V exactly once. (Thus, each V-listing is an n-tuple, and there are n! many V-
listings.) Note that a V-listing is the same as a hamp of the “complete” digraph
(V, V × V ). Any hamp of D or of D is therefore a V-listing, but not every
V-listing is a hamp of D or D.
If σ = (σ1 , σ2 , . . . , σn ) is a V-listing, then we define a set
We call this set P (σ) the arc set of σ. When we regard σ as a hamp of
(V, V × V ), this set P (σ) is just the set of all arcs of σ. Note that this is an
(n − 1)-element set. We make a few easy observations (prove them!):
Now, let N be the # of pairs (σ, B), where σ is a V-listing and B is a subset of
A satisfying B ⊆ P (σ). Thus,
N= ∑ Nσ ,
σ is a V-listing
where
Nσ = (# of subsets B of A satisfying B ⊆ P (σ)) .
But we also have
N= ∑ NB,
B is a subset of A
where
N B = (# of V-listings σ satisfying B ⊆ P (σ)) .
Let us now relate these two sums to hamps. We begin with ∑ Nσ .
σ is a V-listing
We shall use the Iverson bracket notation: i.e., the notation [A] for the truth
value of a statement A. This truth value is defined to be the number 1 if A is
true, and 0 if A is false. For instance,
[ 2 + 2 = 4] = 1 and [2 + 2 = 5] = 0.
An introduction to graph theory, version August 2, 2023 page 128
where
N B = (# of V-listings σ satisfying B ⊆ P (σ)) .
We want to prove that this sum equals (# of hamps of D ), at least modulo 2.
So let B be a subset of A. We want to know N B mod 2. In other words, we
want to know when N B is odd.
Let us first assume that N B is odd, and see what follows from this.
Since N B is odd, we have N B > 0. Thus, there exists at least one V-listing σ
satisfying B ⊆ P (σ). We shall now draw some conclusions from this.
First, a definition: A path cover of V means a set of paths in the “complete”
digraph (V, V × V ) such that each vertex v ∈ V is contained in exactly one of
these paths. The set of arcs of such a path cover is simply the set of all arcs of
all its paths. For example, if V = {1, 2, 3, 4, 5, 6, 7}, then
{(1, 3, 5) , (2) , (6) , (7, 4)}
An introduction to graph theory, version August 2, 2023 page 129
However,
h i
B B
N ≡ N is odd (since m ≡ [m is odd] mod 2 for any m ∈ Z)
= [ B = P (σ) for some hamp σ of D ] mod 2.
An introduction to graph theory, version August 2, 2023 page 130
N= ∑ NB
|{z}
B is a subset of A ≡[ B = P (σ) for some hamp σ of D ] mod 2
4.10. Tournaments
4.10.1. Definition
We now introduce a special class of simple digraphs.
3
.
An introduction to graph theory, version August 2, 2023 page 131
3
.
3
,
3
,
5
.
A tournament can also be viewed as a complete graph, whose each edge has
been given a direction.
Using Definition 4.9.1, we can restate the definition of a tournament as fol-
lows:
27 Here we agree to consider the empty list () to be a hamp of the digraph (∅, ∅).
An introduction to graph theory, version August 2, 2023 page 133
Theorem 4.10.6 (Easy Rédei theorem). A tournament always has at least one
hamp.
(# of hamps of D ) is odd.
Our goal now is to prove these two theorems. Clearly, the Easy Rédei Theo-
rem follows from the Hard one, since an odd number cannot be 0. Thus, it will
suffice to prove the Hard one.
The proof of the hard Rédei theorem will rely on the following crucial lemma:
D: v w D′ : v w
; .
(Here, we are only showing the arcs joining v with w, since D and D ′ agree in
all other arcs.)
Proof of Lemma 4.10.8. (This is an outline; see [17s-lec7, proof of Lemma 1.6.2]
for more details.)
First of all, D ′ is clearly a tournament. It remains to prove the congruence.
We introduce two more digraphs: Let
Note that these are not tournaments any more. Here is a comparative illustra-
tion of all four digraphs D, D ′ , D0 and D2 (again showing only the arcs joining
v with w, since there are no differences in the other arcs):
D: v w D′ : v w
; ;
D0 : v w D2 : v w
; .
(# of hamps of D0 )
= # of hamps of D ′ that do not use the arc wv
= # of hamps of D ′ − # of hamps of D ′ that use the arc wv .
(# of hamps of D )
= (# of hamps of D2 ) − (# of hamps of D2 that use the arc wv)
= (# of hamps of D2 ) − # of hamps of D ′ that use the arc wv
(the last equality is because a hamp of D2 that uses the arc wv cannot use the
arc vw, and therefore is automatically a hamp of D ′ as well, and of course the
converse is obviously true).
However, from the previously proved equality
(# of hamps of D0 )
= # of hamps of D ′ − # of hamps of D ′ that use the arc wv ,
we obtain
# of hamps of D ′
= (# of hamps of D0 ) + # of hamps of D ′ that use the arc wv
≡ (# of hamps of D0 ) − # of hamps of D ′ that use the arc wv mod 2
An introduction to graph theory, version August 2, 2023 page 135
(since x + y ≡ x − y mod 2 for any integers x and y). Thus, if we can show that
(# of hamps of D )
= (# of hamps of D2 ) − # of hamps of D ′ that use the arc wv
| {z }
≡(# of hamps of D0 ) mod 2
≡ (# of hamps of D0 ) − # of hamps of D ′ that use the arc wv
≡ # of hamps of D ′ mod 2,
(by Theorem 4.9.6). As explained above, this completes the proof of Lemma
4.10.8.
Now, the Hard Rédei theorem has become easy:
Proof of Theorem 4.10.7. (This is an outline; see [17s-lec7, proof of Theorem 1.6.1]
for more details.)
We need to prove that the # of hamps of D is odd. Lemma 4.10.8 tells us that
the parity of this # does not change when we reverse a single arc of D. Thus, of
course, if we reverse several arcs of D, then this parity does not change either.
However, we can WLOG assume that the vertices of D are 1, 2, . . . , n for some
n ∈ N, and then, by reversing the appropriate arcs, we can ensure that the arcs
of D are
(i.e., each arc of D has the form ij with i < j). But at this point, the tournament
D has only one hamp: namely, (1, 2, . . . , n). So (# of hamps of D ) = 1 is odd
at this point. Since the parity of the # of hamps of D has not changed as we
reversed our arcs, we thus conclude that it has always been odd. This proves
the Hard Rédei theorem (Theorem 4.10.7).
As we already mentioned, the Easy Rédei theorem follows from the Hard
Rédei theorem. But it also has a short self-contained proof ([17s-lec7, Theorem
1.4.9]).
In general, this is only a necessary criterion for a hamc, not a sufficient one.
Not every strongly connected digraph has a hamc. However, it turns out that
for tournaments, it is also sufficient, as long as the tournament has enough
vertices:
Proof sketch. A detailed proof can be found in [17s-lec7, Theorem 1.5.5]; here is
just a very rough sketch.
Let D = (V, A) be a strongly connected tournament with at least two ver-
tices.29 We must show that D has a hamc.
It is easy to see that D has a cycle. Let c = (v1 , v2 , . . . , vk , v1 ) be a cycle of
maximum length. We shall show that c is a hamc.
Let C be the set {v1 , v2 , . . . , vk } of all vertices of this cycle c.
A vertex w ∈ V \ C will be called a to-vertex if there exists an arc from some
vi to w.
28 Recallthat “hamc” is our shorthand for “Hamiltonian cycle”.
29 Bythe way, a tournament with exactly two vertices cannot be strongly connected (as it has
only 1 arc). Thus, by requiring D to have at least two vertices, we have actually guaranteed
that D has at least three vertices.
An introduction to graph theory, version August 2, 2023 page 137
• If a to-vertex w has an arc from some vi , then it must also have an arc
from vi +1 30 (because otherwise there would be an arc from w to vi +1 ,
and then we could make our cycle c longer by interjecting w between vi
and vi +1 ; but this would contradict the fact that c is a cycle of maximum
length).
• Iterating this argument, we see that if a to-vertex w has an arc from some
vi , then it must also have an arc from vi +1 , an arc from vi +2 , an arc from
vi +3 , and so on; i.e., it must have an arc from each vertex of c. Conse-
quently, w cannot be a from-vertex. This shows that a to-vertex cannot be
a from-vertex.
Let F be the set of all from-vertices, and let T be the set of all to-vertices.
Then, as we have just shown, F and T are disjoint. Moreover, F ∪ T = V \ C.
Since a to-vertex cannot be a from-vertex, we furthermore conclude that any to-
vertex has an arc from each vertex of c (otherwise, it would be a from-vertex),
and that any from-vertex has an arc to each vertex of c (otherwise, it would be
a to-vertex).
Next, we argue that there cannot be an arc from a to-vertex t to a from-vertex
f . Indeed, if there was such an arc, then we could make the cycle c longer by
interjecting t and f between (say) v1 and v2 .
In total, we now know that every vertex of D belongs to one of the three
disjoint sets C, F and T, and furthermore there is no arc from T to F, no arc
from T to C, and no arc from C to F. Thus, there exists no walk from a vertex
in T to a vertex in C (because there is no way out of T). This would contradict
the fact that D is strongly connected, unless the set T is empty. Hence, T must
be empty. Similarly, F must be empty. Since F ∪ T = V \ C, this entails that
V \ C is empty, so that V = C. In other words, each vertex of D is on our cycle
c. Therefore, c is a hamc. This proves Camion’s theorem.
There are many simple proofs of this theorem (e.g., a few on its ProofWiki
page, which works with the transpose matrix). I will now outline a combina-
torial one, using tournaments. This proof goes back to Ira Gessel’s 1979 paper
[Gessel79].
First, how do det V and ∏ xi − x j relate to tournaments?
1≤ i < j ≤ n
As a warmup, let’s assume that we have some number y(i,j) given for each
pair (i, j) of integers, and let’s expand the product
y(1,2) + y(2,1) y(1,3) + y(3,1) y(2,3) + y(3,2) .
The result is a sum of 8 products, one for each way to pluck an addend out of
each of the three little sums:
y(1,2) + y(2,1) y(1,3) + y(3,1) y(2,3) + y(3,2)
= y(1,2) y(1,3) y(2,3) + y(1,2) y(1,3) y(3,2) + y(1,2) y(3,1) y(2,3) + y(1,2) y(3,1) y(3,2)
+ y(2,1) y(1,3) y(2,3) + y(2,1) y(1,3) y(3,2) + y(2,1) y(3,1) y(2,3) + y(2,1) y(3,1) y(3,2) .
Note that each of the 8 products obtained has the form y a yb yc , where
We can view these pairs a, b and c as the arcs of a tournament with vertex
set {1, 2, 3}. Thus, our above expansion can be rewritten more compactly as
An introduction to graph theory, version August 2, 2023 page 139
follows:
y(1,2) + y(2,1) y(1,3) + y(3,1) y(2,3) + y(3,2)
= ∑ ∏ y(i,j).
D is a tournament (i,j) is an arc of D
with vertex set {1,2,3}
For reference, here are all the 8 tournaments with vertex set {1, 2, 3}:
1 1 1
2 3 2 3 2 3
1 1 1
2 3 2 3 2 3
1 1
2 3 2 3
Here, for convenience, we are drawing an arc ij in blue if i < j and in red
otherwise.
This expansion can be generalized: We have
∏ y (i,j) + y ( j,i ) = ∑ ∏ y(i,j) .
1≤ i < j ≤ n D is a tournament (i,j) is an arc of D
with vertex set {1,2,...,n }
An introduction to graph theory, version August 2, 2023 page 140
(
xj, if i < j;
Substituting y(i,j) = in this equality, we obtain
− x j , if i ≥ j
(
xj, if i < j;
∏ x j − xi = ∑ ∏ − x j , if i ≥ j
1≤ i < j ≤ n D is a tournament (i,j) is an arc of D
with vertex set {1,2,...,n } | {z }
n deg− j
=(−1)(# of red arcs of D) ∏ x j
j =1
(where deg− j means the indegree of j in D,
and where the “red arcs” are the arcs ij with i > j)
n
(# of red arcs of D ) deg− j
= ∑ (−1) xj ∏ .
D is a tournament j =1
with vertex set {1,2,...,n }
(by the definition of a determinant). We shall refer to this sum as the “small
sum”.
Our goal is to prove that the big sum equals the small sum. To prove this, we
must verify the following:
1. Each addend of the small sum is an addend of the big sum. Indeed, for
each permutation σ ∈ Sn , there is a certain tournament Tσ that has
n n
deg− j σ( j)−1
(−1)(# of red arcs of Tσ ) ∏ x j = sign σ · ∏ x j .
j =1 j =1
2. All the addends of the big sum that are not addends of the small sum
cancel each other out. Why?
The basic idea is to argue that if a tournament D appears in the big sum
but not in the small sum, then D has a 3-cycle (i.e., a cycle of length
3). When we reverse such a 3-cycle (i.e., we reverse each of its arcs), the
indegrees of all vertices are preserved, but the sign (−1)(# of red arcs of D) is
flipped (since three arcs change their orientation).
This suffices to show that for each addend that appears in the big sum but
not in the small sum, there is another addend with the same magnitude
but with opposite sign. Unfortunately, this in itself does not suffice to
An introduction to graph theory, version August 2, 2023 page 141
ensure that all these addends cancel out; for example, the sum 1 + 1 + 1 +
(−1) has the same property but does not equal 0. We need to show that
the # of addends with positive sign (i.e., with (−1)(# of red arcs of D) = 1)
and a given magnitude equals the # of addends with negative sign (i.e.,
with (−1)(# of red arcs of D) = −1) and the same magnitude.
One way to achieve this would be by constructing a bijection (aka “perfect
matching”) between the “positive” and the “negative” addends. This is
tricky here: We would have to decide which 3-cycle to reverse (as there
are usually many of them), and this has to be done in a bijective way
(so that two “positive” addends don’t get assigned the same “negative”
partner).
A less direct, but easier way is the following: Fix a positive integer k,
and consider only the tournaments with exactly k many 3-cycles. For
each such tournament, we can reverse any of its k many 3-cycles. It can
be shown (nice exercise!) that reversing the arcs of a 3-cycle does not
change the # of all 3-cycles; thus, we don’t accidentally change our k in the
process. Thus, we find a “k-to-k” correspondence between the “positive”
addends of a given magnitude and the “negative” addends of the same
magnitude. As one can easily see, this entails that the former and the
latter are equinumerous, and thus really cancel out. The addends that
remain are exactly those in the small sum.
As already mentioned, this is only a rough summary of the proof; the details
can be found in [17s-lec8].
For example, the tournament shown in Example 4.10.4 has the nine different
3-cycles
(1, 4, 3) , (1, 5, 3) , (2, 5, 3) , (3, 1, 4) ,
(3, 1, 5) , (3, 2, 5) , (4, 3, 1) , (5, 3, 1) ,
(5, 3, 2) .
(Yes, we are counting a 3-cycle (u, v, w) as being distinct from (v, w, u) and
(w, u, v).)
An introduction to graph theory, version August 2, 2023 page 142
Proof. We have already proved this for simple graphs (in Proposition 2.10.4).
More or less the same argument works for multigraphs. (“More or less” be-
cause the definition of a cycle in a multigraph is slightly different from that in
a simple graph; but the proof is easy to adapt.)
Proof. We have already proved this for simple graphs (Claim 1 in the proof of
Theorem 2.10.7). More or less the same argument works for multigraphs.
An introduction to graph theory, version August 2, 2023 page 144
Proof. Part (a) follows from Theorem 3.3.18 (a). Part (b) follows from Theorem
3.3.18 (b). Part (c) follows by combining parts (a) and (b).
conn ( G \ e) ≥ |V | − | E \ { e}|
An introduction to graph theory, version August 2, 2023 page 145
(since G \ e is a multigraph with vertex set V and edge set E \ { e}). However,
Corollary 5.1.5 (c) yields conn ( G \ e) ≤ conn G + 1. Thus,
conn G ≥ conn ( G \ e) −1 ≥ |V | − | E \ { e}| −1 = |V | − (| E| − 1) − 1 = |V | − | E| .
| {z } | {z }
≥|V |−| E \{e}| =| E |−1
Proof. Replay the proof of Corollary 5.1.6, with just a few changes: Instead of
applying Corollary 5.1.5 (c), apply Corollary 5.1.5 (b) (this is allowed because
G has no cycles and thus e appears in no cycle of G). The induction hypothesis
can be used because when G has no cycles, G \ e has no cycles either. All ≤ and
≥ signs in the above proof now can be replaced by = signs (since Corollary
5.1.5 (b) claims an equality, not an inequality). The result is therefore conn G =
|V | − | E | .
Corollary 5.1.8. Let G = (V, E, ϕ) be a multigraph that has at least one cycle.
Then, conn G ≥ |V | − | E| + 1.
Proof. Pick an edge e ∈ E that belongs to some cycle (such an edge exists, since
G has at least one cycle). Then, Corollary 5.1.5 (a) yields conn ( G \ e) = conn G.
However, Corollary 5.1.6 (applied to G \ e and E \ { e} instead of G and E) yields
conn ( G \ e) ≥ |V | − | E \ { e}| = |V | − (| E| − 1) = |V | − | E| + 1.
| {z }
=| E |−1
e
a 2 3
2 3
A= 1 b d g
B= 1 b d g
c
5 4 c
f 5 4
3
c
2 3 D= 1 2
a
g e
C= 1 b
.
c
5 4 4
2 2
a
a
b
E= 1 4 F= 1 4
c
c
d
3 3
G= H= 1
(Yes, G is an empty graph with no vertices.) Which of them are forests, and
which are trees?
• The graph A is not a forest, since it has a cycle (actually, several cycles).
Thus, A is not a tree either.
• The graph B is a tree.
• The graph C is a forest, but not a tree, since it is not connected.
• The graph D is a tree.
• The graph E is a forest, but not a tree.
An introduction to graph theory, version August 2, 2023 page 148
• The graph G (which has no vertices and no edges) is a forest, but not
a tree, since it is not connected (recall: a graph is connected if it has 1
component; but G has 0 components).
T7
T2
T6
T1 T3
T8
T5
T4
.
In this digraph, an arc from Ti to Tj stands for the implication Ti =⇒Tj. Since
this digraph is strongly connected (i.e., you can travel from Statement Ti to
Statement Tj along its arcs for any i, j), this will prove the theorem. So let us
prove the implications.
Proof of T1=⇒T3: Assume that Statement T1 holds. Thus, G is a tree. There-
fore, G is connected, so that V 6= ∅. We must prove that for each u ∈ V and
v ∈ V, there is a unique backtrack-free walk from u to v. The existence of such
a walk is clear (since G is connected, so there is a path from u to v). Thus, we
only need to show that it is unique. But this is easy: If there were two distinct
backtrack-free walks from u to v (for some u ∈ V and v ∈ V), then Theorem
5.1.3 would show that G has a cycle, and thus G could not be a forest, let alone
a tree. Thus, the backtrack-free walk from u to v is unique. So we have proved
Statement T3. The implication T1=⇒T3 is thus proved.
Proof of T3=⇒T2: Assume that Statement T3 holds. We must prove that State-
ment T2 holds. First, G has no loops, because if there was a loop e with end-
point u, then the two walks (u) and (u, e, u) would be two distinct backtrack-
free walks from u to u. It remains to prove that for each each u ∈ V and
v ∈ V, there is a unique path from u to v. However, the existence of a walk
from u to v always implies the existence of a path from u to v (by Corollary
3.3.10). Moreover, the uniqueness of a backtrack-free walk from u to v implies
the uniqueness of a path from u to v (since any path is a backtrack-free walk).
Thus, Statement T2 follows from Statement T3.
Proof of T2=⇒T7: Assume that Statement T2 holds. Then, G is connected.
Now, let us remove any edge e from G. Let u and v be the endpoints of e. Then,
u 6= v (since G has no loops). There cannot be a path from u to v in the graph
G \ e (because if there was such a path, then it would also be a path from u to v
in the graph G, and this path would be distinct from the path (u, e, v); thus, the
graph G would have at least two paths from u to v; but this would contradict
the uniqueness part of Statement T2). Hence, the graph G \ e is disconnected.
So we have shown that G is connected, but removing any edge from G yields a
disconnected graph. In other words, Statement T7 holds.
An introduction to graph theory, version August 2, 2023 page 150
Proof. =⇒: Assume that G is a forest. Thus, G has no cycles. Hence, the induced
subgraphs G [C1 ] , G [C2 ] , . . . , G [Ck ] have no cycles either (since a cycle in any
of them would be a cycle of G); in other words, they are forests. But they are
furthermore connected (since the induced subgraph on a component is always
connected). Hence, they are connected forests, i.e., trees.
⇐=: Assume that the induced subgraphs G [C1 ] , G [C2 ] , . . . , G [Ck ] are trees.
Hence, none of them has a cycle. Thus, G has no cycles either (since a cycle of
G would have to be fully contained in one of these induced subgraphs31 ). In
other words, G is a forest.
5.2.3. Summary
Let us briefly summarize some properties of trees:
If T = (V, E, ϕ) is a tree, then...
• adding any new edge to T creates a cycle. (This follows from the implica-
tion T1=⇒T6 in Theorem 5.2.4.)
31 Indeed,
if it wasn’t, then it would contain vertices from different components. But this is
impossible, since there are no walks between vertices in different components.
An introduction to graph theory, version August 2, 2023 page 152
Remark 5.2.6. Computer scientists use some notions of “trees” that are sim-
ilar to ours, but not quite the same. In particular, their trees often have roots
(i.e., one vertex is chosen to be called “the root” of the tree), which leads to
a parent/child relationship on each edge (namely: the endpoint closer to the
root is called the “parent” of the endpoint further away from the root). Of-
ten, they also impose a total order on the children of each given vertex. With
these extra data, a tree can be used for addressing objects, since each vertex
has a unique “path description” from the root leading to it (e.g., “the second
child of the fourth child of the root”). But this all is going too far afield for
us here; we are mainly interested in trees as graphs, and won’t impose any
extra structure unless we need it for something.
Exercise 5.1. Let G be a multigraph that has no loops. Assume that there
exists a vertex u of G such that
5.3. Leaves
Continuing with our faux-botanical terminology, we define leaves in a tree:
2 3
1 b d g
c
5 4
How to find a tree with as many leaves as possible (for a given number of
vertices)? For any n ≥ 3, the simple graph
3
2
4
0 1
5
7
6
(for n = 8) .
It is easy to see that no tree with n ≥ 3 vertices can have more than n − 1 leaves,
so the n-star graph is optimal in this sense. Note that for n = 2, the n-star graph
has 2 leaves, not 1.
How to find a tree with as few leaves as possible? For any n ≥ 2, the n-path
graph
Pn = 1 2 3 ··· n
is a tree with only 2 leaves (viz., the vertices 1 and n). Can we find a tree with
fewer leaves? For n = 1, yes, because the 1-path graph P1 (this is simply the
graph with 1 vertex and no edges) has no leaves at all. However, for n ≥ 2, the
n-path graph is the best we can do:
(b) Let v be a vertex of T. Then, there exist two distinct leaves p and q of T
such that v lies on the path from p to q.
Note that I’m saying “the path” rather than “a path” here. This is allowed,
because in a tree, for any two vertices p and q, there is a unique path from p
to q. This follows from Statement T2 in the tree equivalence theorem (Theorem
5.2.4).
Proof of Theorem 5.3.2. (b) We apply a variant of the “longest path trick”: Among
all paths that contain the vertex v, let w be a longest one. Let p be the starting
An introduction to graph theory, version August 2, 2023 page 154
point of w, and let q be the ending point of w. We shall show that p and q are
two distinct leaves.
[Here is a picture of w, for what it’s worth:
p ··· v ··· q
.
Of course, the tree T can have other edges as well, not just those of w.]
First, we observe that T is connected (since T is a tree), and has at least one
vertex u distinct from v (since T has at least 2 vertices). Hence, T has a path r
that connects v to u. This path r must contain at least one edge (since u 6= v).
Thus, we have found a path r of T that contains v and contains at least one
edge. Hence, the path w must contain at least one edge as well (since w is a
longest path that contains v, and thus cannot be shorter than r). Since w is a
path from p to q, we thus conclude that p 6= q (because if a path contains at
least one edge, then its starting point is distinct from its ending point).
Now, assume (for the sake of contradiction) that p is not a leaf. Then, deg p 6=
1. The path w already contains one edge that contains p (namely, the first edge
of w). Since deg p 6= 1, there must be another edge f of T that contains w.
Consider this f . Let p′ be its endpoint distinct from p (if f is a loop, then we
set p′ = p). Appending this edge f (and its endpoint) to the beginning of the
path w, we obtain a backtrack-free walk
p′ , f , p, . . . , v, . . . , q
| {z }
This is w
(this is backtrack-free since f is not the first edge of w). According to Proposi-
tion 5.1.2, this backtrack-free walk either is a path or contains a cycle. Since T
has no cycle (because T is a forest), we thus conclude that this backtrack-free
walk is a path. It is furthermore a path that contains v and is longer than w
(longer by 1, in fact). But this contradicts the fact that w is a longest path that
contains v. This contradiction shows that our assumption (that p is not a leaf)
was wrong.
Hence, p is a leaf. A similar argument shows that q is a leaf (here, we need
to append the new edge at the end of w rather than at the beginning). Thus,
p and q are two distinct leaves of T (distinct because p 6= q) such that v lies on
the path from p to q (since v lies on the path w, which is a path from p to q).
This proves Theorem 5.3.2 (b).
(a) Pick any vertex v of T. Then, Theorem 5.3.2 (b) shows that there exist two
distinct leaves p and q of T such that v lies on the path from p to q. Thus, in
particular, there exist two distinct leaves p and q of T. In other words, T has at
least two leaves. This proves Theorem 5.3.2 (a).
An introduction to graph theory, version August 2, 2023 page 155
[Remark: Another way to prove part (a) is to write the tree T as T = (V, E, ϕ),
and recall the handshake lemma, which yields
Since each v ∈ V satisfies deg v ≥ 1 (why?), this equality entails that at least
two vertices v ∈ V must satisfy deg v ≤ 1 (since otherwise, the sum ∑ deg v
v ∈V
would be ≥ 2 · |V | − 1), and therefore these two vertices are leaves.]
Leaves are particularly helpful for performing induction on trees. The formal
reason for this is the following theorem:
Theorem 5.3.3 (induction principle for trees). Let T be a tree with at least 2
vertices. Let v be a leaf of T. Let T \ v be the multigraph obtained from T
by removing v and all edges that contain v (note that there is only one such
edge, since v is a leaf). Then, T \ v is again a tree.
5 8 5 8
1 7 1 7
3 2 6 2 6
4 4
T T\v
Proof. Left to the reader. (The main step is to show that a cycle of G cannot
contain v.)
Theorem 5.3.3 helps prove many properties of trees by induction on the num-
ber of vertices. In the induction step, remove a leaf v and apply the induction
hypothesis to T \ v.
The following exercise is essentially a generalization of Theorem 5.3.2 (a):
Exercise 5.2. Let T be a tree. Let w be any vertex of T. Prove that T has at
least deg w many leaves.
∑ (−1)|D| = ±1.
D is a dominating set of G
Exercise 5.4. Let T be a tree having more than 1 vertex. Let L be the set of
leaves of T. Prove that it is possible to add | L| − 1 new edges to T in such a
way that the resulting multigraph has a Hamiltonian cycle.[Solution: This is
Exercise 4 on homework set #3 from my Spring 2017 course; see the course
page for solutions.]
An introduction to graph theory, version August 2, 2023 page 157
• To build an induced subgraph, we throw away some vertices but keep all
the edges that we can keep. (As usual in mathematics, the words “some
vertices” include “no vertices” and “all vertices”.)
λ
ε 2 3 κ
1 δ 4
α
β γ
µ ν
5
.
An introduction to graph theory, version August 2, 2023 page 158
ε 2 3
1 δ 4
α
ν
5
.
Here is another:
ε 2 3
1 δ 4
β
ν
5
.
(Yes, this is a different one, because α 6= β.) And here is yet another spanning
tree of G:
λ
ε 2 3
1 4
β
ν
5
.
Example 5.4.4. Let n be a positive integer. Consider the cycle graph Cn . (We
defined this graph Cn in Definition 2.6.3 for all n ≥ 2, but we later redefined
C2 and defined C1 in Definition 3.3.5. Here, we are using the latter modified
definition.)
The graph Cn has exactly n spanning trees. Indeed, any graph obtained
from Cn by removing a single edge is a spanning tree of Cn .
Proof. A tree with n vertices must have exactly n − 1 edges (by the implication
T1=⇒T4 in Theorem 5.2.4). Thus, a spanning subgraph of Cn can be a tree only
if it has n − 1 edges, i.e., only if it is obtained from Cn by removing a single edge
(since Cn has n edges in total). Thus, Cn has at most n spanning trees (since
Cn has n edges that can be removed). It remains to check that any subgraph
An introduction to graph theory, version August 2, 2023 page 159
a, b, x1 , x2 , . . . , xm , y1 , y2 , . . . , ym , z1 , z2 , . . . , zm
(Thus, the graph consists of two vertices a and b connected by three paths,
each of length m + 1, with no overlaps between the paths except for their
starting and ending points. Here is a picture for m = 3:
x1 x2 x3
a y1 y2 y3 b
z1 z2 z3
Theorem 5.4.6. Each connected multigraph G has at least one spanning tree.
with endpoints u and v to L creates a cycle if and only if u and v lie in the
same component of L (before we add e). Thus, we only add an edge to L if
its endpoints lie in different components of L; otherwise, we discard it. This
way, at the end of the procedure, our graph L will still have no cycles (since we
never create any cycles). In other words, it will be a forest.
Let me denote this forest by H. (Thus, H is the L at the end of the procedure.)
I claim that this forest H is a spanning tree of G. Why? Since we know that H is
a forest, we only need to show that H is connected. Assume the contrary. Thus,
there is at least one edge e of G whose endpoints lie in different components of
H (why?). This edge e is therefore not an edge of H. Therefore, at some point
during our construction of H, we must have discarded this edge e (instead of
adding it to L). As we know, this means that the endpoints of e used to lie
in the same component of L at the point at which we discarded e. But this
entails that these two endpoints lie in the same component of L at the end of
the procedure as well (because the graph L never loses any edges during the
procedure, so that any two vertices that used to lie in the same component of
L at some point will still lie in the same component of L ever after). In other
words, the endpoints of e lie in the same component of H. This contradicts
our assumption that the endpoints of e lie in different components of H. This
contradiction completes our proof that H is connected. Hence, H is a spanning
tree of G, and we have proved Theorem 5.4.6 again.
Third proof. This proof takes yet another approach to constructing a spanning
tree of G: We choose an arbitrary vertex r of G, and then progressively “spread
a rumor” from r. The rumor starts at vertex r. On day 0, only r has heard
the rumor. Every day, every vertex that knows the rumor spreads it to all its
neighbors (i.e., all vertices adjacent to it). Since G is connected, the rumor
will eventually spread to every vertex of G. Now, each vertex v (other than r)
remembers which other vertex v′ it has first heard the rumor from (if it heard
it from several vertices at the same time, it just picks one of them), and picks
some edge ev that has endpoints v and v′ (such an edge must exist, since v must
have heard the rumor from a neighbor). The edges ev for all v ∈ V \ {r } (where
V is the vertex set of G) then form a spanning tree of G (that is, the graph with
vertex set V and edge set {ev | v ∈ V \ {r }} is a spanning tree). Why?
Intuitively, this is quite convincing: This graph cannot have cycles (because
that would require a time loop) and must be connected (because for any ver-
tex v, we can trace back the path of the rumor from r to v by following the
edges ev backwards). To obtain a rigorous proof, we formalize this construction
mathematically:
Write G as G = (V, E, ϕ). Choose any vertex r of G.
We shall recursively construct a sequence of subgraphs
(V0 , E0 , ϕ0 ) , (V1 , E1 , ϕ1 ) , (V2 , E2 , ϕ2 ) , ...
of G. The idea behind these subgraphs is that for each i ∈ N, the set Vi will
consist of all vertices v that have heard the rumor by day i, and the set Ei will
An introduction to graph theory, version August 2, 2023 page 162
Ei +1 := Ei ∪ {ev | v ∈ Vi +1 \ Vi } .
33 We say that an edge joins a vertex p to a vertex q if the endpoints of this edge are p and q.
34 Here is the proof in detail: We must show that Vi = V. Assume the contrary. Thus, there
exists a vertex u ∈ V \ Vi . Consider this u. The path from r to u starts at a vertex in Vi
(since r ∈ V0 ⊆ Vi ) and ends at a vertex in V \ Vi (since u ∈ V \ Vi ). Thus, it must cross over
from Vi into V \ Vi at some point. Therefore, there exists an edge with one endpoint in Vi
and the other endpoint in V \ Vi . Let v and w be these two endpoints, so that v ∈ Vi and
w ∈ V \ Vi . Then, w is adjacent to some vertex in Vi (namely, to v), and therefore belongs to
Vi+1 (by the definition of Vi+1 ). Hence, w ∈ Vi+1 = Vi . But this contradicts w ∈ / V \ Vi . This
contradiction shows that our assumption was wrong, qed.
An introduction to graph theory, version August 2, 2023 page 163
2
5
1 4
3 10
.
V0 = { 3} ,
V1 = {3, 1, 4} ,
V2 = {3, 1, 4, 2, 5, 6, 10} ,
V3 = {3, 1, 4, 2, 5, 6, 10, 8, 9, 7} = V,
2
5
1 4
3 10
(The dark-red inner circle is V0 ; the red circle is V1 ; the orange circle is V2 ;
the yellow circle is V3 = V4 = V5 = · · · = V.) Finally, the edges ev can be
An introduction to graph theory, version August 2, 2023 page 165
chosen to be the following (we are painting them red for clarity):
7
e7
2
e6 5 e8
e2
8
e5
1 4
e10
e9 9
e3 e4
3 10
.
(Here, we have made two choices: We chose e2 to be the edge joining 2 with 1
rather than the edge joining 2 with 4, and we chose e7 to be the edge joining
7 with 6 rather than 7 with 5. The other options would have been equally
fine.)
We now return to the general proof. Let us first show the following:
Claim 1: Let j ∈ N. Each vertex of the graph Vj , E j , ϕ j is path-
connected to r in this graph.
(Vk−1 , Ek−1 , ϕk−1 ) (by the induction hypothesis, since u ∈ Vk−1 ), hence also
in the graph (Vk , Ek , ϕk ) (since (Vk−1 , Ek−1 , ϕk−1 ) is a subgraph of (Vk , Ek , ϕk )).
Since the relation “path-connected” is transitive, we conclude from the previous
two sentences that v is path-connected to r in the graph (Vk , Ek , ϕk ).
So we have shown that each vertex v of the graph (Vk , Ek , ϕk ) is path-connected
to r in the graph (Vk , Ek , ϕk ). In other words, Claim 1 holds for j = k. This com-
pletes the induction step, and Claim 1 is proved.]
Claim 1 (applied to j = i) shows that each vertex of the graph (Vi , Ei , ϕi ) is
path-connected to r in this graph. Since the relation “path-connected” is an
equivalence relation, this entails that any two vertices of this graph are path-
connected. Thus, the graph (Vi , Ei , ϕi ) is connected (since it has at least one
vertex). It remains to prove that this graph (Vi , Ei , ϕi ) is a forest.
Again, we do this using an auxiliary claim:
Claim 2: Let j ∈ N. Then, the graph Vj , E j , ϕ j has no cycles.
Vk = {v ∈ V | d (r, v) ≤ k} ,
• If some neighbor of v has not been bitten yet, then the snake picks such
a neighbor w as well as some edge f that joins w with v; the snake then
moves to w along the edge f , bites the vertex w and marks the edge f .
• If not, then the snake marks the vertex v as fully digested and backtracks
(along the marked edges) to the last vertex it has visited but not fully
digested yet.
2 5 9 12
1 4 10 13
3 6 11 14
7
.
Let our snake start its journey at r = 3. It bites this vertex. Then, let’s say
that it picks the vertex 1 as its next victim (it could just as well go to 4 or 7;
the snake has many choices, but we follow one possible trip). Thus, it next
arrives at vertex 1, bites it and marks the edge that brought it to this vertex.
As its next destination, it necessarily picks the vertex 2 (since vertex 3 has
already been bitten). It moves to vertex 2, bites it and marks the edge. Next,
let’s say that it picks the vertex 4 (the other option would be 8). It thus moves
to 4, bites it and marks the edge. Proceeding likewise, it then moves to 5 (the
other options are 6 and 10; the vertices 2 and 3 do not qualify since they are
already bitten), bites 5 and marks an edge. From there, let’s say it moves to
8, bites 8 and marks an edge. Now, there is no longer an unbitten neighbor
of 8 to move to. Thus, the snake marks the vertex 8 as fully digested and
backtracks to the last vertex not fully digested – which, at this point, is 5.
From this vertex 5, it moves on to 9 (this is the only option, since 4 and 8
have already been bitten). And so on. Here is one possible outcome of this
journey (there are a few more decisions that the snake can make here, so you
An introduction to graph theory, version August 2, 2023 page 169
2 5 9 12
1 4 10 13
3 6 11 14
7
.
Here, the marked edges are drawn in bold red ink, and endowed with an
arrow that represents the direction in which they were first used (e.g., the
edge joining 2 with 4 has an arrow towards 4 because it was first used to get
from 2 to 4).
Now, as promised, let me outline a proof of the above claim (that the marked
edges form a spanning tree of G). To wit, argue the following four observations
(ideally in this order):
1. After each step, the marked edges are precisely the edges along which the
snake has moved so far.
2. After each step, the network of bitten vertices and marked edges is a tree.
4. At that point, the network of bitten vertices and marked edges is a span-
ning tree (since each neighbor of a fully digested vertex is bitten, thus
fully digested by observation 3).
5.4.5. Applications
Spanning trees have lots of applications:
Proof. Pick a spanning tree T of G (we know from Theorem 5.4.6 that such a
spanning tree exists). Then, T has at least 2 leaves (by Theorem 5.3.2 (a)). But
each leaf of T is a non-cut-vertex of G (why?).
5.4.6. Exercises
[Hint: The two parts look very similar, but (to my knowledge) their proofs
are not.]
3
a d
b
1 2
c ,
3
a
1 2
c
3 3
a a d
b
1 2 1 2
3 3
d
b
1 2 1 2
c c
Proof. Apply Theorem 5.4.6 to each component of the multigraph. Then, com-
bine the resulting spanning trees into a spanning forest.
Remark 5.5.3. Distances in a multigraph satisfy the rules that you would
expect a distance function to satisfy:
(c) We have d (u, v) + d (v, w) ≥ d (u, w) for any vertices u, v and w. (Here,
we understand that ∞ ≥ m and ∞ + m = ∞ for any m ∈ N.)
Also:
An introduction to graph theory, version August 2, 2023 page 174
(e) If V is the vertex set of our multigraph, then d (u, v) ≤ |V | − 1 for any
vertices u and v.
Proof. Part (d) follows from Corollary 3.3.10. The proofs of (a), (b) and (c) are
then straightforward (the proof of (c) relies on part (d), because splicing two
paths generally only yields a walk, not a path). Finally, in order to prove part
(e), observe that any path of our multigraph has length ≤ |V | − 1 (since its
vertices are distinct).
We note that the definition of a distance becomes simpler if our multigraph
is a tree: Namely, if T is a tree, then the distance d (u, v) between two vertices
u and v is the length of the only path from u to v in T. Thus, in a tree, we do
not have to worry whether a given path is the shortest.
We also notice that if G is a multigraph, and if u and v are two vertices of
G, then the distance d G (u, v) in G equals the distance d Gsimp (u, v) in the simple
graph Gsimp . (The reason for this is that any path of G can be converted into
a path of Gsimp having the same length, and vice versa. Of course, this is not
a one-to-one correspondence, but it suffices for our purposes.) Thus, when
studying distances on a multigraph, we can WLOG restrict ourselves to simple
graphs.
The following few exercises give some curious properties of distances in var-
ious kinds of graphs.
Exercise 5.10. Let a, b and c be three vertices of a connected multigraph
G = (V, E, ϕ). Prove that d (b, c) + d (c, a) + d ( a, b) ≤ 2 |V | − 2.
[Solution: This is Exercise 7 on midterm #1 from my Spring 2017 course,
except that the simple graph has been replaced by a multigraph (but this
makes no serious difference); see the course page for solutions.]
are equal.
[Solution: This is Exercise 6 on midterm #2 from my Spring 2017 course;
see the course page for solutions.]
max {d (v, u) | u ∈ V } ∈ N ∪ { ∞} .
r u w
p q v
.
Then, the eccentricities of its vertices are as follows (we are just labeling each
vertex with its eccentricity):
2 3 4
4 3 2
.
Example 5.5.8. Let G be a graph with more than one component. Then, each
vertex v of G has eccentricity ∞ (because there exists at least one vertex u
that lies in a different component of G than v, and thus this vertex u satisfies
d (v, u) = ∞). Hence, each vertex of G is a center of G.
To prove Theorem 5.5.9, we first study how a tree is affected when all its
leaves are removed:
(that is, the paths of T from u to v are precisely the paths of T \ L from
u to v).
1 2 3 4
5 6 7 9
8 10 11
.
Then, the set L from Lemma 5.5.10 is {4, 5, 7, 8, 10, 11}, and the tree T \ L
looks as follows:
1 2 3
6 9
.
Proof of Lemma 5.5.10. First, we notice that T is a forest (since T is a tree), and
thus has no cycles. In particular, T therefore has no loops and no parallel edges.
Also, for any two vertices u and v of T, there is a unique path from u to v in T.
Next, we introduce some terminology: If p is a path of some multigraph, then
an intermediate vertex of p shall mean a vertex of p that is neither the starting
point nor the ending point of p. In other words, if p = ( p0 , e1 , p1 , e2 , p2 , . . . , ek , pk )
is a path of some multigraph, then the intermediate vertices of p are p1 , p2 , . . . , pk−1 .
Clearly, any intermediate vertex of a path p must have degree ≥ 2 (since the
path p enters it along some edge, and leaves it along another). Hence, if p is a
path of T, then
(because it must have degree ≥ 2, thus cannot be a leaf of T; but this means
that it cannot belong to L; therefore, it must belong to V \ L).
(b) Let u ∈ V \ L and v ∈ V \ L. Let p be a path of T from u to v. We shall
show that p is a path of T \ L as well.
Indeed, let us first check that all vertices of p belong to V \ L. This is clear for
the vertices u and v (since u ∈ V \ L and v ∈ V \ L); but it also holds for every
intermediate vertex of p (by (12)). Thus, it does indeed hold for all vertices of
p.
An introduction to graph theory, version August 2, 2023 page 179
(d) If u and v are two vertices of T \ L, then the two distances d T (u, v) and
d T \ L (u, v) are equal (by Lemma 5.5.10 (c)); thus, we shall denote both distances
by d (u, v) (since there is no confusion to be afraid of).
Let v ∈ V \ L. We must show that eccT v = eccT \ L v + 1.
Let u be a vertex of T \ L such that d (v, u) is maximum. Thus, eccT \ L v =
d (v, u) (by the definition of eccT \ L v). However, u is a vertex of T \ L, and thus
does not belong to L. Hence, u is not a leaf of T (since L is the set of all leaves
of T). Hence, u has degree ≥ 2 in T (since a vertex in a tree with more than 1
vertex cannot have degree 0).
Now, consider the path p from v to u in the tree T. This path p has length
d (v, u). Since u has degree ≥ 2, there exist at least two edges of T that contain
u. Hence, in particular, there exists at least one edge f that contains u and is
distinct from the last edge of p 37 . Consider this edge f . Let w be the endpoint
of f other than u. Appending f and w to the end of the path p, we obtain a
walk from v to w. This walk is backtrack-free (since f is distinct from the last
edge of p) and thus must be a path (by Proposition 5.1.2, since T has no cycles).
This path has length d (v, u) + 1 (since it was obtained by appending an edge
to the path p, which has length d (v, u)). Hence, d (v, w) = d (v, u) + 1. But the
definition of eccentricity yields
On the other hand, let x be a vertex of T such that d (v, x ) is maximum. Thus,
eccT v = d (v, x ) (by the definition of eccT v). The path from v to x has length
≥ 1 (since otherwise, we would have x = v and therefore d (v, x ) = d (v, v) = 0,
which would easily contradict the maximality of d (v, x )). Thus, it has a second-
to-last vertex. Let y be this second-to-last vertex. Then, the path from v to
y is simply the path from v to x with its last edge removed. Consequently,
d (v, y) = d (v, x ) − 1. However, it is easy to see that y ∈ V \ L 38 . In other
words, y is a vertex of T \ L. Thus, the definition of eccentricity yields
37 Ifthe path p has no edges, then f can be any edge that contains u.
38 Proof.Assume the contrary. Thus, y ∈ / V \ L. Hence, y 6= v (since y ∈
/ V \ L but v ∈ V \ L).
However, y is the second-to-last vertex of the path from v to x. Therefore, y is either
the starting point v of this path, or an intermediate vertex of this path. Since y 6= v, we
thus conclude that y is an intermediate vertex of this path. Hence, by (12), we see that y
must belong to V \ L. But this contradicts y ∈ / V \ L. This contradiction shows that our
assumption was false, qed.
An introduction to graph theory, version August 2, 2023 page 181
(e) If u and v are two vertices of T \ L, then the two distances d T (u, v) and
d T \ L (u, v) are equal (by Lemma 5.5.10 (c)); thus, we shall denote both distances
by d (u, v) (since there is no confusion to be afraid of).
Let v ∈ L be a leaf. Let w be the unique neighbor of v in T. We must prove
that eccT v = eccT w + 1.
We first claim that
d (v, u) = d (w, u) + 1 for each u ∈ V \ { v} . (14)
[Proof of (14): We have deg v = 1 (since v is a leaf). In other words, there is a
unique edge of T that contains v. Let e be this edge. The endpoints of e are v
and w (since w is the unique neighbor of v). Thus, v 6= w (since T has no loops)
and d (v, w) = 1.
Now, let u ∈ V \ {v}. Then, the path from v to u in T must have length ≥ 1
(since u 6= v), and therefore must begin with the edge e (since e is the only edge
that contains v). If we remove this edge e from this path, we thus obtain a path
from w to u. As a consequence, the path from v to u is longer by exactly 1 edge
than the path from w to u. In other words, we have d (v, u) = d (w, u) + 1. This
proves (14).]
Now, the definition of eccentricity yields
eccT v = max { d (v, u) | u ∈ V } . (15)
This maximum is clearly not attained for u = v (since d (v, v) = 0 is smaller
than d (v, w) = 1). Thus, this maximum does not change if we remove v from
its indexing set V. Hence, (15) rewrites as
eccT v = max d (v, u) | u ∈ V \ { v}
| {z }
=d(w,u)+1
(by (14))
= max {d (w, u) + 1 | u ∈ V \ {v}}
= max {d (w, u) | u ∈ V \ {v}} + 1. (16)
On the other hand, the definition of eccentricity yields
eccT w = max { d (w, u) | u ∈ V } . (17)
We shall now show that this maximum does not change if we remove v from
its indexing set V. In other words, we shall show that
max {d (w, u) | u ∈ V } = max { d (w, u) | u ∈ V \ { v}} . (18)
[Proof of (18): Assume that (18) is false. Then, the maximum max {d (w, u) | u ∈ V }
is attained only at u = v. In other words, we have
d (w, v) > d (w, u) for all u ∈ V \ {v} . (19)
An introduction to graph theory, version August 2, 2023 page 182
However, the tree T has more than 2 vertices. Thus, it has a vertex u that is
distinct from both v and w. Consider this u. Thus, u ∈ V \ { v}, so that (19)
yields d (w, v) > d (w, u). In view of d (w, v) = d (v, w) = 1, this rewrites as
1 > d (w, u), so that d (w, u) < 1. Therefore, w = u. But this contradicts the
facts that w is distinct from u. This contradiction shows that our assumption
was false, and thus (18) is proved.]
Now, (16) becomes
In other words, the tree T \ L has either 1 or 2 centers, and if it has 2 centers,
then these 2 centers are adjacent. Since the centers of T are precisely the centers
of T \ L, we can rewrite this as follows: The tree T has either 1 or 2 centers,
and if it has 2 centers, then these 2 centers are adjacent. In other words, parts
(a) and (b) of Theorem 5.5.9 hold for our tree T. This completes the induction
step. Thus, parts (a) and (b) of Theorem 5.5.9 are proved.
(c) This follows from Lemma 5.5.10 (f). Indeed, if T has at most 2 vertices,
then all vertices of T are centers of T (this is trivial to check). If not, then each
“leaf-removal” step of our algorithm leaves the set of centers of T unchanged
(by Lemma 5.5.10 (f)), and thus the centers of the original tree T are precisely
the centers of the tree that remains at the end of the algorithm. But the latter
tree has at most 2 vertices, and thus its centers are precisely its vertices. So the
centers of T are precisely the vertices that remain at the end of the algorithm.
Theorem 5.5.9 (c) is proven.
The following exercise shows another approach to the centers of a tree:
(b) If m is odd, then the two centers of T are p(m−1)/2 and p(m+1)/2 .
Remark 5.5.12. Exercise 5.14 is a result by Arthur Cayley from 1875. It shows
once again that each tree has exactly one center or two adjacent centers, and
also shows that any two longest paths of a tree have a common vertex.
Exercise 5.15. Let T be a tree. For any vertex v of T, we let cv denote the size
of the largest component of the graph T \ v. (Recall that T \ v is the graph
obtained from T by removing the vertex v and all edges that contain v. Note
that a component (according to our definition) is a set of vertices; thus, its
size is the number of vertices in it.)
The vertices v of T that minimize the number cv are called the centroids of
T.
(a) Prove that T has no more than two centroids, and furthermore, if T has
two centroids, then these two centroids are adjacent.
An introduction to graph theory, version August 2, 2023 page 184
(b) Find a tree T such that the centroid(s) of T are distinct from the center(s)
of T.
10 9 10
10 5 7 10
8 10
10 10
.
Thus, the vertex labelled 5 is the only centroid of this tree T.]
Note the analogy between Exercise 5.15 (a) and Theorem 5.5.9 (a) and (b).
5.6. Arborescences
5.6.1. Definitions
Enough about undirected graphs.
What would be a directed analogue of a tree? I.e., what kind of digraphs
play the same role among digraphs that trees do among undirected graphs?
Trees are graphs that are connected and have no cycles. This suggests two
directed versions:
• We can study digraphs that are strongly connected and have no cycles.
Unfortunately, there is not much to study: Any such digraph has only 1
vertex and no arcs. (Make sure you understand why!)
fewer edges than vertices, but a dag can have more arcs than vertices.39
(a) We say that r is a from-root (or, short, root) of D if for each vertex v of
D, the digraph D has a path from r to v.
2 3
0
1 4
40 We recall that we defined a multigraph Dund for every multidigraph D (in Definition
4.4.1). Roughly speaking, this multigraph Dund is obtained by “forgetting the di-
rections” of the arcs of D. Parallel arcs are not merged into one. For example,
if D = 1 2 , then Dund = 1 2
.
An introduction to graph theory, version August 2, 2023 page 186
2 3
0
1 4
which has only one from-root (namely, 1) and is still not an arborescence (for
the same reason as before).
5 8
1 7
3 2 6
4
.
5 8
1 7
3 2 6
4
,
• Statement C2: The undirected multigraph Dund is a tree, and each arc
of D is “oriented away from r” (this means the following: the source of
this arc lies on the unique path between r and the target of this arc on
Dund ).
• Statement A5: If we remove any arc from D, then the vertex r will no
longer be a from-root of the resulting multidigraph.
(v0 , a1 , v1 , a2 , v2 , . . . , ak , vk , a, t) ,
This contradiction shows that our assumption was false. Hence, the digraph
D \ a has no path from r to t. Thus, r is not a from-root of D \ a.
Forget that we fixed a. We have now proved that if a is any arc of D, then r
is not a from-root of D \ a. In other words, if we remove any arc from D, then
the vertex r will no longer be a from-root of the resulting multidigraph. Thus,
Statement A5 holds.
Proof of the implication A5=⇒A6: Assume that Statement A5 holds. We must
prove that Statement A6 holds. In other words, we must prove that deg− r = 0,
and that each v ∈ V \ {r } satisfies deg− v = 1.
Let us first prove that deg− r = 0. Indeed, assume the contrary. Thus,
deg− r 6= 0, so that there exists an arc a with target r. We shall show that r
is a from-root of D \ a.
The arc a has target r. Thus, a path that starts at r cannot use this arc a
(because this arc would lead it back to r, but a path is not allowed to revisit
any vertex), and therefore must be a path of D \ a. Thus we have shown that
any path of D that starts at r is also a path of D \ a. However, for each vertex
v of D, the digraph D has a path from r to v (since r is a from-root of D). This
path is also a path of D \ a (since any path of D that starts at r is also a path
of D \ a). Thus, for each vertex v of D \ a, the digraph D \ a has a path from
r to v. In other words, r is a from-root of D \ a. However, we have assumed
that Statement A5 holds. Thus, in particular, if we remove the arc a from D,
then the vertex r will no longer be a from-root of the resulting multidigraph. In
other words, r is not a from-root of D \ a. But this contradicts the fact that r is
a from-root of D \ a.
This contradiction shows that our assumption was false. Hence, deg− r = 0
is proved.
Now, let v ∈ V \ {r } be arbitrary. We must show that deg− v = 1.
Indeed, assume the contrary. Thus, deg− v 6= 1. Using the fact that r is a
from-root of D, it is thus easy to see that deg− v ≥ 2 41 . Hence, there exist
two distinct arcs a and b with target v. Consider these arcs a and b.
We are in one of the following three cases:
Case 1: The digraph D \ a has a path from r to v.
Case 2: The digraph D \ b has a path from r to v.
Case 3: Neither the digraph D \ a nor the digraph D \ b has a path from r to
v.
Let us first consider Case 1. In this case, the digraph D \ a has a path from r
to v. Let p be such a path.
We have assumed that Statement A5 holds. Thus, in particular, if we remove
the arc a from D, then the vertex r will no longer be a from-root of the resulting
41 Proof.Since r is a from-root of D, we know that the digraph D has a path from r to v. Since
v 6= r (because v ∈ V \ {r }), this path must have at least one arc. The last arc of this path
is clearly an arc with target v. Thus, there exists at least one arc with target v. In other
words, deg− v ≥ 1. Combining this with deg− v 6= 1, we obtain deg− v > 1. In other words,
deg− v ≥ 2.
An introduction to graph theory, version August 2, 2023 page 190
= 0+ ∑ 1= ∑ 1 = |V \ {r }| = |V | − 1.
v∈V \{r } v∈V \{r }
Proof. We recall that since T is a tree, the distance d ( p, q) between two vertices
p and q of T is simply the length of the path from p to q. (This path is unique,
since T is a tree.)
Let p be the path from r to u. Then, we are in one of the following two cases:
Case 1: The edge e is an edge of p.
Case 2: The edge e is not an edge of p.
Consider Case 1. In this case, e must be the last edge of p (since otherwise, p
would visit u more than once, but p cannot do this, since p is a path). Thus, if
we remove this last edge e (and the vertex u) from p, then we obtain a path from
r to v. This path is exactly one edge shorter than p. Thus, d (r, v) = d (r, u) − 1,
so that d (r, u) = d (r, v) + 1. So we are done in Case 1.
Now, consider Case 2. In this case, the edge e is not an edge of p. Thus, we
can append e and v to the end of the path p, and the result will be a backtrack-
free walk p′ . However, a backtrack-free walk in a tree is always a path (since
otherwise, it would contain a cycle44 , but a tree has no cycles). Thus, p′ is a
path from r to v, and it is exactly one edge longer than p (by its construction).
Therefore, d (r, v) = d (r, u) + 1. So we are done in Case 2.
Now, we are done in both cases, so that Proposition 5.7.1 is proven.
Example 5.7.3. Here is a tree T, a vertex r, an edge e and its r-parent e−r and
44 by Proposition 5.1.2
An introduction to graph theory, version August 2, 2023 page 193
T r→ := (V, E, ψ) ,
Example 5.7.5. If T is the tree from Example 5.7.3, then T r→ is the following
multidigraph:
The proof of this theorem is best organized by splitting into two lemmas:
Lemma 5.7.7. Let T = (V, E, ϕ) be a tree. Let r ∈ V be a vertex of T. Then,
the multidigraph T r→ is an arborescence rooted from r.
Proof. The idea is to show that if p is a path from r to some vertex v in the tree
T, then p is also a path in the digraph T r→ , because all the edges of p have been
“oriented correctly” (i.e., their orientation matches how they are used in p).
Here are the details: Clearly, (T r→ )und = T. Hence, the graph (T r→ )und is a
tree and hence has no cycles. Thus, it suffices to prove that r is a from-root of
T r→ . In other words, we must prove that
T r→ has a path from r to v (20)
for each v ∈ V.
We shall prove (20) by induction on d (r, v) (where d means the distance on
the tree T):
Base case: If v ∈ V satisfies d (r, v) = 0, then v = r, and thus T r→ has a path
from r to v (namely, the trivial path (r )). Thus, (20) is proved for d (r, v) = 0.
Induction step: Let k ∈ N. Assume (as the induction hypothesis) that (20)
holds for each v ∈ V satisfying d (r, v) = k. We must now prove the same for
each v ∈ V satisfying d (r, v) = k + 1.
So let v ∈ V satisfy d (r, v) = k + 1. Then, the path of T from r to v has
length k + 1. Let p be this path, let e be its last edge, and let u be its second-
to-last vertex (so that its last edge e has endpoints u and v). Then, by removing
the last edge e from the path p, we obtain a path from r to u that is one edge
shorter than p. Hence, d (r, u) = d (r, v) − 1 < d (r, v). Consequently, the edge
e has r-parent u and r-child v (by Definition 5.7.2). In other words, e−r = u
and e+r = v. Therefore, in the digraph T r→ , the edge e is an arc from u to
v (by Definition 5.7.4). Moreover, we have d (r, u) = d (r, v) − 1 = k (since
d (r, v) = k + 1); therefore, the induction hypothesis tells us that (20) holds for
u instead of v. In other words, T r→ has a path from r to u. Attaching the arc
e and the vertex v to this path, we obtain a walk of T r→ from r to v (since e
is an arc from u to v in T r→ ). Thus, the digraph T r→ has a walk from r to v,
therefore also a path from r to v. Hence, (20) holds for our v. This completes
the induction step.
Thus, (20) is proved by induction. As we explained above, this yields Lemma
5.7.7.
Lemma 5.7.8. Let D = (V, A, ψ) be an arborescence rooted from r (for some
r ∈ V). Let a ∈ A be an arc of D. Let s be the source of a, and let t be the
target of a. Then:
(a) We have d (r, s) < d (r, t), where d means distance on the tree Dund .
r →
(b) In the multidigraph Dund , the arc a has source s and target t.
An introduction to graph theory, version August 2, 2023 page 195
the arc a has source s and target t as well. In other words, ψ′ ( a) = (s, t) (since
ψ′ is the psi-map of this multidigraph). Hence, ψ′ ( a) = (s, t) = ψ ( a).
Forget that we fixed a. We thus have shown that ψ′ ( a) = ψ ( a) for each
a ∈ A. In other words, ψ′ = ψ. As explained above, this completes the proof of
Statement C2.
Proof of the implication C2=⇒C1: Assume that Statement C2 holds. Thus, the
r →
undirected multigraph Dund is a tree, and we have D = Dund . Hence,
und und
r→
Lemma 5.7.7 (applied to T = D ) yields that the multidigraph D is
an arborescence rooted from
und
r→ r. In other words, D is an arborescence rooted
from r (since D = D ). This shows that Statement C1 holds.
Having now proved both implications C1=⇒C2 and C2=⇒C1, we conclude
that Statements C1 and C2 are equivalent. Thus, Theorem 5.7.6 is proved.
Oof.
Let’s get one more consequence out of this. First, let us show that an arbores-
cence can have only one root:
Proposition 5.7.9. Let D be an arborescence rooted from r. Then, r is the
only root of D.
Proof of Proposition 5.7.9. Assume the contrary. Thus, D has another root s dis-
tinct from r. Hence, D has a path from r to s (since r is a root) as well as a path
from s to r (since s is a root). Combining these paths gives a circuit of length
> 0. However, a circuit of length > 0 in a digraph must always contain a cycle
(since Proposition 4.5.9 shows that it either is a path or contains a cycle; but it
clearly cannot be a path). Hence, D has a cycle. Therefore, Dund also has a cycle
(since any cycle of D is a cycle of Dund ). However, Dund has no cycles (since
D is an arborescence rooted from r). The preceding two sentences contradict
each other. This shows that the assumption was wrong, and Proposition 5.7.9
is proven.
Definition 5.7.10. A multidigraph D is said to be an arborescence if there
exists a vertex r of D such that D is an arborescence rooted from r. In this
case, this r is uniquely determined as the only root of D (by Proposition
5.7.9).
and
√
where D denotes the root of D.
However, Statement 1 follows from Theorem 5.7.6 (specifically, from the im-
plication C1=⇒C2 in Theorem 5.7.6). Statement 2 follows from Lemma 5.7.7
r → und = T part of Statement 2 is obvious, whereas
q precisely, the ( T )
(more
the ( T r→ )und = r part follows from Lemma 5.7.7). Thus, Theorem 5.7.11 is
proved.
Theorem 5.7.11 formalizes the idea that an arborescence is “just a tree with a
chosen vertex”. For this reason, arborescences are sometimes called “oriented
trees”, but this name is also shared with a more general notion, which is why I
avoid it.
2
a b
e
D= 1 c 3 4
g
f
d .
2
a
e
c
1 3 4
V, { a, c, e} , ψ |{ a,c,e} = .
2
3
4
5
)
−
→
Note that this digraph C n is a directed analogue of the cycle graph Cn . As
we recall from Example 5.4.4, the cycle graph Cn has n spanning trees.
−
→
In contrast, the digraph C n has only one spanning arborescence rooted
−
→
from 1. This spanning arborescence is the subdigraph of C n obtained by
removing the arc n1.
An introduction to graph theory, version August 2, 2023 page 200
−
→
Proof. If we remove the arc n1 from C n , then we obtain the simple digraph E
with vertices 1, 2, . . . , n and arcs 12, 23, . . . , (n − 1) n. This digraph E is easily
seen to be an arborescence rooted from 1 (indeed, 1 is a from-root of E, and the
underlying undirected graph Eund = Pn has no cycles). Thus, E is a spanning
−
→
arborescence of C n rooted from 1.
We shall now prove that it is the only such arborescence. Indeed, let F be
−
→
any spanning arborescence of C n rooted from 1. Then, 1 is a from-root of
F. Hence, for each vertex v ∈ {2, 3, . . . , n}, the digraph F must have a path
from 1 to v, and thus must contain an arc with target v (namely, the last arc
−
→
of this path). This arc must be (v − 1, v) (since this is the only arc of C n with
target v). Thus, for each vertex v ∈ {2, 3, . . . , n}, the digraph F must contain
the arc (v − 1, v). In other words, the digraph F must contain all n − 1 arcs
−→
12, 23, . . . , (n − 1) n. If F were to also contain the remaining arc n1 of C n ,
then the underlying undirected graph Fund = Cn would contain a cycle, which
would contradict F being an arborescence. Hence, F cannot contain the arc n1.
Thus, F contains the n − 1 arcs 12, 23, . . . , (n − 1) n and no others. In other
−
→
words, F = E. This shows that any spanning arborescence of C n rooted from
−
→
1 must be E. In other words, E is the only spanning arborescence of C n rooted
from 1. This completes the proof of Example 5.8.6.
The “BEST” in the name of this theorem is an abbreviation for de Bruijn, van
Aardenne–Ehrenfest, Smith and Tutte, who discovered it in the middle of the
20th century45 . 46
45 More precisely, van Aardenne–Ehrenfest and de Bruijn discovered it in 1951 (see [VanEhr51,
§6]) generalizing an earlier result of Smith and Tutte.
46 We note that the number of Eulerian circuits of D whose last arc is a is precisely the number
An introduction to graph theory, version August 2, 2023 page 201
Clearly, Definition 5.6.1 and Definition 5.10.1 differ only in the direction of
the arcs. In other words, if we reverse each arc of our digraph (turning its
source into its target and vice versa), then a from-root becomes a to-root, and
an arborescence rooted from r becomes an arborescence rooted to r, and vice
versa. Thus, every property that we have proved for arborescences rooted from
r can be translated into the language of arborescences rooted to r by reversing
all arcs.
If you want to see this stated more rigorously, here is a formal definition of “revers-
ing each arc”:
Definition 5.10.2. Let D = (V, A, ψ) be a multidigraph. Then, Drev shall denote the
multidigraph (V, A, τ ◦ ψ), where τ : V × V → V × V is the map that sends each
pair (s, t) to (t, s). Thus, if an arc a of D has source s and target t, then it is also an
arc of Drev , but in this digraph Drev it has source t and target s.
The multidigraph Drev is called the reversal of the multidigraph D; we say that it
is obtained from D by “reversing each arc”.
Note that when we reverse each arc in a digraph D, the outdegrees of its
vertices become their indegrees and vice versa. Hence, a balanced digraph D
remains balanced when this happens. In particular, the BEST theorem (Theo-
rem 5.9.1) thus gets translated as follows:
We will soon prove Theorem 5.10.4, and then derive Theorem 5.9.1 from it by
reversing the arcs.
First, however, let us state the analogue of the Arborescence Equivalence
Theorem (Theorem 5.6.5) for “arborescences rooted to r” (as opposed to “ar-
borescences rooted from r”):
• Statement A’5: If we remove any arc from D, then the vertex r will no
longer be a to-root of the resulting multidigraph.
Proof. Upon reversing all arcs of D, this turns into the original Arborescence
Equivalence Theorem (Theorem 5.6.5).
An introduction to graph theory, version August 2, 2023 page 203
Claim 1: This set Exit e (or, more precisely, the spanning subdigraph
(V, Exit e, ψ |Exit e )) is a spanning arborescence of D rooted to r.
Let’s assume for the moment that Claim 1 is proven. Thus, given any a-
Eulerian circuit e, we have constructed a spanning arborescence of D rooted to
r.
How many a-Eulerian circuits e lead to a given arborescence in this way?
The answer is rather nice:
k f
c j 1
h l
e
4
d
5 i
(1, a, 2, b, 3, c, 4, d, 5, e, 1, f , 3, g, 3, h, 5, i, 5, j, 2, k, 4, l, 1)
(we have deliberately named the arcs in such a way that they appear on an
Eulerian circuit in alphabetic order). Then,
k
j 1
h l
[Proof of Claim 1: The set Exit e contains exactly one outgoing arc (namely,
e (u)) from each vertex u ∈ V \ {r }, and no outgoing arc from r. Thus, |Exit e| =
|V | − 1.
Let us number the arcs of e as a1 , a2 , . . . , am , in the order in which they appear
in e. (Thus, a1 = a, since the first arc of e is a.)
Recall that the arcs in Exit e are the arcs e (u) for all u ∈ V \ {r } (defined as
above – i.e., the arc e (u) is the last exit of e from u). We shall refer to these arcs
as the last-exit arcs.
For each u ∈ V \ {r }, we let j (u) be the unique number i ∈ {1, 2, . . . , m} such
that e (u) = ai . (This i indeed exists and is unique, since each arc of D appears
exactly once on e.) Thus, j (u) tells us how late in the Eulerian circuit e the arc
e (u) appears. Since e (u) is the last exit of e from u, the Eulerian circuit e never
visits the vertex u again after this.
Thus, if a last-exit arc e (u) has target v 6= r, then
j ( u) < j ( v ) (21)
(because the arc e (u) leads the circuit e into the vertex v, which the circuit then
has to exit at least once; therefore, the corresponding last-exit arc e (v) has to
appear later in e than the arc e (u)).
An introduction to graph theory, version August 2, 2023 page 206
We shall now show that r is a to-root of Exit e (that is, of the spanning subdi-
graph (V, Exit e, ψ |Exit e )). To this purpose, we must show that for each vertex
v ∈ V, there is a path from v to r in the digraph (V, Exit e, ψ |Exit e ).
Indeed, let v ∈ V be any vertex. We must find a path from v to r in the
digraph (V, Exit e, ψ |Exit e ). It will suffice to find a walk from v to r in this
digraph (by Corollary 4.5.8). In other words, we must find a way to walk from
v to r in D using last-exit arcs only.
So we start walking at v. If v = r, then we are already done. Otherwise, we
have v ∈ V \ {r }, so that the arc e (v) and the number j (v) are well-defined.
We thus take the arc e (v). This brings us to a vertex v′ (namely, the target of
e (v)) that satisfies j (v) < j (v′ ) (by (21)). If this vertex v′ is r, then we are done.
If not, then e (v′ ) and j (v′ ) are well-defined, so we continue our walk by taking
the arc e (v′ ). This brings us to a further vertex v′′ (namely, the target of e (v′ ))
that satisfies j (v′ ) < j (v′′ ) (by (21)). If this vertex v′′ is r, then we are done.
Otherwise, we proceed as before. We thus construct a walk
v, e (v) , v′ , e v′ , v′′ , e v′′ , . . .
deg+
B r = 0, and deg+
B v = 1 for all v ∈ V \ {r }
(where deg+ B v means the outdegree of a vertex in the digraph (V, B, ψ | B )).
In other words, there is no B-arc with source r; however, for each vertex u ∈
V \ {r }, there is exactly one B-arc with source u.
Now, we are trying to count the a-Eulerian circuits e such that Exit e = B.
An introduction to graph theory, version August 2, 2023 page 207
2
b
g 3 a
k f
c j 1
h l
e
4
d 5 i
,
and let r = 1 and a = a (we called it a on purpose). Let B be the set { d, e, h, k},
regarded as a spanning subdigraph of D. (The arcs of B are drawn bold and
in red in the above picture.)
The turtle starts at r = 1 and walks along the arc a. This leads it to the
vertex 2. It now must choose between the arcs b and k, but since it must not
use the B-arc k unless it has to, it is actually forced to take the arc b next.
This brings it to the vertex 3. It now has to choose between the arcs c, g and
h, but again the arc h is disallowed because it is not yet time to use a B-arc.
Let us say that it takes the arc g. This brings it back to the vertex 3. Next, the
turtle must walk along c (since g is already used, while the B-arc still must
An introduction to graph theory, version August 2, 2023 page 208
wait until it is the only option). This brings it to the vertex 4. Its next step is
to take the arc l to the vertex 1. From there, it follows the arc f to the vertex
3. Now, it can finally take the B-arc h, since all the other outgoing arcs from
3 have already been used. This brings it to the vertex 5. Now it has a choice
between the arcs e, i and j, but the arc e is disallowed because it is a B-arc.
Let us say it decides to use the arc j. This brings it to the vertex 2. From
there, it takes the B-arc k to the vertex 4 (since it has no other options). From
there, it continues along the B-arc d to the vertex 5. Now, it has to traverse
the loop i, and then leave 5 along the B-arc e to come back to 1. At this point,
the turtle is stuck, since it has nowhere left to go. The walk w we obtained is
thus
w = (1, a, 2, b, 3, g, 3, c, 4, l, 1, f , 3, h, 5, j, 2, k, 4, d, 5, i, 5, e, 1) .
(Of course, other choices would have led to other walks.)
Returning to the general case, let us analyze the walk w traversed by the
turtle.
Thus, we have shown that all vertices of D are exhausted. In other words,
the turtle has used all arcs of D. In other words, the trail w contains all arcs of
D. Since w is a trail and a closed walk, this entails that w is an Eulerian circuit
of D. Since w starts with r and a, this shows further that w is an a-Eulerian
circuit. Since the turtle only used B-arcs as a last resort (and it used each B-arc
eventually, because w is Eulerian), we have Exit w = B.
Thus, the turtle’s walk has produced an a-Eulerian circuit e satisfying Exit e =
B (namely, the walk w). However, this circuit depends on some decisions the
turtle made during its walk. Namely, every time the turtle was at some vertex
u ∈ V, it had to decide which arc to take next; this arc had to be an unused arc
with source u, subject to the conditions that
Let us count how many options the turtle has had in total. To make the
argument clearer, we modify the procedure somewhat: Instead of deciding ad-
hoc which arc to take, the turtle should now make all these decisions before
embarking on its journey. To do so, it chooses, for each vertex u ∈ V, a total
order on the set of all arcs with source u, such that
where each asterisk stands for some B-arc (not the same one, of course). This is a closed
walk of the digraph (V, B, ψ | B ). Since this closed walk has length > 0, it cannot be a path;
therefore, it contains a cycle (by Proposition 4.5.9). Thus, we have found a cycle of the
digraph (V, B, ψ | B ). However, the digraph (V, B, ψ | B ) is an arborescence, and thus has no
cycles (because if D is an arborescence, then any cycle of D would be a cycle of Dund ; but
the multigraph Dund has no cycles by the definition of an arborescence). The previous two
sentences contradict each other. This shows that our assumption was wrong, and our proof
is finished.
48 We say “the B-arc”, because there is exactly one B-arc with source u.
An introduction to graph theory, version August 2, 2023 page 211
between two sets such that each element of Y has exactly m preimages under f .
51 The multijection principle is a basic counting principle that says the following: Let X and Y
be two finite sets, and let m ∈ N. Let f : X → Y be an m-to-1 correspondence (i.e., a map
such that each element of Y has exactly m preimages under f ). Then, | X | = m · |Y |.
For example, n (intact) sheep have 4n legs in total, since the map that sends each leg to
its sheep is a 4-to-1 correspondence.
52 The symbol “#” means “number”.
An introduction to graph theory, version August 2, 2023 page 212
Proof of Corollary 5.12.1. WLOG assume that |V | > 1 (else, the claim is obvious).
If there is a vertex v ∈ V with deg+ v = 0, then this vertex v satisfies deg− v = 0
as well (since the balancedness of D entails deg− v = deg+ v = 0), and therefore
D has no spanning arborescences at all (since any spanning arborescence would
have an arc with source or target v). Thus, we WLOG assume that deg+ v > 0
for all v ∈ V. In other words, each vertex has outdegree > 0.
Let r and s be two vertices of D. We must prove that τ ( D, r ) = τ ( D, s).
Pick an arc a with source r. (This exists, since deg+ r > 0.) Pick an arc b with
source s. (This exists, since deg+ s > 0.)
Applying the BEST’ theorem (Theorem 5.10.4), we get
ε ( D, a) = τ ( D, r ) · ∏ deg+ u − 1 ! and similarly
u ∈V
ε ( D, b) = τ ( D, s) · ∏ deg+ u − 1 !.
u ∈V
B := { e | (e, i ) ∈ B} .
(Recall that we are identifying spanning arborescences with their arc sets, so
that “(e, i ) ∈ B” means “(e, i ) is an arc of B”.)
Then:
is a bijection.
An introduction to graph theory, version August 2, 2023 page 214
Example 5.13.2. Here is a multigraph G (on the left) with the corresponding
multidigraph Gbidir (on the right):
5 5
3 4 3 4
2 1 2 1
G Gbidir
5 5
3 4 3 4
2 1 2 1
B B
(here, the arcs of Gbidir that don’t belong to B, as well as the edges of G that
don’t belong to B, have been drawn as dotted arrows). It is fairly easy to see
how B can be reconstructed from B: You just need to replace each edge of B
by the appropriately directed arc (namely, the one that is “directed towards
1”).
no longer dealing with trees in isolation, but rather with spanning trees of G).
(a) Let B be a spanning arborescence of Gbidir rooted to r. Then, Bund is a tree
(by the implication A’1=⇒A’3 in Theorem 5.10.5). However, it is easy to see
that Bund ∼= B as multigraphs (indeed, each vertex v of Bund corresponds to the
same vertex v of B, whereas any edge (e, i ) of Bund corresponds to the edge e
of B) 53 . Thus, B is a tree (since Bund is a tree)54 , therefore a spanning tree of
G (since B is clearly a spanning subgraph of G). This proves Proposition 5.13.1
(a).
(b) We must prove that this map is surjective and injective.
Surjectivity: Let T be a spanning tree of G. Then, the multidigraph T r→
(defined in Definition 5.7.4) is an arborescence rooted from r (by Lemma 5.7.7).
Reversing each arc in this arborescence T r→ , we obtain a new multidigraph
T r← , which is thus an arborescence rooted to r. Unfortunately, T r← is not a
subdigraph of Gbidir , for a rather stupid reason: The arcs of T r← are elements
of E, whereas the arcs of Gbidir are pairs of the form (e, i ) with e ∈ E and
i ∈ {1, 2}.
Fortunately, this is easily fixed: For each arc e of T r← , we let e′ be the arc
(e, i ) of Gbidir that has the same source as e (and thus the same target as e). This
is uniquely determined, since the arcs (e, 1) and (e, 2) of Gbidir have different
sources55 . If we replace each arc e of T r← by the corresponding arc e′ of Gbidir ,
then we obtain a spanning subdigraph S of Gbidir that is an arborescence rooted
to r (since T r← is an arborescence rooted to r, and we have only replaced its
arcs by equivalent ones with the same sources and the same targets). In other
words, we obtain a spanning arborescence S of Gbidir rooted to r. It is easy to
see that S = T. Hence, the map
n o
bidir
spanning arborescences of G rooted to r → {spanning trees of G } ,
B 7→ B
53 Here we need to use the fact that for each edge e of B, exactly one of the two pairs (e, 1) and
(e, 2) is an edge of Bund . But this is easy to check: At least one of the two pairs (e, 1) and
(e, 2) must be an arc of B (since e is an edge of B). In other words, at least one of the two
pairs (e, 1) and (e, 2) must be an edge of Bund . But both of these pairs cannot be edges of
Bund at the same time (since this would create a cycle, but Bund is a tree and thus has no
cycles). Hence, exactly one of these pairs is an edge of Bund , qed.
54 Alternatively, you can prove this as follows: The vertex r is a to-root of B (since B is an
arborescence rooted to r). Thus, for each v ∈ V, there is a path from v to r in B. By “project-
ing” this path onto B (that is, replacing each arc (e, i ) of this path by the corresponding edge
e of B), we obtain a path from v to r in B. This shows that the multigraph B is connected.
Furthermore, the definition of B shows that B ≤ | B| = |V | − 1 (by Statement A’2 in The-
orem 5.10.5, since B is an arborescence rooted to r). Hence, B < |V |. Thus, we can apply
the implication T5=⇒T1 of the Tree Equivalence Theorem (Theorem 5.2.4) to conclude that
B is a tree.
55 Proof. The edge e of T is not a loop (because T is a tree, but a tree cannot have any loops).
Hence, its two endpoints are distinct. Thus, the arcs (e, 1) and (e, 2) of Gbidir have different
sources (since their sources are the two endpoints of e).
An introduction to graph theory, version August 2, 2023 page 216
sends S to T. This shows that T is a value of this map. Since we have proved this
for every spanning tree T of G, we have thus shown that this map is surjective.
Injectivity: The main idea is that, in order to recover a spanning arborescence
B back from the corresponding spanning tree B, we just need to “orient the
edges of the tree towards r”. Here are the (annoyingly long) details:
Let B and C be two sparbs56 such that B = C. We must show that B = C.
Assume the contrary. Thus, B 6= C. Let T be the tree B = C. Thus, each edge
e of T corresponds to either an arc (e, 1) or an arc (e, 2) in B (since T = B), and
likewise for C. Conversely, each arc (e, i ) of B or of C corresponds to an edge e
of T. Hence, from B 6= C, we see that there must exist an edge e of T such that
Consider this edge e. We WLOG assume that (e, 1) ∈ B and (e, 2) ∈ C (else,
we can just swap B with C). Let the arc (e, 1) of Gbidir have source s and target
t, so that (e, 2) has source t and target s. The edge e thus has endpoints s and t.
Since B is an arborescence rooted to r, the vertex r is a to-root of B. Hence,
there exists a path p from s to r in B. This path p must begin with the arc (e, 1)
57 . Projecting this path p down onto T, we obtain a path p from s to r in T. (By
the word “projecting”, we mean replacing each arc (e, i ) by the corresponding
edge e. Clearly, doing this to a path in B yields a path in T, because T = B.)
Since the path p begins with the arc (e, 1), the “projected” path p begins with
the edge e. Thus, in the tree T, the path from s to r begins with the edge e
(because this path must be the path p). As a consequence, t must be the second
vertex of this path (since the edge e has endpoints s and t), so that removing the
first edge from this path yields the path from t to r. Thus, d (t, r ) = d (s, r ) − 1,
where d denotes distance on the tree T. Hence, d (t, r ) < d (s, r ).
A similar argument (but with the roles of B and C swapped, as well as the
roles of s and t swapped, and the roles of (e, 1) and (e, 2) swapped) shows that
d (s, r ) < d (t, r ). But this contradicts d (t, r ) < d (s, r ).
This contradiction shows that our assumption was false. Thus, we have
proved that B = C.
Forget that we fixed B and C. We thus have shown that if B and C are two
sparbs such that B = C, then B = C. In other words, our map
n o
spanning arborescences of Gbidir rooted to r → {spanning trees of G } ,
B 7→ B
is injective.
We have now shown that this map is both surjective and injective. Hence, it
is a bijection. This proves Proposition 5.13.1 (b).
Example 5.14.1. There is only one spanning tree of the complete graph K1 :
1 .
1 2 .
2 2 2
1 1 1 .
3 3 3
2 2 2 2
3 1 3 1 3 1 3 1
4 4 4 4
2 2 2 2
3 1 3 1 3 1 3 1
4 4 4 4
.
2 2 2 2
3 1 3 1 3 1 3 1
4 4 4 4
2 2 2 2
3 1 3 1 3 1 3 1
4 4 4 4
5.14.2. Notations
First, we introduce a notation:
An introduction to graph theory, version August 2, 2023 page 219
For example,
a b c a b c
d e f = f d e f a b
and = .
g h
g h i 2,3 g h i ∼2,∼3
1 3
.
One thing we notice from this example is that loops do not matter at all to
the Laplacian L. Indeed, a loop with source i and target i counts once in deg+ i
and once in ai,i , but these contributions cancel out.
Here is a simple property of Laplacians:
Proof. The sum of all columns of L is the zero vector, because for each i ∈ V we
have
n n
∑ Li,j = ∑ deg+ i · [i = j] − ai,j (by the definition of L)
j =1 j =1
n n
+
= ∑ deg i · [i = j] − ∑ ai,j
j =1 j =1
| {z } | {z }
=deg+ i =deg+ i
(since only the addend (since this is counting
for j=i can be nonzero) all arcs with source i)
+ +
= deg i − deg i = 0.
In other words, we have Le = 0 for the vector e := (1, 1, . . . , 1)T . Thus, this
vector e lies in the kernel (aka nullspace) of L, and so L is singular.
(Note that we used the positivity of n here! If n = 0, then e is the zero vector,
because a vector with 0 entries is automatically the zero vector.)
some interesting information; they are “the closest the matrix has” to a nonzero
determinant. In the case of the Laplacian, they turn out to count spanning ar-
borescences:
• The determinant det ( L∼r,∼r ) is the (r, r )-th entry of the adjugate matrix
of L.
(this is the n × n-matrix whose diagonal entries are n − 1 and whose off-diagonal
entries are −1). By Proposition
5.13.1 (b) (applied to G = Kn and r = 1),
there is a bijection between spanning arborescences of Knbidir rooted to 1 and
59 Suchmatrices are perfectly fine, just somewhat unusual and hard to write down (which row
do you put on top?). See https://mathoverflow.net/questions/317105 for details.
An introduction to graph theory, version August 2, 2023 page 222
= nn −2 .
An introduction to graph theory, version August 2, 2023 page 223
• The so-called matrix determinant lemma says that for any m × m-matrix
A ∈ R m×m , any column vector u ∈ R m×1 and any row vector v ∈ R1×m ,
we have
det ( A + uv) = det A + v (adj A) u.
This helps us compute our determinant, since
n − 1 −1 · · · −1
−1 n − 1 · · · −1
.. .
. . . .
.
. . . .
−1 −1 · · · n − 1
n 0 ··· 0 −1
0 n
· · · 0 −1
= . .. .. . + . 1 1 ··· 1 .
.. . . .. .. | {z }
=v
0 0 ··· n −1
| {z } | {z }
=A =u
There are other ways as well. Either way, the result we obtain is nn−2 . Thus,
we have proved (relying on the Matrix-Tree Theorem, which we haven’t yet
proved):
In other words:
Proof. This is just Theorem 5.14.8, since the simple graphs with vertex set
{1, 2, . . . , n} that are trees are precisely the spanning trees of Kn .
There are many ways to prove Cayley’s formula (Theorem 5.14.8). I can par-
ticularly recommend the two combinatorial proofs given in [Galvin21, §2.4 and
§2.5], as well as Joyal’s proof sketched in [Leinst19]. Most textbooks on enu-
merative combinatorics give one proof or another; e.g., [Stanle18, Appendix to
Chapter 9] gives three. Cayley’s formula also appears in Aigner’s and Ziegler’s
best-of compilation of mathematical proofs [AigZie18, Chapter 33] with four
different proofs. Note that some of the sources use a matrix-tree theorem for
undirected graphs; this is a particular case of our matrix-tree theorem.61
However, in order to complete our proof, we still need to prove the Matrix-
Tree Theorem.
This lemma is precisely Exercise 4.4 (b), at least after reversing all arcs. But
let us give a self-contained proof here:
61 Onemore remark: In Corollary 5.14.9, we have counted the trees with n vertices (i.e., simple
graphs with vertex set {1, 2, . . . , n} that are trees). It sounds equally natural to count the
“unlabelled trees with n vertices”, i.e., the equivalence classes of such trees up to isomor-
phism. Unfortunately, this is one of those “messy numbers” with no good expression: the
best formula known is recursive. There is also an asymptotic formula (“Otter’s formula”,
[Otter48]): the number of equivalence classes of n-vertex trees (up to isomorphism) is
αn
≈β with α ≈ 2.955 and β ≈ 0.5349.
n5/2
An introduction to graph theory, version August 2, 2023 page 225
w = (v0 , a1 , v1 , a2 , v2 , . . . , ak , vk , b, w)
of D that starts at u (since v0 = u). Proposition 4.5.9 shows that this walk w
either is a path or contains a cycle. Hence, w is a path (since D has no cycles).
Thus, w is a path of D that starts at u. Since w is longer than p (namely, longer
by 1), this shows that p is not the longest path of D that starts at u. But this
contradicts the very definition of p.
This contradiction shows that our assumption was false. Hence, vk = r. Thus,
p is a path from u to r (since v0 = u and vk = r). Therefore, the digraph D has
a path from u to r (namely, p).
Forget that we fixed u. We thus have shown that for each vertex u of D,
the digraph D has a path from u to r. In other words, r is a to-root of D.
Furthermore, we have deg+ r = 0 (since D has no arcs with source r), and each
v ∈ V \ {r } satisfies deg+ v = 1 (since we have assumed that each vertex v ∈
V \ {r } has outdegree 1). In other words, the digraph D satisfies Statement A’6
from the dual arborescence equivalence theorem (Theorem 5.10.5). Therefore,
it satisfies Statement A’1 from that theorem as well (since all six statements A’1,
A’2, . . ., A’6 are equivalent). In other words, D is an arborescence rooted to r.
This proves Lemma 5.14.10.
1. First, we will prove it in the case when each vertex v ∈ V \ {r } has out-
degree 1. In this case, after removing all arcs with source r from D (these
arcs do not matter, since neither the submatrix D∼r,∼r nor the spanning ar-
borescences rooted to r depend on them), we have essentially two options
(subcases): either D is itself an arborescence or D has a cycle.
2. Then, we will prove the matrix-tree theorem in the slightly more general
case when each v ∈ V \ {r } has outdegree ≤ 1. This is easy, since a vertex
v ∈ V \ {r } having outdegree 0 trivializes the theorem.
62 Sucha path clearly exists, since the length-0 path (u) is a path of D that starts at u, and since
a path of D cannot have length larger than |V | − 1.
An introduction to graph theory, version August 2, 2023 page 226
3. Finally, we will prove the theorem in the general case. This is done by
strong induction on the number of arcs of D. Every time you have a
vertex v ∈ V \ {r } with outdegree > 1, you can pick such a vertex and
color the outgoing arcs from it red and blue in such a way that each color
is used at least once. Then, you can consider the subdigraph of D obtained
by removing all blue arcs (call it Dred ) and the subdigraph of D obtained
by removing all red arcs (call it Dblue ). You can then apply the induction
hypothesis to Dred and to Dblue (since each of these two subdigraphs has
fewer arcs than D), and add the results together. The good news is that
both the # of spanning arborescences rooted to r and the determinant
det ( L∼r,∼r ) “behave additively” (we will soon see what this means).
Proof. (a) Lemma 5.14.10 shows that the digraph D itself is an arborescence
rooted to r.
As a consequence, D itself is a spanning arborescence of D rooted to r.
Therefore, | A| = |V | − 1 (by Statement A’2 in the Dual Arborescence Equiv-
alence Theorem (Theorem 5.10.5)63 ). Hence, D has no spanning arborescences
other than itself (because the condition | A| = |V | − 1 would get destroyed as
soon as we remove an arc). So the only spanning arborescence of D rooted to r
is D itself. This proves Lemma 5.14.11 (a).
(b) We WLOG assume that r = n (otherwise, we can swap r with n, so that
L∼r,∼r becomes L∼n,∼n ).
Let D ′ be the digraph D with a loop added at each vertex – i.e., the multidi-
graph obtained from D by adding n extra arcs ℓ1 , ℓ2 , . . . , ℓn and letting each arc
ℓi have source i and target i.
Let Sn−1 denote the group of permutations of the set
( )
{1, 2, . . . , n − 1} = {1, 2, . . . , n} \ |{z}
n = V \ {r } .
| {z }
=V =r
(by the Leibniz formula for the determinant). We shall now study the addends
in the sum on the right hand side of this equality. Specifically, we will show that
n −1
the only addend whose product ∏ Li,σ(i ) is nonzero is the addend for σ = id.
i =1
n −1
Indeed, let σ ∈ Sn−1 be a permutation such that the product ∏ Li,σ(i ) is
i =1
nonzero. We shall prove that σ = id.
Consider an arbitrary v ∈ {1, 2, . . . , n − 1}. Then, Lv,σ(v) 6= 0 (because Lv,σ(v)
n −1
is a factor in the product ∏ Li,σ(i ) , which is nonzero). However, the definition
i =1
of L yields Lv,σ(v) = deg+ v · [v = σ (v)] − av,σ( v) . Thus,
deg+ v · [v = σ (v)] − av,σ(v) = Lv,σ( v) 6= 0.
Hence, at least one of the numbers [v = σ (v)] and av,σ( v) is nonzero. In other
words, we have v = σ (v) (this is what it means for [v = σ (v)] to be nonzero) or
the digraph D has an arc with source v and target σ (v) (because this is what it
means for av,σ(v) to be nonzero). In either case, the digraph D ′ has an arc with
source v and target σ (v) (because if v = σ (v), then one of the loops we added
to D does the trick). We can apply the same argument to σ (v) instead of v, and
obtain an arc with source σ (v) and target σ (σ (v)). Similarly, we obtain an arc
with source σ (σ (v)) and target σ (σ (σ (v))). We can continue this reasoning
indefinitely. By continuing it for n steps, we obtain a walk
2 3 n
v, ∗, σ (v) , ∗, σ (v) , ∗, σ (v) , . . . , ∗, σ (v)
in the digraph D ′ , where each asterisk means an arc (we don’t care about what
these arcs are, so we are not giving them names). This walk cannot be a path
(since it has n + 1 vertices, but D ′ has only n vertices); thus, it must contain
a cycle (by Proposition 4.5.9). All arcs of this cycle must be loops (because
otherwise, we could remove the loops from this cycle and obtain a cycle of D,
but we know that D has no cycles). In particular, its first arc is a loop. Thus, our
above walk v, ∗, σ (v) , ∗, σ2 (v) , ∗, σ3 (v) , . . . , ∗, σn (v) contains a loop (since
the arcs of the cycle come from this walk). In other words, we have σi (v) =
σi +1 (v) for some i ∈ {0, 1, . . . , n − 1}. Since σ is injective, we can apply σ−i
to both sides of this equality, and conclude that v = σ (v). In other words,
σ (v) = v.
Forget that we fixed v. We thus have shown that σ (v) = v for each v ∈
{1, 2, . . . , n − 1}. In other words, σ = id.
An introduction to graph theory, version August 2, 2023 page 228
Forget that we fixed σ. We thus have proved that σ = id for each permutation
n −1
σ ∈ Sn−1 for which the product ∏ Li,σ(i ) is nonzero. In other words, the
i =1
n −1
only permutation σ ∈ Sn−1 for which the product ∏ Li,σ(i ) is nonzero is the
i =1
permutation id.
Thus, the only nonzero addend on the right hand side of (22) is the addend
corresponding to σ = id. Hence, (22) can be simplified as follows:
n −1 n −1
det ( L∼n,∼n ) = sign (id) · ∏ Li,id(i ) = ∏ Li,id(i) .
| {z } i =1 i =1
=1
Proof. First of all, we note that an arc with source r cannot appear in any
spanning arborescence of D rooted to r (since any such arborescence satisfies
deg+ r = 0, according to Statement A’6 in the Dual Arborescence Equivalence
Theorem (Theorem 5.10.5)). Furthermore, the arcs with source r do not affect
the matrix L∼r,∼r , since they only appear in the r-th row of the matrix L (but
this r-th row is removed in L∼r,∼r ).
Hence, any arc with source r can be removed from D without disturbing
anything we currently care about. Thus, we WLOG assume that D has no arcs
with source r (else, we can just remove them from D).
We WLOG assume that r = n (otherwise, we can swap r with n, so that L∼r,∼r
becomes L∼n,∼n ).
An introduction to graph theory, version August 2, 2023 page 229
64 Namely, the −1 in the vi+1-th position of the vi -th row gets cancelled by the 1 in the vi+1-th
position of the vi+1-th row. (We are using the fact that vm = v1 here.)
65 Let me illustrate this on a representative example: Assume that the numbers
v1 , v2 , . . . , vm−1 , vm are 1, 2, . . . , m − 1, 1 (respectively). Then, the first m − 1 rows of L look
as follows:
1 −1
1 −1
1 −1
.. ..
. .
1 −1
−1 1
(where all the missing entries are zeroes). Thus, the sum of these m − 1 rows is the zero
vector. The same is therefore true of the matrix L∼r,∼r (since the first m − 1 rows of the latter
matrix are just the first m − 1 rows of L, with their r-th entries removed).
The general case is essentially the same as this example; the only difference is that the
relevant rows are in other positions.
66 Specifically, we are using the following fact: “Let M be a square matrix. If there is a certain
nonempty set of rows of M whose sum is the zero vector, then the matrix M is singular.”.
To prove this fact, we let S be this nonempty set. Choose one row from this set, and
call it the chosen row. Now, add all the other rows from this set to this one chosen row.
This operation does not change the determinant of M (since the determinant of a matrix
is unchanged when we add one row to another), but the resulting matrix has a zero row
(namely, the chosen row) and thus has determinant 0. Hence, the original matrix M must
have had determinant 0 as well. In other words, M was singular, qed.
An introduction to graph theory, version August 2, 2023 page 230
(since an arborescence cannot have a cycle); but then, the source of this arc
would have outdegree 0, and thus we could no longer find a path from this
source to r, so we would not obtain a spanning arborescence). In other words,
Let M and N be two n × n-matrices that agree in all but one row.
That is, there exists some j ∈ {1, 2, . . . , n} such that for each i 6= j,
we have
(the i-th row of M) = (the i-th row of N ) .
An introduction to graph theory, version August 2, 2023 page 231
j j
Then, we write M ≡ N, and we let M + N be the n × n-matrix that
is obtained from M by adding the j-th row of N to the j-th row of M
(while leaving all remaining rows unchanged).
a b c a b c
2
For example, if M = d e f and N = d′ e′ f ′ , then M ≡ N
g h i g h i
and
2
a b c
M + N = d + d′ e + e′ f + f ′ .
g h i
A well-known property of determinants (the multilinearity of the determi-
nant) says that if M and N are two n × n-matrices and j ∈ {1, 2, . . . , n} is a
j
number such that M ≡ N, then
j
det M + N = det M + det N.
Now, let us prove the MTT. We proceed by strong induction on the # of arcs
of D.
Induction step: Let m ∈ N. Assume (as the induction hypothesis) that the
MTT holds for all digraphs D that have < m arcs. We must now prove it for
our digraph D with m arcs.
WLOG assume that r = n (otherwise, swap r with n).
If each vertex v ∈ V \ {r } has outdegree ≤ 1, then the MTT holds by Lemma
5.14.13. Thus, we WLOG assume that some vertex v ∈ V \ {r } has outdegree
> 1. Pick such a vertex v. We color each arc with source v either red or blue,
making sure that at least one arc is red and at least one arc is blue. (We can
do this, since v has outdegree > 1.) All arcs that do not have source v remain
uncolored.
Now, let Dred be the subdigraph obtained from D by removing all blue arcs.
Then, Dred has fewer arcs than D. In other words, Dred has < m arcs. Hence,
the induction hypothesis yields that the MTT holds for Dred . That is, we have
# of spanning arborescences of Dred rooted to r = det Lred
∼r,∼r ,
c 3
b
a 1
d
Let us pick v = 3 (this is a vertex with outdegree > 1), and let us color the
arcs a and c red and the arcs b and d blue (various other options are possible).
Then, Dred and Dblue look as follows (along with their Laplacians Lred and
Lblue ):
An introduction to graph theory, version August 2, 2023 page 233
2 2
c 3 3
b
a 1 1
d
4 4
5 5
Dred Dblue
1 −1 0 0 0 1 −1 0 0 0
0 1 −1 0 0 0 1 −1 0 0
Lred = 0 0 1 −1 0 Lblue = −1 0 2 0 −1
0 0 0 1 −1 0 0 0 1 −1
−1 0 0 0 1 −1 0 0 0 1
Now, the digraphs D, Dblue and Dred differ only in the arcs with source v,
and as far as the latter arcs are concerned, the arcs of D are divided between
Dblue and Dred . Hence, by the definition of the Laplacian, we have
v v
Lred ≡ Lblue and Lred + Lblue = L.
Thus,
v v
Lred blue
∼r,∼r ≡ L∼r,∼r and Lred blue
∼r,∼r + L∼r,∼r = L∼r,∼r
(here, we have used the fact that r = n and v 6= r, so that when we remove
the r-th row and the r-th column of the matrix L, the v-th row remains the v-th
row). Hence,
v
det L
| ∼{zr,∼r
= det L red
+ L blue
= det L red
+ det L blue
} ∼r,∼r ∼r,∼r ∼r,∼r ∼r,∼r
v
= Lred blue
∼r,∼r + L ∼r,∼r
we have
(since we proved that det ( L∼r,∼r ) = det Lred blue
∼r,∼r + det L∼r,∼r ). That is, the
MTT holds for our digraph D and its vertex r. This completes the induction
step, and thus the MTT (Theorem 5.14.7) is proved.
Our above proof of Theorem 5.14.7 has followed [Stanle18, Theorem 10.4].
Other proofs can be found across the literature, e.g., in [VanEhr51, Theorem
7], in [Margol10, Theorem 2.8], in [DeLeen19, Theorem 1] and in [Holzer22,
Theorem 2.5.3]. (Some of these sources prove more general versions of the
theorem. Confusingly, each source uses different notations and works in a
slightly different setup, although most of them quickly reveal themselves to be
equivalent upon some introspection.)
The following two exercises stand at the beginning of the theory of chip-firing
and related dynamical systems on a digraph (see [CorPer18], [Klivan19] and
[JoyMel17] for much more). While the Laplacian is not mentioned in them
directly, it is implicitly involved in the definition of a “donation” (how?).
3 2
4 1
5 6
by having the vertices 4, 5, 6, 1 donate in some order (the order clearly does
not matter for the result67 ).
Note that vertices are allowed to donate multiple times (although in the
above example, this was unnecessary).]
[Hint: A donation will be called safe if its donor v (that is, the vertex cho-
sen to lose wealth) satisfies kv ≥ deg+ v, where k is the wealth distribution
just before this donation. Start by showing that if the total wealth is larger
than | A| − |V |, then at least one vertex v has wealth ≥ deg+ v (and thus can
make a safe donation). Next, show that for any given wealth distribution k,
there are only finitely many wealth distributions that can be obtained from
k by a sequence of safe donations. Finally, for any vertex v, find a rational
quantity that increases every time that a donor distinct from v makes a do-
nation. Conclude that in a sufficiently long sequence of safe donations, every
vertex must appear as a donor. But a donor of a safe donation must be out
of debt just before its safe donation, and will never go back into debt.]
Exercise 5.20. We continue with the setting and terminology of Exercise 5.19.
A clawback is an operation that transforms a wealth distribution as fol-
lows: We choose a vertex v, and we increase its wealth by its outdegree
deg+ v, and then decrease the wealth of each vertex w ∈ V (including v
itself) by av,w . (Thus, a clawback is the inverse of a donation.)
Let k be a wealth distribution on D whose total wealth is larger than | A| −
|V |. Prove that by an appropriately chosen finite sequence of clawbacks, we
can ensure that no vertex is in debt.
[Remark: Note that we are still assuming D to be strongly connected.
Otherwise, the truth of the claim is not guaranteed. For instance, for the
digraph
3 4
1 2
Proposition 5.14.15. Let n be a positive integer. Pick any arc a of the multi-
digraph Knbidir . Then, the # of Eulerian circuits of Knbidir whose first arc is a is
n n −2 · ( n − 2) ! n .
Proof. Let r be the source of the arc a. The digraph Knbidir is balanced, and each
of its vertices has outdegree n − 1. By the BEST’ theorem (Theorem 5.10.4), we
have
# of Eulerian circuits of Knbidir whose first arc is a
n
= # of spanning arborescences of Knbidir rooted to r · ∏ deg+ u −1!
| {z } u =1 | {z }
= n −1
= n n −2
(as we saw in Subsection 5.14.5 in the case when r =1,
and can similarly prove for arbitrary r)
n
n −2 n −2 n
=n · ∏ ( n − 2) ! = n · ( n − 2) ! ,
u =1
qed.
In comparison, there is no good formula known for the # of Eulerian circuits
of the undirected graph Kn . For n even, this # is 0 of course (since Kn has
vertices of odd degree in this case). For n odd, the # grows very fast, but little
else is known about it (see https://oeis.org/A135388 for some known values,
and see Exercise 5.22 for a divisibility property).
where ai,j is the # of edges of G that have endpoints i and j (with loops
counting twice). Then:
Proof. (a) Let r be a vertex of G. Then, Proposition 5.13.1 (b) shows that there is
a bijection
n o
spanning arborescences of Gbidir rooted to r → {spanning trees of G } .
An introduction to graph theory, version August 2, 2023 page 239
Imagine expanding the right hand side (using the Leibniz formula) and ex-
panding the resulting products further. For instance, the product
(t + a) t + b′ d′′ c′′′
An introduction to graph theory, version August 2, 2023 page 240
becomes ttd′′ c′′′ + tb′ d′′ c′′′ + atd′′ c′′′ + ab′ d′′ c′′′ . In the huge sum that results,
we are interested in those addends that contain exactly one t, because it is
precisely these addends that contribute to the coefficient of t1 in the polynomial
det (tIn + L). Where do these addends come from? To pick up exactly one t
from a product like (t + a) (t + b′ ) d′′ c′′′ , we need to have at least one diagonal
entry in our product (for example, we cannot pick up any t from the product
cd′ b′′ a′′′ ), and we need to pick out the t from this diagonal entry (rather than,
e.g., the a or b′ or c′′ or d′′′ ). If we pick the r-th diagonal entry, then the rest of
the product is part of the expansion of det ( L∼r,∼r ) (since we must not pick any
further ts and thus can pretend that they are not there in the first place). Thus,
n
the total t1 -coefficient in det (tIn + L) will be ∑ det ( L∼r,∼r ). This proves (23),
r =1
and thus the proof of Theorem 5.15.1 (b) is complete.
(c) Consider the polynomial det (tIn + L) introduced in part (b), and in par-
ticular its t1 -coefficient c1 .
It is known that the characteristic polynomial det (tIn − L) of L is a monic
polynomial of degree n, and that its roots are the eigenvalues λ1 , λ2 , . . . , λn of
L. Hence, it can be factored as follows:
det (tIn − L) = (t − λ1 ) (t − λ2 ) · · · (t − λn ) .
det (tIn + L) = (t + λ1 ) (t + λ2 ) · · · (t + λn )
= ( t + λ1 ) ( t + λ2 ) · · · ( t + λ n − 1 ) t (since λn = 0) .
Here, however, let us give a simpler example, in which Theorem 5.15.1 (a)
suffices:
Exercise 5.23. Let n and m be two positive integers. Let Kn,m be the simple
graph with n + m vertices
where two vertices i and j are adjacent if and only if they have opposite
signs (i.e., each positive vertex is adjacent to each negative vertex, but no two
vertices of the same sign are adjacent).
[For example, here is how K5,2 looks like:
1 2 3 4 5
−2 −1
.]
We have already computed the determinant of a matrix much like this back in
our proof of Cayley’s Formula (Subsection 5.14.5); let us deal with the general
case:
Proposition 5.15.2. Let n ∈ N. Let x and a be two numbers. Then,
x a a ··· a a
a x a ··· a a
a a x ··· a a
det . . . . = ( x + ( n − 1) a ) ( x − a ) n −1 .
.. .. .. . . .. ..
. .
a a a ··· x a
a a a ··· a x
| {z }
the n × n-matrix
whose diagonal entries are x
and whose off-diagonal entries are a
where two vertices i and j are adjacent if and only if they have opposite signs.
Then,
(# of spanning trees of Kn,m ) = mn−1 · nm−1 .
1 2 3 4 5
−2 −1
An introduction to graph theory, version August 2, 2023 page 245
′ :
And here is the corresponding graph Kn,2
1 2 3 4 5
−2 −1
Exercise 5.26. Let n be a positive integer. Let Qn be the n-hypercube graph (as
defined in Definition 2.14.7). Recall that its vertex set is the set V := {0, 1}n
of length-n bitstrings, and that two vertices are adjacent if and only if they
differ in exactly one bit. Our goal is to compute the # of spanning trees of
Qn .
Let D be the digraph Qbidir n . Let L be the Laplacian of D. We regard L as a
V × V-matrix (i.e., as a 2 × 2n -matrix whose rows and columns are indexed
n
by bitstrings in V).
We shall use the notation ai for the i-th entry of a bitstring a. Thus, each
bitstring a ∈ V has the form a = ( a1 , a2 , . . . , an ). (We shall avoid the short-
hand notation a1 a2 · · · an here, as it could be mistaken for an actual product.)
For any two bitstrings a, b ∈ V, we define the number h a, bi to be the
integer a1 b1 + a2 b2 + · · · + an bn .
An introduction to graph theory, version August 2, 2023 page 246
(d) The eigenvalues of L are 2k for k ∈ {0, 1, . . . , n}, and each eigenvalue
all
n
2k appears with multiplicity .
k
(e) The # of spanning trees of Qn is
n
1 n
2n ∏ (2k)( k ) .
k=1
101 111
001 011
100 110
Q3 = 000 010
An introduction to graph theory, version August 2, 2023 page 247
where the rows and the columns are ordered by listing the eight bitstrings
a ∈ V in the order 000, 001, 010, 011, 100, 101, 110, 111. ]
a a a ··· xn
(This is an infinite sequence of 0’s and 1’s; the spaces between some of them
are only for readability. The || : and : || symbols are “repeat signs” – they mean
that everything that stands between them should be repeated over and over. So
the sequence above is 0000 1111 0110 0101 0000 1111 . . ..)
An introduction to graph theory, version August 2, 2023 page 249
One nice property of this sequence is that if you slide a ”length-4 window”
(i.e., a window that shows four consecutive entries) along it, you get all 16
possible bitstrings of length 4 depending on the position of the window, and
these bitstrings do not repeat until you move 16 steps to the right. Just see:
0000 11110110010100001111 . . .
0 0001 1110110010100001111 . . .
00 0011 110110010100001111 . . .
000 0111 10110010100001111 . . .
0000 1111 0110010100001111 . . .
00001 1110 110010100001111 . . .
000011 1101 10010100001111 . . .
0000111 1011 0010100001111 . . .
00001111 0110 010100001111 . . .
000011110 1100 10100001111 . . .
0000111101 1001 0100001111 . . .
00001111011 0010 100001111 . . .
000011110110 0101 00001111 . . .
0000111101100 1010 0001111 . . .
00001111011001 0100 001111 . . .
000011110110010 1000 01111 . . .
Note that, as you slide the window along the sequence, at each step, the first
bit is removed and a new bit is inserted at the end. Thus, by sliding a length-4
window along the above sequence, you run through all 16 possible length-4
bitstrings in such a way that each bitstring is obtained from the previous one
by removing the first bit and inserting a new bit at the end. This is nice and
somewhat similar to Gray codes (in which you run through all bitstrings of a
given length in such a way that only a single bit is changed at each step).
Can we find such nice sequences for any window length, not just 4 ?
Here is an answer for window length 3, for instance:
|| : 000 111 01 : || .
What about higher window length?
Moreover, we can ask the same question with other alphabets. For instance,
instead of bits, here is a similar sequence for the alphabet {0, 1, 2} (that is, we
use the numbers 0, 1, 2 instead of 0 and 1) and window length 2:
|| : 00 11 22 02 1 : || .
An introduction to graph theory, version August 2, 2023 page 250
( a1 , a2 , . . . , a n ) = ( c r , c r + 1 , . . . , c r + n − 1 ) .
Here, the indices under the letter “c” are understood to be periodic modulo
kn ; that is, we set cq+kn = cq for each q ∈ Z (so that ckn = c0 and ckn +1 = c1
and so on).
(0, 0, 1, 1, 2, 2, 0, 2, 1)
ψ ( a1 , a2 , . . . , an ) = (( a1 , a2 , . . . , an−1 ) , ( a2 , a3 , . . . , an )) .
Thus, the vertices of D are the (n − 1)-tuples (not the n-tuples!) of elements
of K, whereas the arcs are the n-tuples of elements of K, and each such arc
( a1 , a2 , . . . , an ) has source ( a1 , a2 , . . . , an−1 ) and target ( a2 , a3 , . . . , an ). Hence,
there is an arc from each (n − 1)-tuple i ∈ K n−1 to each (n − 1)-tuple j ∈ K n−1
that is obtained by dropping the first entry of i and adding a new entry at the
end. (Be careful: If n = 1, then D has only one vertex but n arcs. If this confuses
you, just do the n = 1 case by hand. For any n > 1, there are no parallel arcs in
D.)
Example 5.16.3. For example, if n = 3 and k = 2 and K = {0, 1}, then D
looks as follows (we again write our tuples without commas and without
parentheses):
101 01
10 010
001
100
110 00
011
000
11 111
i = ( i1 , i2 , . . . , i n −1 )
→ (i2 , i3 , . . . , in−1, j1 )
→ (i3 , i4 , . . . , in−1, j1 , j2 )
→ ···
→ (in−1 , j1 , j2 , . . . , jn−2 )
→ ( j1 , j2 , . . . , jn−1 ) = j.
Note that this walk has length n − 1, and is the unique walk from i to j
that has length n − 1. Thus, the # of walks from i to j that have length
n − 1 is 1. This will come useful further below.]
But this shows that D has an Eulerian circuit whose last arc is a.]
Now, for each i ∈ N, we let xi denote the first entry of the n-tuple pi . Then,
xq+kn = xq for all q ∈ N (since pq+kn = pq for all q ∈ N). In other words,
the sequence ( x0 , x1 , x2 , . . .) repeats itself every kn terms. Note that the kn -tuple
( x0 , x1 , . . . , xkn −1 ) consists of the first entries of the arcs p0 , p1 , . . . , pkn −1 of c (by
the definition of xi ).
For each i ∈ N and each s ∈ {1, 2, . . . , n}, we have
In other words, for each i ∈ N, the entries of pi (from first to last) are
xi , xi +1, . . . , xi +n−1. In other words, for each i ∈ N, we have
pi = ( xi , xi +1 , . . . , xi + n −1 ) . (26)
Now, recall that c is an Eulerian circuit. Thus, each arc of D appears exactly
once among its arcs p0 , p1 , . . . , pkn −1 . In other words, each n-tuple in K n appears
exactly once among p0 , p1 , . . . , pkn −1 (since the arcs of D are the n-tuples in K n ).
In other words, as i ranges from 0 to kn − 1, the n-tuple pi takes each possible
value in K n exactly once.
In view of (26), we can rewrite this as follows: As i ranges from 0 to kn − 1,
the n-tuple ( xi , xi +1, . . . , xi +n−1) takes each possible value in K n exactly once
(since this n-tuple is precisely pi , as we have shown in the previous para-
graph). In other words, for each ( a1 , a2 , . . . , an ) ∈ K n , there is a unique r ∈
{0, 1, . . . , kn − 1} such that ( a1 , a2 , . . . , an ) = ( xr , xr+1 , . . . , xr+n−1).
Hence, the kn -tuple ( x0 , x1 , . . . , xkn −1 ) is a de Bruijn sequence of order n on
K. This shows that a de Bruijn sequence exists. Theorem 5.16.2 is thus proven.
69 We have never formally defined infinite walks, but it should be fairly clear what they are.
An introduction to graph theory, version August 2, 2023 page 254
Example 5.16.4. For n = 3 and k = 2 and K = {0, 1}, one possible Eulerian
circuit c of D is
(00, 001, 01, 010, 10, 101, 01, 011, 11, 111, 11, 110, 10, 100, 00)
(where we have written the arcs in bold for readability). The first entries of
the arcs of this circuit form the sequence 0010111, which is indeed a de Bruijn
sequence of order 3 on {0, 1}. Any 3 consecutive entries of this sequence
(extended periodically to the infinite sequence || : 0010111 : ||) form the
respective arc of c.
70 Some of these sequences (the “prefer-one” and “prefer-opposite” generators) are just dis-
guised implementations of the algorithm for finding an Eulerian circuit implicit in our
proof of the BEST theorem.
71 My favorite is the one obtained by concatenating all Lyndon words whose length divides
n in lexicographically increasing order (assuming that the set K is totally ordered). See
[Moreno04] for the details of that construction.
An introduction to graph theory, version August 2, 2023 page 255
1
(# of spanning arborescences of D rooted to r ) = c1 .
n
1
(# of spanning arborescences of D rooted to r ) = · λ1 λ2 · · · λ n − 1 .
n
1
(# of Eulerian circuits of D ) = | A| · · λ1 λ2 · · · λn−1 · ∏ deg+ u − 1 !.
n u ∈V
(If you identify an Eulerian circuit with its cyclic rotations, then you
should drop the | A| factor on the right hand side.)
Proof. (a) The equality comes from the MTT (Theorem 5.14.7). It remains to
prove that the # of spanning arborescences of D rooted to r does not depend
on r. But this is Corollary 5.12.1.
(b) follows from (a) as in the undirected graph case (proof of Theorem 5.15.1
(b)).72
72 In more detail: Just as we proved in our above proof of Theorem 5.15.1 (for the undirected
An introduction to graph theory, version August 2, 2023 page 256
(c) follows from (b) as in the undirected graph case (proof of Theorem 5.15.1
(c)).
(d) Assume that all vertices of D have outdegree > 0. Then,
(# of Eulerian circuits of D )
= ∑ (# of Eulerian circuits of D whose first arc is a) .
a∈ A
Hence,
(# of Eulerian circuits of D )
= ∑ |(# of Eulerian circuits of
{z
D whose first arc is a)
}
a∈ A
1
= · λ1 λ2 ···λn−1 · ∏ (deg+ u −1)!
n u ∈V
1
= ∑ · λ1 λ2 · · · λn−1 · ∏ deg+ u − 1 !
a∈ A
n u ∈V
1
= | A| · · λ1 λ2 · · · λn−1 · ∏ deg+ u − 1 !.
n u ∈V
Now, let’s try to solve our question – i.e., let’s count the de Bruijn sequences
of order n on K.
Recall the digraph D from our above proof of Theorem 5.16.2. We constructed
a de Bruijn sequence of order n on K by finding an Eulerian circuit of D. This
actually works both ways: The map
is a bijection (make sure you understand why!). Hence, by the bijection princi-
ple, we have
(# of Eulerian circuits of D )
1
= | K n | · n−1 · λ1 λ2 · · · λkn−1 −1 · ∏ deg+ u − 1 !, (28)
k u ∈ K n −1
Also,
1 1
|Kn | · = kn · = k.
kn −1 kn −1
It remains to find λ1 λ2 · · · λkn−1 −1 . What are the eigenvalues of L ?
The Laplacian L of our digraph D is a kn−1 × kn−1 -matrix whose rows and
columns are indexed by (n − 1)-tuples in K n−1 . Strictly speaking, we should
relabel the vertices of D as 1, 2, . . . , kn−1 here, in order to have a “proper matrix”
with a well-defined order on its rows and columns. But let’s not do this; instead,
I trust you can do the relabeling yourself, or just use the more general notion
of matrices that allows for the rows and the columns to be indexed by arbitrary
things (see https://mathoverflow.net/questions/317105 for details).
Let C be the adjacency matrix of the digraph D; this is the kn−1 × kn−1 -matrix
(again with rows and columns indexed by (n − 1)-tuples in K n−1 ) whose (i, j)-
th entry is the # of arcs with source i and target j. In particular, the trace of C
is thus the # of loops of D. It is easy to see that the loops of D are precisely the
An introduction to graph theory, version August 2, 2023 page 258
L = ∆ − C, (29)
where ∆ is the diagonal matrix whose diagonal entries are the outdegrees of
the vertices of D. Since each vertex of D has outdegree k, the latter diagonal
matrix ∆ is simply k · I, where I is the identity matrix (of the appropriate size).
Hence, (29) can be rewritten as
L = k · I − C.
(The easiest way to see this is by noticing that J has rank 1 and trace kn−1 . 73 )
Cn−1 = J.
[Proof: We need to show that all entries of the matrix Cn−1 are 1. So let i and
j be two vertices of D. We must then show that the (i, j)-th entry of Cn−1 is 1.
Recall the combinatorial interpretation of the powers of an adjacency matrix
(Theorem 4.5.10): For any ℓ ∈ N, the (i, j)-th entry of Cℓ is the # of walks from
i to j (in D) that have length ℓ. Thus, in particular, the (i, j)-th entry of Cn−1
is the # of walks from i to j (in D) that have length n − 1. But this number
is actually 1, as we have already shown in our above proof of Theorem 5.16.2.
This completes the proof of Cn−1 = J.]
How does this help us compute the eigenvalues of C ? Well, let γ1 , γ2 , . . . , γkn−1
be the eigenvalues of C. Then, for any ℓ ∈ N, the eigenvalues of Cℓ are
γ1ℓ , γ2ℓ , . . . , γkℓn−1 (this is a fact that holds for any square matrix, and is probably
easiest to prove using the Jordan canonical form or triangularization). Hence, in
73 Here are the details: The matrix J has rank 1 (since all its rows are the same); thus, all but one
of its eigenvalues are 0. It remains to show that the remaining eigenvalue is kn−1 . However,
it is known that the sums of the eigenvalues of a square matrix equals its trace. Thus, if all
but one of the eigenvalues of a square matrix are 0, then the remaining eigenvalue equals
its trace. Applying this to our matrix J, we see that its remaining eigenvalue equals its trace,
which is kn−1 .
An introduction to graph theory, version August 2, 2023 page 259
particular, γ1n−1 , γ2n−1, . . . , γknn−−11 are the eigenvalues of Cn−1 = J; but we know
that the latter eigenvalues are 0, 0, . . . , 0 , kn−1 . Hence, all but one of the
| {z }
kn−1 −1 many zeroes
kn−1 numbers γ1n−1 , γ2n−1, . . . , γknn−−11 equal 0. Thus, all but one of the kn−1 num-
bers γ1 , γ2 , . . . , γkn−1 equal 0 (we don’t know what the remaining number is,
since (n − 1)-st roots are not uniquely determined in C). In other words, all but
one of the eigenvalues of C equal 0. The remaining eigenvalue must thus be
the trace of C (because the sum of the eigenvalues of a square matrix is known
to be the trace of that matrix), and therefore equal k (since we know that the
trace of C is k).
So we have shown that the eigenvalues of C are 0, 0, . . . , 0 , k. Thus, the
| {z }
kn−1 −1 many zeroes
eigenvalues of L are
k − 0, k − 0, . . . , k − 0, k − k
| {z }
kn−1 −1 many (k−0)’s
Hence, the eigenvalues λ1 , λ2 , . . . , λkn−1 −1 in (28) all equal k. Thus, (28) simpli-
fies to
(# of Eulerian circuits of D )
1
= |K n | · n−1 · kk
| · · · k} · ∏ deg+ u − 1 !
{z
| {zk } kn−1 −1 factors u∈K n−1
| {z }
n
1 k n −1
=k · =((k−1)!)
kn −1
=k
n −1 n −1 n −1
= k· kk · · · }k
| {z · ((k − 1)!)k = kk · ((k − 1)!)k
kn−1 −1 factors
| {z }
= k k n −1
k n −1
n −1
= k · ( k − 1) ! = k!k .
| {z }
= k!
In view of this, we can rewrite (27) as
n −1
(# of de Bruijn sequences of order n on K ) = k!k .
Thus, we have proved the following:
An introduction to graph theory, version August 2, 2023 page 260
Theorem 5.18.1 (or, more precisely, its weighted version, which we will see in
the next section) can be used to explicitly compute the steady state of a Markov
chain (see [KrGrWi10]); a similar interpretation, but in economical terms (emer-
gence of money in a barter economy), appears in [Sahi14, §1].
We shall give a proof of Theorem 5.18.1 based upon two lemmas. The first
lemma is a general linear-algebraic result:
Proof of Lemma 5.18.2. There are various ways to prove this, but here is probably
the most elegant one:
We WLOG assume that s 6= t, since otherwise the claim is obvious. Let us
now change the r-th row of the matrix B as follows:
Let C be the resulting n × n-matrix.74 Thus, C agrees with B in all rows other
than the r-th one. Hence, in particular,
a b c d
′ b′ c′ d′
74 For example, if n = 4 and B = a and s = 1 and t = 3 and r = 2, then
a′′ b′′ c′′ d′′
a′′′ b′′′ c′′′ d′′′
a b c d
1 0 − 1 0
C= a′′ b′′ c′′ d′′ .
Note also that the only nonzero entries in the r-th row of C are75 Cr,s = 1 and
Cr,t = −1. Hence, the entries in the r-th row of C add up to 0.
Recall that the sum of all columns of B is the zero vector. In other words,
in each row of B, the entries add up to 0. The matrix C therefore also has this
property (because the only row of C that differs from the corresponding row
of B is the r-th row; however, we have shown above that in the r-th row, the
entries of C also add up to 0). In other words, the sum of all columns of C is
the zero vector. This easily entails that det C = 0 76 .
On the other hand, Laplace expansion along the r-th row yields
n
det C = ∑ (−1)r+k Cr,k det (C∼r,∼k )
k=1
= (−1)r+s 1 det (C∼r,∼s ) + (−1)r+t (−1) det (C∼r,∼t )
(since the only nonzero entries Cr,k in the r-th row of C are Cr,s = 1 and Cr,t =
−1). Comparing this with det C = 0, we obtain
In other words, (−1)r+t det ( B∼r,∼t ) = (−1)r+s det ( B∼r,∼s ). Dividing both
sides of this by (−1)r+t , we obtain det ( B∼r,∼t ) = (−1)s−t det ( B∼r,∼s ). This
proves Lemma 5.18.2.
Our next lemma is the following generalization of Theorem 5.14.7:
75 We are using the notation Cr,k for the entry of C in the r-th row and the k-th column.
76 Proof.
It is well-known that the determinant of a matrix does not change if we add a column
to another. Hence, the determinant of C will not change if we add each column of C other
than the first one to the first column of C. However, the result of this operation will be
a matrix whose first column is 0 (since the sum of all columns of C is the zero vector),
and therefore this matrix will have determinant 0. Since the operation did not change the
determinant, we thus conclude that the determinant of C was 0. In other words, det C = 0.
An introduction to graph theory, version August 2, 2023 page 263
Note that Theorem 5.14.7 is the particular case of Theorem 5.18.3 for s = r.
Fortunately, using Lemma 5.18.2, we can easily derive the general case from the
particular:
Proof of Theorem 5.18.3. We have seen (in the proof of Proposition 5.14.6) that
the sum of all columns of the Laplacian L is the zero vector. Hence, Lemma
5.18.2 (applied to K = Q and B = L and t = r) yields
det ( L∼r,∼r ) = (−1)s−r det ( L∼r,∼s ) = (−1)r+s det ( L∼r,∼s ) .
| {z }
=(−1)r +s
78 I tried to explain this proof in more detail in the solutions to Spring 2018 Math 4707 midterm
#3 – see the proof of Theorem 0.7 in those solutions; you be the judge if I succeeded.
An introduction to graph theory, version August 2, 2023 page 265
2
β
α
D= 1 γ 3
δ , and let r = 3.
Then, D has two spanning arborescences rooted to r. One of the two has arcs
α and β (and thus has weight wα w β ); the other has arcs γ and β (and thus
has weight wγ w β ). Hence,
∑ w ( B) = wα w β + wγ w β , (32)
B is a spanning
arborescence
of D rooted to r
The weighted Laplacian Lw is
wα + wγ −wα −wγ
Lw = 0 w β −w β
−wδ 0 wδ
79 To remind: The original MTT is Theorem 5.14.7.
An introduction to graph theory, version August 2, 2023 page 266
wα + wγ −wα
Lw
∼3,∼3 = and therefore
0 wβ
det Lw
∼3,∼3 = ( wα + wγ ) w β = wα w β + wγ w β .
The right hand side of this agrees with that of (32). This confirms the
weighted MTT for our D and r.
As we already said, the weighted MTT generalizes the original MTT, because
if we take all w a ’s to be 1, we just recover the original MTT.
However, we can also go backwards: we can derive the weighted MTT from
the original MTT. Let us do this.
P ( k1 , k2 , . . . , k m ) = Q (k1 , k2 , . . . , k m ) (33)
Theorem 5.19.4 is often summarized as “in order to prove that two polynomi-
als are equal, it suffices to show that they are equal on all nonnegative integer
points” (where a “nonnegative integer point” means a point – i.e., a tuple of
inputs – whose all entries are nonnegative integers). Even shorter, one says
that “a polynomial identity (i.e., an equality between two polynomials) needs
only to be checked on nonnegative integers”. For example, if you can prove the
equality
( x + y)4 + ( x − y)4 = 2x4 + 12x2 y2 + 2y4
for all nonnegative integers x and y, then you automatically conclude that this
equality holds as a polynomial identity, and thus is true for any elements x and
y of a commutative ring.
An introduction to graph theory, version August 2, 2023 page 267
α β
D= 1 3
γ
,
80 Tobe precise, [Alon02, Lemma 2.1] is not concerned with two polynomials being identical,
but rather with one polynomial being identically zero. But this is an equivalent question:
Two polynomials P and Q are identical if and only if their difference P − Q is identically
zero.
An introduction to graph theory, version August 2, 2023 page 268
β1
α1 β2
α2
β3
γ1
D′ = 1 3
γ2
,
where α1 , α2 are the two arcs obtained from α, and so on.
Now, recall that the digraph D ′ has the same vertices as D, but each arc a
of D has turned into w a arcs of D ′ . Thus, the weighted outdegree deg+w i of
a vertex i of D equals the (usual, i.e., non-weighted) outdegree deg+ i of the
same vertex i of D ′ . Hence, the weighted Laplacian Lw of D is the (usual, i.e.,
non-weighted) Laplacian of D ′ .
Recall again that the digraph D ′ has the same vertices as D, but each arc a
of D has turned into w a arcs of D ′ . Thus, each subdigraph B of D gives rise
to w ( B) many subdigraphs of D ′ (because we can replace each arc a of B by
any of the w a many copies of this arc in D ′ ). Moreover, this correspondence
takes spanning arborescences to spanning arborescences81 , and we can obtain
any spanning arborescence of D ′ in this way from exactly one B. Hence,
∑ w ( B) = # of spanning arborescences of D ′ rooted to r .
B is a spanning
arborescence
of D rooted to r
Thus, applying the original MTT (Theorem 5.14.7) to D ′ yields the weighted
MTT for D (since the weighted Laplacian Lw of D is the (usual, i.e., non-
weighted) Laplacian of D ′ ). This completes the proof of Theorem 5.19.2.
[Remark: Alternatively, it is not hard to adapt our above proof of the original
MTT to the weighted case.]
Solution. The n-trees are just the spanning trees of the complete graph Kn .
To incorporate the deg i = di condition into our count, we use a generating
function. So let us not fix the numbers d1 , d2 , . . . , dn , but rather consider the
polynomial
deg 1 deg 2 deg n
P ( x1 , x2 , . . . , x n ) : = ∑ x1 x2 · · · xn (34)
T is a n-tree
P ( x1 , x2 , . . . , x n ) = ∑ w (T ) ,
T is an n-tree
where w ( T ) denotes the product of the weights of all edges of T. (Indeed, for
deg 1 deg 2 deg n
any subgraph T of Kn , the weight w ( T ) equals x1 x2 · · · xn , where deg i
means the degree of i in T.)
We have assigned weights to the edges of the graph Kn ; let us now assign the
same weights to the arcs of the digraph Knbidir . That is, the two arcs (ij, 1) and
(ij, 2) corresponding to an edge ij of Kn shall both have the weight
w(ij,1) = w(ij,2) = wij = xi x j . (35)
(# of spanning trees of Kn )
bidir
= # of spanning arborescences of Kn rooted to 1 .
An introduction to graph theory, version August 2, 2023 page 270
Moreover, since this bijection preserves weights (because of (35)), we also have
∑ w (T ) = ∑ w ( B) .
T is a spanning B is a spanning
tree of Kn arborescence of Knbidir
rooted to 1
In other words,
∑ w (T ) = ∑ w ( B)
T is an n-tree B is a spanning
arborescence of Knbidir
rooted to 1
= [i = j ] xi ( x1 + x2 + · · · + x n ) − xi x j
= xi [i = j ] ( x1 + x2 + · · · + x n ) − x j .
We can find its minor det Lw ∼1,∼1 without too much trouble (e.g., using row
transformations similar to the ones we have done back in the proof of Cayley’s
formula82 ); the result is
n −2
det Lw ∼1,∼1 = x1 x2 · · · xn ( x1 + x2 + · · · + xn ) .
82 The first step, of course, is to factor an xi out of the i-th row for each i.
An introduction to graph theory, version August 2, 2023 page 271
P ( x1 , x2 , . . . , x n ) = ∑ w (T ) = ∑ w ( B)
T is an n-tree B is a spanning
arborescence of Knbidir
rooted to 1
= det Lw
∼1,∼1 (by the weighted Matrix-Tree Theorem)
= x1 x2 · · · x n ( x1 + x2 + · · · + x n ) n −2 . (36)
d
As we recall, we are looking for the x11 x2d2 · · · xndn -coefficient in this polynomial.
From (36), we see that
d1 d2 dn
the x1 x2 · · · xn -coefficient of P ( x1 , x2 , . . . , xn )
= the x1d1 x2d2 · · · xndn -coefficient of x1 x2 · · · xn ( x1 + x2 + · · · + xn )n−2
= the x1d1 −1 x2d2 −1 · · · xndn −1 -coefficient of ( x1 + x2 + · · · + xn )n−2
(it does not matter whether we restrict the sum by the condition i1 + i2 + · · · +
k
in = k or not, since the coefficient is defined to be 0 when this
i1 , i2 , . . . , i n
condition is violated anyway). Hence,
k
i1 i2 in k
the x1 x2 · · · xn -coefficient of ( x1 + x2 + · · · + xn ) =
i1 , i2 , . . . , i n
83 See [23wd, Lecture 18, Section 4.12] for an introduction to multinomial coefficients.
An introduction to graph theory, version August 2, 2023 page 272