GraphTheory
GraphTheory
Publication date:
2014
Document Version
Publisher's PDF, also known as Version of record
Citation (APA):
Wind, D. K., & Wind, D. K. (2014). Supplementary Notes for Graph Theory 1: Including solutions for selected
weekly exercises. Technical University of Denmark.
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright
owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights.
Users may download and print one copy of any publication from the public portal for the purpose of private study or research.
You may not further distribute the material or use it for any profit-making activity or commercial gain
You may freely distribute the URL identifying the publication in the public portal
If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately
and investigate your claim.
S UPPLEMENTARY N OTES
FOR G RAPH T HEORY I
Including solutions for selected weekly exercises
First Edition
DTU Mathematics
C ONTENTS
Contents i
1 Introduction 1
2 General Theory 3
3 Shortest Paths 13
3.1 Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.1 Finding the Actual Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Number of Shortest Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.1 Weighted version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5 Spanning Trees 23
5.1 Kruskal’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.1.1 An example of Kruskal’s Algorithm . . . . . . . . . . . . . . . . . . . . . 24
5.2 Counting Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.2.1 Contraction-Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.2.2 Complete Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.2.3 The Matrix-Tree Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 27
i
ii CONTENTS
7 Benzenoids 43
7.1 Finding the Pauling Bonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8 Network Flow 47
8.1 Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2 Maximum Flows and Minimum Cuts . . . . . . . . . . . . . . . . . . . . . . . . 48
8.3 Finding a Maximum Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.4 Finding a minimum cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8.4.1 Performing the marking process . . . . . . . . . . . . . . . . . . . . . . . 51
8.4.2 Optimal and critical edges . . . . . . . . . . . . . . . . . . . . . . . . . . 52
9 Electrical Networks 53
9.1 Co-tree Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.2 Network Determinant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9.2.1 Calculating the Network Determinant . . . . . . . . . . . . . . . . . . . 54
9.3 Finding the Current Using Kirchhoff’s Rule . . . . . . . . . . . . . . . . . . . . . 55
9.3.1 Rk -trees and their Sign . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.3.2 Example of How to Use Kirchhoff’s Rule . . . . . . . . . . . . . . . . . . 56
9.4 Finding the driving point resistance between two vertices . . . . . . . . . . . . . 58
9.5 Random Walks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
9.5.1 Computing Node Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Appendices 61
A Weekly Exercises 63
A.1 Week 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
A.2 Week 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
A.3 Week 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
A.4 Week 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
A.5 Week 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
A.6 Week 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
A.7 Week 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
A.8 Week 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
A.9 Week 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
A.10 Week 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
A.11 Week 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
A.12 Week 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
A.13 Week 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Index 125
1
I NTRODUCTION
These notes are written for the course 01227 Graph Theory at the Technical University of
Denmark, taught by Professor Carsten Thomassen. The notes are meant solely as a supplement
to the course curriculum and can under no circumstances replace the weekly lectures or group
exercises. The focus is on applications and the aim is to improve the problem solving skills
of the students through numerous well-explained examples. Consequently proofs are only
given exceptionally, but this does not diminish the importance of understanding the proofs. A
major part of the course concerns proving theorems. In that connection the lectures provide an
essential resource of insight and we urge each and every student to participate.
The authors of this document take absolutely no responsibility for the usage of its contents. It
is very likely that there are errors in the material. If you have found an error, have a better
solution for something or wish to contribute in some constructive way please send a message to
[email protected].
Solutions for selected weekly exercises are included in the appendices. It is important that you
try hard to solve the exercises on your own. Use the solutions only as a last resort.
We thank the following people for their contributions to these notes: Christine Lindeblad, Tanja
Søndergaard, Søren Vind, Anders Schlichtkrull and Helge Munk Jacobsen.
1
2
G ENERAL T HEORY
Most graphs can be viewed as some dots on paper, with some lines joining them, but we want
to take a more formal approach. A graph G can be defined as a pair (V, E), where V is a set of
vertices, and E is a set of edges. E ⊆ V 2 , meaning that an edge e ∈ E is a 2-element subset
{vi , vj } of V . So an edge is just defined by the vertices at its ends. When talking about the
vertex set or edge set of a graph G, the sets will be denoted V (G) and E(G), and the size of the
sets v(G) and e(G). Normally when illustrated, a graph is depicted in diagram-form as a set of
dots for the vertices, joined by lines or curves for the edges. The geometric positioning of the
vertices does not matter. Figure 2.1 shows an example of a graph.
v1 v2
v3
v4 v5
Figure 2.1: A graph with the vertex set V = {v1 , v2 , v3 , v4 , v5 } and edge set E =
{{v1 , v3 }, {v1 , v4 }, {v3 , v4 }, {v3 , v5 }, {v4 , v5 }}. In this graph, the vertex v2 is completely
isolated from the other vertices.
Directed Edges Until now, an edge e = {vi , vj } did not point in any particular direction, but
extending our definition we can allow an edge to have a direction. We denote a directed edge e
as a pair of vertices (vi , vj ) instead of a set {vi , vj } of vertices. In an embedding, the edges are
drawn with an arrow showing their direction.
3
4 2. GENERAL THEORY
v1 v2
v3
v4 v5
Figure 2.2: A directed graph with the vertex set V = {v1 , v2 , v3 , v4 , v5 } and edge set E =
{(v3 , v1 ), (v3 , v4 ), (v5 , v3 ), (v4 , v5 ), (v4 , v1 )}.
A graph with directed edges is called a directed graph, or a digraph. Figure 2.2 shows an
example of a directed graph.
Multigraph Usually, we do not allow two vertices to be connected by more than one edge,
but if we allow this, the resulting graph is called a multigraph. Figure 2.3 shows an example of
a multigraph.
v1
v2 v4
v3
Walks and Paths A walk P is a graph with the vertex set V = {v1 , v2 , . . . , vk }, and with an
edge set of the form E = {(v1 , v2 ), (v2 , v3 ), . . . , (vk−1 , vk )}. We will normally denote a walk
the vertices in the order they appear on the path, e.g. P = v1 v2 . . . vk . If a walk contains no
repeated vertices, it is called a path.
v2 v2
v1 v1
v3 v4 v3 v4
v5 v6 v5 v6
(a) A path in a graph (marked in bold). (b) The same path isolated from the graph.
Neighbour For a vertex v, we define the neighbors N (v) of v as the verticies joined to v by an
edge.
The minimum degree in a graph G is denoted δ(G) and the maximum degree is denoted ∆(G).
In Figure 2.1 the minimum degree is 0 and the maximum degree is 3.
Theorem 2.1 The sum of all degrees in a graph G is equal to twice the number of edges
X
d(v) = 2e(G)
v∈V (G)
Degree Sequence For a graph G, we define its degree sequence as the sequence of vertex de-
grees d(v1 ), d(v2 ), . . . , d(vn ). Sometimes we present the degree sequence sorted. See Figure 2.5
for an example.
v5 v6
v1 v2 v3 v4
Theorem 2.3 A sequence is the degree sequence of a graph with multiple loops allowed, if
and only if the number of odd numbers in the sequence is even.
Theorem 2.4 A sequence is the degree sequence of a graph with multiple edges (but no
loops) allowed, if and only if the number of odd numbers in the sequence is even and, in
addition, the largest number in the sequence is less than or equal to the sum of the others.
v2 v2
v1 v1
v3 v4 v4
v5 v6 v5 v6
(a) A cycle in a graph (marked in bold). (b) The same cycle isolated from the graph.
Trees and Forests A connected graph containing no cycles is called a tree. A graph consisting
of multiple disjoint trees is called a forest. See Figure 2.7 for an example.
A tree on n vertices has exactly n − 1 edges, and any two vertices in a tree are connected by
a unique simple path. Consequently, adding an edge between any two vertices in a tree will
create a unique cycle.
Trees are widely used in many situations and lots of results have been proven for trees. A special
kind of trees are spanning trees introduced in Chapter 5.
Complete Graph A complete graph is a graph in which every pair of distinct vertices is
connected by an edge. We denote the complete graph on n vertices as Kn . Figure 2.8 shows an
example of complete graphs.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 7
Theorem 2.6 Kn where n ≥ 5 can not be drawn in the plane without edges crossing.
Empty Graph An empty graph, is a graph on n vertices and with no edges. The special graph
with no vertices and no edges is called the null-graph.
k-Regular Graph A k-regular graph is a graph where all vertices have degree k. 3-regular
graphs are also called cubic graphs. The Petersen Graph is an example of a cubic graph
(3-regular) .
Figure 2.9: The Petersen Graph is 3-regular (also called cubic) since all vertices have degree 3.
Figure 2.10: A bipartite graph, where the partitions are highligted by a red and a blue ellipsis.
In a more general setting, we can define a k-partite graph as a graph where you can partition
the vertices into k disjoint sets, such that there are no edges internally in a set. Determining if a
graph is k-partite for k > 2 is a hard problem.
Diameter The diameter of a graph is the longest shortest path. To find the diameter, consider
the shortest distance between all pairs of vertices u and v in G. The diameter is then the longest
of these distances. The diameter of the Petersen Graph is 2, the diameter of a path on n vertices
is n − 1 and the diameter of a n-cycle is bn/2c.
Girth The girth of a graph, is the length of a shortest cycle in the graph. If the graph contains
no cycles, the girth is defined to be infinity. For example, the Petersen Graph has girth 5 since
there are no triangles or 4-cycles in the Petersen Graph.
Figure 2.12: A graph with three connected components. Each connected component is marked with a
unique color.
Isomorphism Two graphs G and H are said to be isomorphic if there exists a bijection
between the vertex sets of the graphs. In less formal terms, this means that G and H are
isomorphic, if it is possible to draw G and H in the same way. If two graphs G and H are
isomorphic, we write G ' H. For example, the two graphs shown in Figure 2.13 are isomorphic,
even though their drawings look very different.
1 2 1 5
5 6
6 2
8 4
8 7
4 3 3 7
Figure 2.13: Two isomorphic graphs with different embeddings.
10 2. GENERAL THEORY
Planarity A graph G is said to be planar, if it is possible to draw the graph in the plane, with
no edges crossing. A planar graph drawn in the plane with no crossings, is called plane. A
drawing of a graph is also denoted an embedding.
Not all graphs are planar, and thus there exist graphs which can not be drawn in the plane
without edge-crossings.
Figure 2.15: Two graphs, which does not have a plane embedding.
In a planar graph, we define a face as a region bounded by the edges. One special face is the
outer face, which should also be counted.
f2
f1 f5 f3 f6
f4
Figure 2.16: A plane embedding of the cube. Each face is denoted by fi . Here f6 is the outer face.
In planar graphs, there is a simple formula connecting the number of vertices v(G), the number
of edges e(G) and the number of faces f (G) in a graph called Euler’s formula.
Theorem 2.9 For a planar graph G
v(G) − e(G) + f (G) = 2
Dual Graph For a plane embedding of a planar graph G, we can construct its dual graph G0
in the following way: For each face in G, create a vertex in G0 . If two faces in G are adjacent,
connect the corresponding vertices in G0 . Note that a planar graph can have different dual
graphs, depending on the plane embedding.
Figure 2.17: A graph, and its blocks. Every block is colored with its own color.
3
S HORTEST PATHS
It is not hard to find applications for shortests paths. Every day people travel and goods are
transported, and since we have limited time and money, we need to move as fast and effective
as possible. We will look at shortest paths in graphs, and most real-life situations can be
transformed into graph theory. One of the most fundamental algorithms for finding shortests
paths is Dijkstra’s Algorithm, which for a given vertex s, finds the shortest path to all other
vertices.
Given a connected weighted graph G, where w(v, u) denotes the weight of the edge vu, and
a starting vertex s, we want to find the shortest path distance from s to all other nodes in G.
Start by assigning all vertices the distance ∞, except s, which gets distance 0. We will denote
the distance from s to a vertex v by l(v). The distance assigned to a vertex is the current, best
known distance to the vertex from s. At the beginning we say that s has been visited, and that
no other vertices have been visited.
In this way, we mark a new vertex in every step. When all vertices are marked visited, the
distance l(v) at some vertex v, is the distance of the shortest path from s to v.
Directed Graph If the graph is directed, instead of considering all neighbours of u, only
consider those to which you can go directly from u.
13
14 3. SHORTEST PATHS
∞ ∞ ∞ 6 ∞ ∞
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
∞ ∞ 4 ∞
0 4 4 3 ∞ 0 4 4 3 ∞
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
∞ ∞ ∞ 3 ∞ ∞
6 ∞ ∞ 6 5 ∞
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 ∞ 4 8
0 4 4 3 ∞ 0 4 4 3 ∞
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 ∞ 3 8 ∞
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 ∞ 0 4 4 3 ∞
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 ∞ 3 8 ∞
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 11 0 4 4 3 11
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 15 3 8 11
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
This procedure, will mark a spanning tree in G, in this case, a shortest path tree. Now the
shortest path from s to a vertex v, is simply to follow the marked path from s to v.
16 3. SHORTEST PATHS
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
6 5 8 6 5 8
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 4 8
0 4 4 3 9 0 4 4 3 9
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 3 8 11
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 17
Suppose we do not just want to compute the length of a shortest path between two vertices, but
also the number of different shortest paths. For an unweighted graph, this is a simple task. Start
by running Dijkstra on the graph from some start node s, to get the distance labels on all nodes
1 2 3
1 2
0 3
1 2 3
Now the graph is partitioned into so-called distance classes. A distance class is a set of vertices,
with the same distance from the start vertex s. For example, all the vertices labeled 2 in
Figure 3.3 is in distance class 2 since they all have distance 2 to s. Now we can find the number
of shortest paths from s to a vertex v in the following way. We will let N (v) denote the number
of shortest paths from s to v.
1 2 3
1 1
1 1
1 2 3
Figure 3.3: The label of vertex v is N (v). Note that a vertex far from s does not always have a large
number of shortest paths.
This looks a lot like the algorithm for computing the distance labels in Dijkstra’s Algorithm on a
weighted graph.
If we apply this algorithm to the graph in Figure 3.4(a), we get the labeling in Figure 3.4(b).
6 5 8 3 2 2
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 8 2 2
0 4 4 3 9 1 4 4 3 2
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
3 8 11 1 1 1
(a) The distance labeling (b) The number of shortest paths labeling
Figure 3.4: A distance labelling of a weighted graph, and the number of shortest paths for each vertex in
the same graph.
4
A tour in a connected graph G is a closed walk, visiting every edge in G at least once, and
returning to the starting point.
An euler tour in a graph, is a tour visiting all edges exactly once. The problem of determining
whether or not a graph has an euler tour, was one of the founding problems of Graph Theory
considered by Euler. If a graph has an euler tour, the graph is said to be eulerian. Figure 4.1
shows an example of an eulerian graph.
It is very easy to determine if a graph is eulerian. The following theorem states a necessary and
sufficient condition, which is very easy to check.
Theorem 4.1 A graph G is eulerian, if and only if it is connected and all vertices have even
degree.
Sometimes, we might want to start and end in different vertices of the graph. A walk starting in
a vertex s, ending in vertex t, and visiting every edge in the graph exactly once, is called an
euler trail.
Theorem 4.2 A graph G has an euler trail, if and only if it is connected and exactly two of
the vertices in G have odd degree.
19
20 4. EULER TOURS AND THE CHINESE POSTMAN PROBLEM
Consider a Chinese postman, he needs to bring out the mail to every house in a big Chinese city,
so he must walk down every street. But to minimize time, he wants to find the shortest tour of
the city, visiting every edge at least once. The Chinese Postman Problem is to find such a tour.
If the city is eulerian, the shortest tour is of course an euler tour, since an euler tour visits every
edge exactly once, thus wasting no time. However, if the city is not eulerian, the postman must
traverse some edges more than once. When an edge is traversed a second time, we can think of
this as doubling the edge, and we call the new edge a waste edge. The graph consisting of waste
edges is called the waste graph W , and the graph G + W is Eulerian. Hence, by finding a waste
graph W of minimum weight, we can solve the Chinese Postman Problem.
s s
2 4 2 4
1 1 1 1
3 2 7 3 2 7
3 5 3 5
2 2 2 2 2 2
4 1 4 1
(a) The weighted graph G. (b) G where all vertices of odd de-
gree are marked.
The reason for finding the vertices of odd degree, is that we want to make the graph eulerian
by adding edges, such that the degrees of these vertices become even.
Now create an auxiliary graph consisting of the marked vertices. We will call this graph the
auxiliary Graph and denote it H. For each pair of vertices (v, w) in H, connect them by an edge
where the weight is to the distance between v and w in G. Since G is connected, H will be a
complete graph. Figure 4.2 illustrates the auxiliary graph of G.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 21
2 4
1 1
5 5 7 3 2 7
8 3 5
5 3 2 2 2
4 1
(a) The auxiliary graph H. (b) The corresponding shortest path
in G.
Figure 4.2: An edge in H corresponds to a shortest path in G. Here, an edge in H is marked, and the
corresponding path in G is also marked. The union of these graphs is a waste graph of
minimum weight.
Find a minimum perfect matching in H, that is, a perfect matching in H of lowest weight-sum.
It is always possible to create a perfect matching since H is complete and has an even number
of vertices.
2 4
1 1
1 1
33 2 7
5 5 7
3 5
8
2 2 22
5 3
4 1
1
(a) A minimum matching in H. (b) G with the edges from the matching
in W inserted.
Figure 4.3: Each edge in the minimum matching corresponds to a shortest path in G. Adding these paths
to G, causes all vertices in G to have even degree.
Let M be the minimum perfect matching found in H. As illustrated in Figure 4.3, adding
the edges of M to G (or more precisely: The corresponding paths in G), causes G to become
eulerian. And because M is minimum one can show that this method produces a waste graph of
minimum weight, thus this is the cheapest way to make G eulerian. It is important to remember
that the added edges are not in the original graph, so traversing one of them really corresponds
to traversing the edge in G twice! This is illustrated in Figure 4.4 that shows a minimum tour
in G that traverses each edge at least once.
22 4. EULER TOURS AND THE CHINESE POSTMAN PROBLEM
2 4
1 1
3 2 7
3 5
2 2 2
4 1
Figure 4.4: A minimum walk in G that traverses each edge at least once. The tour is obtained by finding
an euler tour in Figure 4.3(b). Note that there are many such tours.
S PANNING T REES
A spanning subgraph of a graph G is a subgraph H such that V (H) = V (G). A spanning tree in
a graph G = (V, E) is a spanning subgraph of G, which is a tree. We define a spanning tree
formally as follows.
Definition 5.1 A spanning tree T of a graph G = (V, E) is a graph T = (V, E 0 ) such that T
is a tree and E 0 ⊆ E.
If G is a weighted graph, T will also be a weighted graph. We define the total edge-weight of T
as the sum of the edge weights in G.
Definition 5.2 A minimum spanning tree T of G, is a spanning tree of G, such that no other
spanning tree of G has lower total edge-weight.
23
24 5. SPANNING TREES
2 3
6 2 1 6 2 1
4 4 3
3 1 6 2 7 4
5 3
Figure 5.2: A minimum spanning tree (shown in blue) having total edge-weight 18.
There are multiple practical applications of spanning trees, and especially of minimum spanning
trees. Finding a minimum spanning tree is not a hard problem, and many algorithms exist
for this task. The most commonly used is Kruskal’s Algorithm, which we describe in the next
section.
The algorithm proposed by Kruskal is a so-called Greedy Algorithm. Here greedy means that
every choice taken by the algorithm, is what seems to be the best at the given time. This
approach is often very fast, but rarely works, but luckily it does for finding a minimum spanning
tree.
When this algorithm terminates, the marked edges in G correspond to a minimum spanning
tree.
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 4 3 4 4 3
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 4 3 4 4 3
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 4 3 4 4 3
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 4 3 4 4 3
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
2 3 2 3
6 2 1 6 2 1 6 2 1 6 2 1
4 4 3 4 4 3
3 1 6 2 7 4 3 1 6 2 7 4
5 3 5 3
Figure 5.3: Blue edges are edges of the spanning tree. Green edges are the edges just inserted into the
spanning tree. Red edges are edges which are not inserted into the spanning tree since they
would create a cycle.
26 5. SPANNING TREES
The number of different spanning trees in a graph G turns out to be a very useful number
with many applications. We define this number as τ (G) and in this section, we will investigate
different methods for calculating this number. If G is itself a tree, we have that τ (G) = 1.
5.2.1 Contraction-Deletion
One way to compute the number of spanning trees, is to recursively degenerate the graph by
deleting and contracting edges. In this way, the number of spanning trees of an unknown graph
G is reduced to a sum of the number of spanning trees in small graphs which we know. The
formula for counting spanning trees is the following
τ (G) = τ (G/e) + τ (G − e)
where e is an arbitrary edge in G. G/e denotes the graph obtained by contracting e and
G − e is the graph obtained by deleting e.
τ =τ +τ
The approach is to take a graph G and then recursively remove and contract edges until you get
a lot of small graphs. Appendix D contains a catalog of spanning tree numbers for some small
graphs, and can be useful when using the Contraction-Deletion theorem.
Theorem 5.1 is due to the following observation about the number of spanning trees containing
or avoiding an edge
Theorem 5.2 The number of spanning trees in a graph G containing an edge e is equal
to the number of spanning trees in G/e. The number of spanning trees in a graph G not
containing an edge e is equal to the number of spanning trees in G − e.
There are also formulas for the number of spanning trees in a complete graph on n vertices,
where an arbitrary edge has been removed or contracted.
Let Kn and Km denote two complete graphs. Then Kn Km denotes the graph obtained by
joining Kn and Km by identifying an edge from Kn with an edge from Km , and then removing
that edge. Likewise, we define Kn ⊕ Km as the graph obtained by the same procedure, but
where the shared edge is not deleted. Figure 5.4 shows an example of graphs obtained by this
construction.
(a) K4 K5 (b) K4 ⊕ K5
Counting the spanning trees in Kn Km and Kn ⊕ Km is not that difficult, since we can
partition the spanning trees into groups, that we can count using what we already know. This
results in the following theorem.
Theorem 5.5
τ (Kn Km ) = τ (Kn − e)τ (Km /e) + τ (Kn /e)τ (Km − e) = 2(n + m − 4)nn−3 mm−3
τ (Kn ⊕ Km ) = τ (Kn /e)τ (Km /e) + τ (Kn Km ) = 2(n + m − 2)nn−3 mm−3
Degree Matrix The degree matrix D of a graph, is a diagonal matrix with the vertex degrees
in the diagonal. The graph
5 6
1 2 3 4
Adjacency Matrix The adjacency matrix A of a graph, is a (0, 1)-matrix, where 1’s represent
adjacent vertices. A has a row for each vertex, and a column for each vertex. If a vertex v is
connected to a vertex u, the entry in row v, column u is a one, and so is the entry in row u,
column v. The same graph as before has adjacency matrix:
0 1 0 0 1 0
1 0 1 0 1 1
0 1 0 1 0 1
0 0 1 0 0 1
1 1 0 0 0 1
0 1 1 1 1 0
Laplacian Matrix The Laplacian Matrix Q of a graph G is the difference between its degree
matrix D and its adjacency matrix A.
Q=D−A
Which for the above example gives
2 0 0 0 0 0 0 1 0 0 1 0 2 −1 0 0 −1 0
0 4 0 0 0 0 1 0 1 0 1 1 −1 4 −1 0 −1 −1
0 0 3 0 0 0 − 0
1 0 1 0 1= 0
−1 3 −1 0 −1
Q=
0
0 0 2 0 0 0
0 1 0 0 1 0
0 −1 2 0 −1
0 0 0 0 3 0 1 1 0 0 0 1 −1 −1 0 0 3 −1
0 0 0 0 0 4 0 1 1 1 1 0 0 −1 −1 −1 −1 4
Theorem 5.7 (Kirchoff’s Matrix-Tree Theorem) The number of spanning trees in a simple
graph G, is the absolute value of any cofactor of the Laplacian Matrix of G.
A cofactor of Q can be obtained by removing an arbitrary row, and an arbitrary column from Q
and then computing the determinant. In the example above, we could find a cofactor could be
by removing the last row and column,
2 −1 0 0 −1
−1 4 −1 0 −1
0 −1 3 −1 0
0 0 −1 2 0
−1 −1 0 0 3
and then taking the determinant
2 −1 0 0 −1
−1 4 −1 0 −1
0
τ (G) = det −1 3 −1 0 = 55
0 0 −1 2 0
−1 −1 0 0 3
6
Matchings and coverings are fundamental and important concepts in graph theory with many
applications. In this chapter we introduce the basic definitions and study some applications of
matchings and coverings.
Matching A matching in a graph G is a set of edges M ⊆ E(G), such that no two edges in M
are incident to the same vertex. The size of a matching is the number of edges in the matching.
We say that M saturates a vertex v in G if one of the edges in M is incident to v. Otherwise v is
unsaturated by M . These definitions are illustrated in Figure 6.1.
(a) Not a matching, since two of (b) A matching of size 3 saturating (c) A perfect matching saturating
the edges are incident to the the 6 red vertices. all vertices.
same vertex.
Perfect Matching A matching is called perfect if it saturates all vertices in G. A necessary (but
not sufficient) condition for a graph to have a perfect matching, is that the number of vertices is
even. Figure 6.1(c) shows an example of a perfect matching.
Maximal and Maximum Matchings If a matching M can not be extended by adding more
edges from G to M , the matching is said to be maximal. Figure 6.2(a) shows an example of
a maximal matching. A maximum matching is a matching with as many edges as possible.
Figure 6.2(b) shows a maximum matching.
29
30 6. MATCHINGS AND COVERINGS
Covering A covering in G is a set of vertices C ⊆ V (G), such that every edge in G is adjacent
to at least one vertex from C. We say that C covers all the edges of G, so removing the vertices
C from G will leave a graph with no edges. The size of a covering C is the number of vertices
in C. Figure 6.3 illustrates the definition of coverings.
(a) Not a covering, since some (b) A covering of size 6. (c) A minimum covering.
edges are uncovered.
Lemma 6.1 Let M be a matching and C a covering in a graph G. Then the number of
vertices in C is at least as big as the number of edges in M . That is,
e(M ) ≤ v(C)
This is because C must include at least one of the end-vertices x or y for every edge xy in the
matching, otherwise C would not cover the edge xy.
The above definitions give rise to two important problems. Given a graph G,
The first problem turns out to be easy, but the second is very difficult (an NP-hard problem).
Notice that if we can find a matching M and a covering C of the same size, then it follows from
Lemma 6.1 that M is a maximum matching and C is a minimum covering. This is a very useful
way to prove the optimality of a matching and a covering: Just highlight them in the graph and
observe they have the same size! See Figure 6.4 for an example.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 31
Figure 6.4: Proving the optimality of a matching and a covering in a graph. The the matching M (shown
in bold) and the covering C (shown in blue) have the same size, so by Lemma 6.1 M is a
maximum matching and C a minimum covering in G.
Unfortunately some graphs do not have a matching and a covering of the same size. This is
for instance the case for the graph in Figure 6.1. This graph has a maximum matching of size
4 (see Figure 6.1(c)), but the minimum covering is of size 5 (see Figure 6.3(c)). It is easy to
see that the matching is maximum, since it is perfect, but it takes some effort to verify that the
covering is minimum, since one has to check that no covering of size 4 exists.
In the next section we will investigate matchings and coverings in bipartite graphs and we need
not to be concerned about this issue, as it turns out that these graphs always have a minimum
covering of size equal to that of a maximum matching.
Recall that a graph G is bipartite if the vertices of G can be partitioned into two sets A and
B, such that all edges are between the two sets. As mentioned in the previous section, the
following important theorem holds for bipartite graphs.
Theorem 6.1 (Kőnig-Egerváry Theorem) In a bipartite graph G the number of edges in a
maximum matching M ∗ is equal to the number of vertices in a minimum covering C ∗ .
We will now consider how to solve the two problems stated in the previous section for bipartite
graphs. If G is bipartite, how can we find a maximum matching and a minimum covering in G?
As previously stated, finding a minimum covering is a difficult problem in general, but due to
Theorem 6.1 there is an algorithm that finds a maximum matching and a minimum covering at
the same time. This algorithm is commonly known as the Hungarian Algorithm (or Method)
due to the two Hungarian mathematicians Dénes Kőnig and Jenő Egerváry who independently
discovered Theorem 6.1 in 1931.
Figure 6.5: Illustrating the concept of M -alternating and M -augmenting paths in a bipartite graph G.
Having found an M -augmenting path such as the one shown in Figure 6.5(c), we can use it to
augment M as follows: Simply swap the matched and the unmatched edges on the path. This
operation will increase M by one edge as illustrated in Figure 6.5(d). M -augmenting paths can
be used to increase the matching in arbitrary graphs – not only bipartite ones.
The following theorem by Claude Berge states a useful connection between maximum matchings
and augmenting paths.
Notice that the theorem is not restricted to bipartite graphs – it is valid for arbitrary graphs.
The theorem suggests a natural algorithm for finding a maximum matching: Start with any
matching M in G. If M is not maximum, then there is an M -augmenting path in G, find it and
use it to increase the matching. Repeat until there is no M -augmenting path, and then M is a
maximum matching. This is the Hungarian Algorithm.
The algorithm also works for non-bipartite graphs, but in that case finding an M -augmenting
path is quite complicated. We therefore restrict our attention to bipartite graphs, since in that
case finding an M -augmenting path can be done using a simple marking procedure described
in the following section.
The marking procedure is illustrated in Figure 6.6 and Figure 6.7. The first figure shows
how the marking procedure can used on Figure 6.5(a) to find the M -augmenting path shown
in Figure 6.5(c). The second figure illustrates how the marking procedure is performed on
the increased matching, this time not finding a M -augmenting path, but instead yielding a
minimum covering.
(a) The initial match- (b) Step 1. (c) Step 2. (d) Step 3.
ing in G.
Figure 6.6: Performing the marking procedure on the matching shown in Figure 6.5(a). The marking
procedure stops after six steps having marked both unsaturated vertices on the right as
triangles. By backtracking we get the M -augmenting path shown in Figure 6.6(h). Notice
that there are many other M -augmenting paths.
34 6. MATCHINGS AND COVERINGS
(a) The new matching (b) Step 1. (c) Step 2. (d) Step 3 and a min-
in G. imum covering in
G.
Figure 6.7: Performing the marking procedure on the new matching obtained from the M -augmenting
path in Figure 6.6(h). The marking procedure stops after three steps, but no unsaturated
vertex on the right has been marked, so M is a maximum matching. The unmarked vertices
in A and the marked vertices in B constitute a covering of size 3 (shown in blue).
Figure 6.8(b) shows how to use Hall’s Theorem to conclude that no matching saturating all
vertices A exists in a graph.
b1 b1
a1 a1
b2 b2
a2 a2
b3 b3
a3 a3
b4 b4
a4 a4
b5 b5
A B A B
(a) Does this bipartite graph have a matching (b) No, because the set S = {a1 , a3 , a4 } has
that saturates all vertices in A? only 2 neighbours in B (b1 and b4 ).
From Hall’s Theorem it is possible to derive the following two corollaries about perfect matchings
in bipartite graphs. The first gives a necessary and sufficient condition for a bipartite graph to
have a perfect matching. The later only gives a sufficient condition.
Corollary 6.2 If G is k-regular (all vertices have degree k) and bipartite, then G has a
perfect matching.
6.3 Applications
In this section we study some of the applications of matchings and coverings in bipartite graphs.
The wooden board can be seen as a bipartite graph G as shown in Figure 6.8(b). Solving
the problem of cutting out as many dominoes as possible, corresponds to finding a maximum
matching in G. To do this, we use the Hungarian Algorithm. First we find a matching and
then use the marking procedure to increase it, until we have a maximum matching. When
executing the algorithm, we will use the board representation shown in Figure 6.8(a), but bear
in mind that we are actually working on the underlying bipartite graph. Figure 6.9 illustrates
the execution of the algorithm and shows that at most 18 domino pieces can be carved from
the wooden board.
36 6. MATCHINGS AND COVERINGS
4
4 4
4 4 4
4 4 4
4 4 4
4 4 4
4 4
4
(a) A matching in G. (b) Finding an an augmenting path using
the marking procedure.
4
4 4
4 4 4
4 4
4
(c) Using the augmenting path to increase (d) Performing the marking procedure to
the matching. see that no augmenting path can be
found. Hence this matching is maxi-
mum.
4 4 4 4 a1 b1
0 0 0 1 1 0 0 0 1 1
a2 b2
1 0 0 0 0 1 0 0 0 0
a3 b3
1 0 1 0 0 1 0 1 0 0
0 1 1 0 0 0 1 1 0 0 a4 b4
1 0 0 0 0 1 0 0 0 0 a5 b5
(a) A selection of 1’s which is (b) A largest possible selec- (c) The bipartite graph corre-
not largest possible. tion of entries. This in- spondng to the matrix. A maxi-
dicates that the structure mum matching is emphasized.
rank of the matrix is 4.
Figure 6.10: Here two different selections of 1-elements from a matrix is shown. The elements are
selected in such a way, that no two elements share a row or a column. The selection of
entries on the right is as large as possible, showing that the structure rank of the matrix is 4.
The marking process described in Section 6.2.1 has been performed on the matrices to show
that the left selection can be extended, and that the right selection can not.
Another way to think of the structure rank, is the following. We define a line of a matrix as a
general term for a row or a column. Now the structure rank is equal to the minimum number
of lines needed to contain all 1’s of a matrix. Such a set of lines, corresponds to a covering of
the bipartite graph corresponding to the matrix. This implies that the unmarked rows, together
with the marked colums form such a covering. In Figure 6.11 such a covering is shown on the
same matrix as in Figure 6.10. Such covering of elements in a matrix, is equivalent to an edge
covering in the corresponding bipartite graph.
4
0 0 0 1 1
1 0 0 0 0
1 0 1 0 0
0 1 1 0 0
1 0 0 0 0
Figure 6.11: When the selection of 1’s in the matrix is largest possible, the unmarked rows together with
the marked colums form a covering of the 1’s in the matrix. The number of lines in such a
covering is equal to the structure rank of the matrix, thus in this case 4.
One of the reasons to consider structure rank directly on matrices instead of working with the
corresponding bipartite graph, is that the matrix is easier to work with when the number of
vertices grows large. After performing the marking process on the matrix, it is also possible to
find an augmenting path in the corresponding graph by only considering the matrix entries, but
this is a rather tedious job.
w1 2 j1
3 2
6 1
w2 4 j2
3 4
w3 2 j3
Figure 6.12: An instance of the Job Assignment problem shown as a bipartite graph G.
j1 j2 j3
w1 2 3 6
w2 2 4 4
w3 1 3 2
Initialize Auxiliary Numbers We give every row and every column an auxiliary number.
These numbers will be a tool when we find the maximal matching. We start by giving every
column the auxiliary number 0 and every row the auxiliary number equal to the largest number
in the row as shown in Table 6.1(a).
j1 j2 j3 j1 j2 j3
w1 2 3 6 6 w1 2 3 6 6
w2 2 4 4 4 w2 2 4 4 4
w3 1 3 2 3 w3 1 3 2 3
0 0 0 0 0 0
(a) Initializing the auxiliary (b) The cells corresponding to
numbers. edges in the equality graph
L.
Table 6.1: Initializing the auxiliary numbers and identifying the edges in the equality graph.
Create Equality Graph We then create a bipartite graph L (called the equality graph) with
the workers to the left and the jobs to the right (see Figure 6.13(a)). We create an edge between
a worker-node wi and a job-node jj if and only if the number in cell (i, j) (the efficiency of
worker i on job j) is equal to the sum of the auxiliary numbers in the corresponding row and
column.
In Table 6.1(b) the underlined numbers are the ones corresponding to the edges in equality
graph. Notice that each underlined number is the sum of the auxiliary numbers in the same
column and row.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 39
w1 j1 w1 j1
6 6
w2 4 j2 w2 4 j2
4 4
3 3
w3 j3 w3 j3
(a) The equality graph L. (b) A maximal matching in the equality
graph
Figure 6.13: Creating the equality graph and finding a maximal matching in it.
Find a Matching in L We now find a maximal matching in L (see Figure 6.13(b)). We try to
create a matching with high weights since this will make the algorithm terminate faster.
As long as possible, extend the matching by using augmenting paths. At some point, the
matching is maximal (can not be increased).
Perform the Marking Procedure Perform the marking procedure that we previously used to
find an M -augmenting path. We state the procedure on the context of workers and jobs. Start
by marking all unmatched workers-nodes with squares. Then continue expanding the marking
using these two rules.
1. In every square: Follow all edges to the right and mark the neighbours as triangles.
2. In every triangle: Follow the matched edge to the left and mark the neighbour as a square.
This stops when none of the rules can be applied. The resulting graph is shown in Figure 6.14.
w1 j1
w2 4 j2
4
3
w3 j3
Figure 6.14: The final marking, when the marking process is done on Figure 6.13(b). Initially w3 is
marked as a square.
Update Auxiliary Numbers on Marked Vertices We now change the auxiliary numbers by
ε ∈ N. If ε is too large, edges will be lost and the matching will become smaller. The optimal
value of ε can be found by considering all numbers in unmarked columns and all numbers
40 6. MATCHINGS AND COVERINGS
in marked rows (i.e. the bold numbers in the left table below). For each of these numbers x
we add the corresponding row- and column auxiliary numbers and subtract x from that. The
smallest difference we get is then our value for ε. When ε is found, we change the auxiliary
numbers. For every row corresponding to a marked vertex, we lower the auxiliary number by ε,
and for every column corresponding to a marked vertex, we add ε to the auxiliary number.
We look at the bold numbers to find ε to be equal to 2 since the smallest difference is (3+0)−1 =
2 and (4 + 0) − 2 = 2.
4 4
j1 j2 j3 j1 j2 j3
w1 2 3 6 6↓ ε=2 w1 2 3 6 4
−→
w2 2 4 4 4↓ w2 2 4 4 2
w3 1 3 2 3↓ w3 1 3 2 1
0 0↑ 0↑ 0 2 2
Repeat Until the Equality Graph Has a Perfect Matching With the new auxiliary numbers
in the last table, we create a new equality graph (see Figure 6.15(a)) and repeat the procedure.
We continue to find matchings in the equality graph and change the auxiliary numbers until the
matching we find in L is perfect.
w1 j1 w1 j1
6 6
2 2
w2 4 j2 w2 4 j2
4 4
1 1
3 3
w3 j3 w3 j3
(a) The new equality graph L. (b) A maximal matching in the equality
graph
Figure 6.15: Creating the new equality graph and finding a maximal matching in it.
The matching in Figure 6.15(b) is perfect, which means that we are done. The vertices matched
together represent an optimal assignment of a workers to jobs. If L had no perfect matching,
we should repeat the marking procedure, find a new ε-value and update the auxiliary numbers.
Piece of Advice When solving this kind of exercise, there is no need to construct the equality
graphs explicitly. Instead just construct the tables and underline the cells corresponding to
edges in the equality graph. Then find a maximal matching, perform the marking process in the
table itself and finally find ε. Doing this enables you to solve these exercises much faster. For
example consider the following job assignment problem.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 41
j1 j2 j3 j4
w1 7 5 6 9
w2 8 7 7 5
w3 3 1 0 9
w4 7 5 5 9
Table 6.2: An instance of the job assignment problem.
Solving this instance by table manipulations only would begin by the steps indicated in Table 6.3.
4
7 5 6 9 9 7 5 6 9 9 7 5 6 9 9
8 7 7 5 8 8 7 7 5 8 8 7 7 5 8
→ → →
3 1 0 9 9 3 1 0 9 9 3 1 0 9 9
7 5 5 9 9 7 5 5 9 9 7 5 5 9 9
0 0 0 0 0 0 0 0 0 0 0 0
(a) Find the equality graph. (b) Find a maximal matching. (c) Perform marking procedure.
4
7 5 6 9 9↓ 7 5 6 9 7
8 7 7 5 8 ε=2 8 7 7 5 8
→ → ...
3 1 0 9 9↓ 3 1 0 9 7
7 5 5 9 9↓ 7 5 5 9 7
0 0 0 0↑ 0 0 0 2
(d) Find ε (using the bold numbers). (e) Update auxiliary numbers.
Find the new equality graph.
Table 6.3: The first iteration in solving the job assignment problem shown in Table 6.2.
By performing the above steps in the same table, a complete solution including all intermediate
calculations can be represented using only the three tables shown in Table 6.4. The total cost of
the optimal job assignment is 6 + 7 + 9 + 7 = 29.
4 4 4
7 5 6 9 9↓ 7 5 6 9 7↓ 7 5 6 9 6
8 7 7 5 8 ε=2 8 7 7 5 8↓ ε=1 8 7 7 5 7
→ →
3 1 0 9 9↓ 3 1 0 9 7↓ 3 1 0 9 6
7 5 5 9 9↓ 7 5 5 9 7↓ 7 5 5 9 6
0 0 0 0↑ 0↑ 0 0 2↑ 1 0 0 3
(a) First iteration. (b) Second iteration. (c) The optimal job assignment.
Table 6.4: Complete solution for the job assignment problem shown in Table 6.2.
7
B ENZENOIDS
H
C
H H
C C
C C
H H
C
H
Figure 7.1: Structural formula for Benzene C6 H6 .
(a) Naphthalene C10 H8 (b) Anthracene C14 H10 (c) Tetracene C18 H12
Benzenoids can also have more complicated non-linear structures as the ones shown in Fig-
ure 7.3.
43
44 7. BENZENOIDS
(a) Triphenylene C18 H12 (b) Zethrene C24 H14 (c) Dicoronylene C48 H20
Given the structure of a benzenoid B, we want to investigate the following two questions.
It turns out that both of these questions can be answered using Graph Theory. If we think of the
benzenoid B as a graph, where the carbon atoms are the vertices and the bonds are the edges,
we say that
For two neighbouring carbon atoms x and y in B, we define the Pauling Bond as follows.
Definition 7.1 The Pauling Bond of the edge xy is the number 1 + p(xy)
p(t) , where p(xy) is the
number of perfect matching in B containing the edge xy, and p(t) is the total number of
perfect matching in B.
The Pauling Bond of the edge xy turns out to be a very good approximation to the bond order
between the carbon atoms x and y.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 45
We now describe a fast method for finding the Pauling Bonds in benzenoids where the dual
graph (omitting the vertex in the exterior region) is a tree T . This is the case for all the
benzenoids in Figure 7.2 and for the first benzenoid in Figure 7.3.
1. Pick an endvertex w in T and orient all edges in T towards w. Also add an edge from w
into the exterior region.
2. Each vertex v in T is assigned two numbers a, a0 . Let B(v) be the subbenzenoid of B
consisting of only the vertices in T from which there is a directed path to v and let e
denote the edge in B(v) intersected by the outgoing edge of v. Then, these numbers are
defined as follows:
a is the number of perfect matchings in B(v) containing e.
a0 is the number of perfect matching in B(v) not containing e.
Hence a + a0 will be the total number of perfect matchings in B(v). Also notice that B(w) = B,
so we can find the total number of perfect matchings in B by computing the two numbers a
and a0 for the end-vertex w. We can do this by using the three rules shown in Figure 7.5.
b, b0
a, a0
b, b0 a, a0 b, b0 a, a0 c, c0
4, 3 7, 4 1, 1
1, 1 1, 2 3, 1 11, 7 36, 11
36, 47
Figure 7.6: Example showing how to determine the number of perfect matchings in a benzenoid.
8
N ETWORK F LOW
A flow network, or simply a network, is a directed graph N = (V, E) in which each edge e ∈ E
is assigned a number c(e), called the capacity of the edge. Figure 8.1(a) shows an example of a
network. Let s and t be two special vertices in V , called the source and the sink, respectively.
We define a flow from s to t, also called an st-flow, as a function f : E 7→ R satisfying
X X
1. For every vertex v in V \ {s, t} f (e) − f (e) = 0
e into v e out of v
The first requirement is known as Kirchhoff’s law of flow conservation, and says that for all
vertices except s and t, the sum of flow into the vertex must equal the sum of the flow out of
the vertex. The second requirement ensures that the flow along every edge is non-negative
and does not exceed the capacity of the edge. If the flow on an edge is equal to the capacity
of the edge, the edge is said to be saturated. Figure 8.1(b) shows an example of an st-flow in
a network. It is easy to verify that the flow indicated in the figure satisfies both of the above
requirements.
3 2 3,1 2,2
1 s 1,1 t
4 5 4,4 5,3
(a) Example of a network N . Each edge e (b) Example of an st-flow in N . Each edge
is labeled by its capacity c(e). e is labeled by the numbers c(e), f (e).
47
48 8. NETWORK FLOW
Intuitively, the value of an st-flow is the value of flow that originates in s and disappears in t,
i.e., the value of the flow indicated in Figure 8.1(b) is |f | = 2 + 3 = 5.
To motiviate the above definitions, suppose that the network shown in Figure 8.1(b) models
two cities s and t connected by one-way roads. The flow along an edge xy could then be the
number of cars travelling on the road between x and y in one minute. The capacity of an edge
would then be the maximum number of cars that can travel from x to y in one minute. This
number could for example depend on the number of lanes of the actual road and the speed
limit. The value of the indicated flow means that currently 5 cars arrive at t each minute. A
natural question is then: Is this the maximum number of cars that can arrive at t per minute, or
can we increase the value of the flow, if the cars travel differently? In the next sections we will
consider this problem in more detail.
A maximum st-flow is a flow f such that |f | is at least as large as the value of all other st-flows.
We denote a maximum flow in a network N as fmax (N ). The flow in Figure 8.1(b) is not a
maximum st-flow, since the st-flow indicated in Figure 8.2 has a greater value. In fact, this flow
is a maximum st-flow in N .
3,2 2,2
s 1,0 t
4,4 5,4
In Section 8.3, we describe an algorithm for finding a maximum flow in a network. Before doing
that, we will investigate a very important relationship between flows and cuts in a network. We
first introduce some necessary definitions.
An st-cut S = (A, B) in a network N is a partition of the vertices of N into two disjoint sets A
and B such that s ∈ A and t ∈ B. The cut edges of S are the edges directed from a vertex in A
to a vertex in B. An st-cut separates s from t in the following sense: If the cut edges are deleted,
it is impossible to find a path from s to t in N . Figure 8.3(a) shows an example of an st-cut.
S S
3 2 3 2
s 1 t s 1 t
4 5 B A 4 5
A B
(a) Example of an st-cut S = (A, B). The red (b) A minimum st-cut in N . The capacity of this
vertices belong to A and the green to B. The cut is c(S) = 4 + 2 = 6.
cut edges are marked in red.
Figure 8.3: Illustrating the definition of an st-cut in the network from Figure 8.1(a).
We now consider the problem of finding a minimum st-cut in a network. A naive algorithm
could go through every st-cut and find one with minimum capacity. Unfortunately, there are
2n−2 , i.e., an exponential number of st-cuts in a network with n vertices, rendering such an
algorithm useless in practice. It turns out that finding a minimum cut is closely related to
finding a maximum flow. To make this connection more precise, we need the following lemma
Lemma 8.1 Let N be a network. For any st-cut S and any st-flow f in N ,
|f | ≤ c(S) .
This lemma is not hard to show. Intuitively, one can think of an st-cut as a bottleneck of the flow,
since all the flow from s to t must pass through the cut edges. The lemma implies that if we can
find a flow f and a cut S in a network N such that |f | = c(S), then f must be a maximum flow
and S must be a minimum cut. For example, consider the flow f of value 6 in Figure 8.2 and
the cut S with capacity 6 in Figure 8.3(b). Since |f | = c(S), we can immediately conclude that
f is a maximum st-flow and S a minimum st-cut. This leads to the MaxFlow-MinCut Theorem,
which is the main theorem in the subject of Network Flow.
Theorem 8.1 (MaxFlow-MinCut Theorem) In any network N the value of a maximum
st-flow equals the capacity of a minimum st-cut.
The relationship between maximum flows and minimum cuts is very similar to that between
maximum matchings and minimum coverings, which we studied in Chapter 6. There, we learned
that not all graphs had a matching and a covering of the same size, and this is essentially
the reason why finding a minimum covering in an arbitrary graph is a very hard problem.
Fortunately, the same is not true for flows and cuts.
In the next section we consider an efficient algorithm for finding a maximum st-flow in a
network, and thanks to the MaxFlow-MinCut Theorem, the same algorithm will also be able to
find a minimum st-cut.
We can augment extra flow over an augmenting path, by increasing the flow on the forward
edges by some number δ, and decreasing the flow on the backwards edges by the same number
δ.
50 8. NETWORK FLOW
The Ford-Fulkerson Algorithm Here we describe the original algorithm proposed by Ford
and Fulkerson: To find the maximum flow in a st-network N , find an augmenting path from s
to t and augment as much flow along the path as possible. Continue doing this until the value
of the flow in N is maximal.
10,0 10,10
10,0 10,10
10,10 10,10
10,10 10,10
10,10 10,10
10,10 10,10
Figure 8.4: 3 complete iterations of the Ford-Fulkerson algorithm. Augmenting paths are marked as bold.
Another useful theorem is the following, which shows another way of determining whether a
cut is in fact minimum.
Theorem 8.4 (Menger’s Theorem) Let s and t be vertices in a directed graph G. Now we
consider the following numbers
Then a = b = c = d.
When we have found a maximum flow in a network using the algorithm of Ford-Fulkerson,
often we are also interested in finding a minimum cut. An easy way to do this, is by using a
marking process, assigning colors to the vertices.
7,5 3,3
6,6 7,6
Figure 8.5: The marking process performed on a graph with a maximum flow. The bold edges show the
augmenting paths leading to the colouring.
52 8. NETWORK FLOW
Definition 8.2 An edge e is optimal, if any reduction of its capacity reduces the value of
the maximal flow, but no increase of its capacity increases the value of the maximal flow.
Equivalently, an edge is optimal if and only if it belongs to at least one but not every minimal
cut.
To determine if an edge is critical, optimal or neither, there are some rules to follow. These
rules can be applied after the marking process has be carried out:
To find the optimal edges from white to white, we need to consider all edges xy where both x
and y are white. Now we make x red and continue the (red) labelling procedure from x. In
this way some white vertices become red. (But no green vertex changes color.) Now there are
two possibilities: Either y becomes red. In this case it is easy to see that xy cannot be in any
minimal cut. Therefore, xy is not optimal. Or else y does not become red. In this case, the
original red vertices together with the new red vertices form the left hand side of a minimal cut
which contains xy and which shows that xy is optimal.
7,5 3,3
6,6 7,6
Figure 8.6: The red edges are critical, and the green edges are optimal. The edges which are neither
critical nor optimal are black.
9
E LECTRICAL N ETWORKS
In this chapter we use graph theory to study properties of electrical networks. We consider
an electrical network as a graph N , where the edges are either resistors, current or voltage
generators. We first introduce some important definitions in Section 9.1 and Section 9.2. We
then show how to use Kirchhoff’s Rule to compute the current through any resistor in an
electrical network and how to calculate the driving point resistance between any two vertices.
Finally, in Section 9.5 we describe a remarkable connection between random walks in graphs
and electrical networks.
For an electrical network N and some spanning tree T in N , we define the co-tree product π(T )
as follows.
Definition 9.1 (Co-tree Product) Let R = {R1 , R2 , . . . , Rq } be the set of resistors in the
network N and let T be a spanning tree in N . The co-tree product of T , π(T ), is defined as
the product of the resistors not in T . That is,
Y
π(T ) = R
R∈R
R∈T
/
We will use the co-tree product to calculate different properties of electrical networks. Figure 9.1
illustrates how to calculate the co-tree product of a spanning tree.
R1
R2
R3 R4
R5
Figure 9.1: A spanning tree T with co-tree product π(T ) = R1 R3 , since these are the resistors outside of
the tree.
53
54 9. ELECTRICAL NETWORKS
For an electrical network N consisting of resistors, voltage and current generators, we define
the network determinant ∆N . The network determinant is interesting as it can be used to
reason about many properties of the network N .
Definition 9.2 (Network Determiant) Let R = {R1 , R2 , . . . , Rq } denote the set of resis-
tors, V the set of voltage generators and I the set of current generators in a network N . The
network determinant of N is defined as
X
∆N = π(T )
T
where the sum is the co-tree products of all spanning trees T in (N − I)/V, i.e. the spanning
trees of N which contain all the voltage generators V, but none of the current generators I.
Figure 9.2 shows how to calculate the network determinant using the above algorithm.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 55
R1 R1
R1
R2 R2 R2
R3 R4 R3 R4 R3 R4
R5 R5 R5
N N −I (N − I)/V
(a) A regular network. (b) Step 1: Removing all current (c) Step 2: Contracting all volt-
generators. age generators.
R1 R1 R1 R1 R1 R1 R1
R2 R2 R2 R2 R2 R2 R2
R3 R4 R3 R4 R3 R4 R3 R4 R3 R4 R3 R4 R3 R4
R5 R5 R5 R5 R5 R5 R5
R1 R2 R1 R3 R1 R5 R1 R4 R2 R3 R2 R5 R2 R4
(d) Step 3: Finding the product of the resistors outside each of the seven spanning trees in (N − I)/V. The network
determinant is the sum of these products: ∆N = R1 R2 + R1 R3 + R1 R5 + R1 R4 + R2 R3 + R2 R5 + R2 R4 =
R1 R2 + (R1 + R2 )(R3 + R4 + R5 )
Figure 9.2: Example showing how to calculate the network determinant of a regular network.
Useful Tip: If the network only contains resistors with resistance 1, the network determinant is
the number of spanning trees in (N − I)/V.
If N is a electrical network consisting of only resistors and a single generator (either voltage or
current), then we can use Kirchhoff’s Rule to find the current through any of the resistors in the
network.
Theorem 9.1 (Kirchhoff’s Rule) Let N be a network consisting only of resistors and a
single generator of value G. Then the current through the resistor Rk is
±G X
iRk = ±π(TRk )
∆N
T Rk
where sum is over all Rk -trees in N . The first ± is + if G is a current generator and − if
G is a voltage generator. The second ± is the sign of the Rk -tree TRk (refer to the section
about Rk -trees).
Definition 9.3 (Rk -tree) Let T be a spanning tree of N − G, then T is a Rk -tree if and
only if Rk is contained in the fundamental cycle created when adding G to T .
Consider a Rk -tree TRk and let C be the fundamental cycle created when adding G to TRk . If
we have fixed the direction on G and Rk in N , we will distinguish between positive and negative
Rk -trees. TRk is positive if the direction of G and Rk agrees in the fundamental cycle C, and
negative if G and Rk has opposite directions in C.
R1
R2 R3
R4 R5 R6
R7 R8
R9
Figure 9.3: A network N consisting of nine resistors and a single voltage generator.
(b) T contains R2 but not R3 . Among these trees consider first the ones that contain R5 . Their
contribution to ∆N is
9R ∈T 9 R ∈T
/
z }| { z }| {
R1 R3 R4 R6 R7 + R4 R6 R8 + R4 R7 R8 + R6 R7 R8 + R9 (R4 + R7 )(R6 + R8 ) =
R1 R3 R6 R8 (R4 + R7 ) + R4 R7 (R6 + R8 ) + R9 (R4 + R7 )(R6 + R8 ) =
R1 R3 R4 R7 (R6 + R8 ) + (R4 + R7 ) R6 R8 + R9 (R6 + R8 )
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 57
(c) T contains R3 but not R2 . Due to symmetry, this case is identical to the previous, when R3
is replaced by R2 .
Recapitulating, the network determinant is
∆N = R1 R2 R3 (R4 + R6 )(R7 + R8 ) + R9 (R4 + R6 + R7 + R8 ) +
R1 (R2 + R3 ) R4 R7 (R6 + R8 ) + (R4 + R7 ) R6 R8 + R9 (R6 + R8 ) +
R1 R5 (R4 + R6 )(R7 + R8 ) + R9 (R4 + R6 + R7 + R8 )
Calculating the co-tree products of the R7 -trees. Figure 9.4 shows the seven R7 -trees and
their contribution to the sum of co-tree products. The total sum becomes
X
±π(TR7 ) = −R1 R2 R6 (R8 + R9 ) − R9 (R3 + R5 + R8 ) − R3 (R5 R9 − R4 R8 )
TR7
V V V V
R1 R1 R1 R1
R2 R3 R2 R3 R2 R3 R2 R3
R4 R5 R6 R4 R5 R6 R4 R5 R6 R4 R5 R6
R7 R8 R7 R8 R7 R8 R7 R8
R9 R9 R9 R9
V V V
R1 R1 R1
R2 R3 R2 R3 R2 R3
R4 R5 R6 R4 R5 R6 R4 R5 R6
R7 R8 R7 R8 R7 R8
R9 R9 R9
Figure 9.4: The seven R7 -trees in N and their contribution to the sum of co-tree products.
58 9. ELECTRICAL NETWORKS
The Current in R7 . Inserting into Kirchhoff’s Rule, we find the current through R7 in the
direction indicated to be
V
iR7 = R1 R2 R6 (R8 + R9 ) − R9 (R3 + R5 + R8 ) − R3 (R5 R9 − R4 R8 ) .
∆N
This expression reveals that the direction of the current through R7 depends on the values of
the resistors. In case all resistors have value 1, then the current through R7 simply becomes
−V −V 1
iR7 = (−6 + 1) = (−5) = V .
τ (N/V ) 40 8
In a network N , we can find the driving point resistance between two vertices p and q by the
formula
∆(N/pq)
Rp,q =
∆N
where ∆(N ) is the network determinant of N .
Problem Let G be an undirected graph and let a and b be two distinct vertices of G. If a
random walk starts in some vertex c, what is the probability that the walk will reach a before
it reaches b?
Obviously, if c = a (i.e., the walk starts in a) this probability is 1 and if c = b, the probability is 0.
But for any other vertex in G it is not clear how we can determine this probability. Fortunately,
the following theorem allows us to determine this probability for any vertex in G by considering
the node voltages in an electrical network.
Theorem 9.2 The probability that a random walk starting in c reaches a before it reaches
b is equal to the node voltage of c in the electrical network obtained from G as follows:
Replace each edge in G with a 1Ω resistor and connect a 1V voltage generator between a
and b such that the voltage drop is from a to b.
1V
b a b 1Ω
a
1Ω 1Ω
1Ω
c c
(a) An undirected graph G. (b) The electrical network ob-
tained from G as described by
Theorem 9.2.
1. For every node, the sum of currents flowing into the node is equal the sum of currents
flowing out of the node. (Kirchoff’s Current Law)
2. The sum of directed voltage drops along any cycle in N is zero. (Kirchoff’s Voltage
Law)
Example
We now show how to find the node voltages in the network shown in Figure 9.5(b).
First we introduce a variable x to denote the unknown current flowing through the lower
horizontal resistor in the direction indicated in Figure 9.6(a). We then apply Kirchhoff’s Current
Law on the two bottom nodes marked in red in Figure 9.6(b). The law implies that current
flowing through the two vertical resistors also must be x in the directions indicated. Next we
use Kirchhoff’s Voltage Law on the cycle shown in Figure 9.6(c) in clockwise direction. This
gives the equation
1
x+x+x−1=0 ⇔ x= .
3
Thus the current and voltage through each of these three resistors are 13 . The current through
the upper horizontal resistor can easily be found to be 1, also by using Kirchhoff’s Voltage Law.
Having found the currents and voltages in all edges, the node voltage U (v) in a vertex v is
found by adding the directed voltage drops on a path from v to b. Hence U (c) = 31 + 13 = 23 .
The final solution is shown in Figure 9.6(d) with the node voltages marked in red.
Recapitulating, we have found that the probability that a random walk starting in node c gets
to a before it gets to b is 32 . If the walk starts in the vertex to the left of c, the probability is 13 .
60 9. ELECTRICAL NETWORKS
1V 1V 1V 1V
a a a 0 1
b b b 1 a
b
x x x x 1 1
3 3
1 c
x c x c x c 1 3 2
3 3
(a) Introducing a variable. (b) Using Kirchhoff’s (c) Using Kirchhoff’s (d) The final solution.
Current Law. Voltage Law.
Figure 9.6: Illustrating how to compute the current and voltages in a network using Kirchhoff’s Circuit
Laws.
The above is a simple example. For larger networks, we might need to introduce more variables
and solve more equations. It is often possible to exploit the symmetry of the network to
reduce the number of unknowns needed. We refer the reader to Section A.12 for exercises on
calculating probabilities for random walks. Beware though, when solving these exercises, a very
common mistake is often made by using Kirchhoff’s Current Law on a or b:
Caveat: Contrary to the resistors, the current through the voltage generator is not
necessarily equal to the voltage drop. Consequently, one should be very careful if
Kirchhoff’s Current Law is used on a or b.
Appendices
61
A
W EEKLY E XERCISES
A.1 Week 1
1 2 4 3 1 3
3 4 2 1 2 4
(a) (b) (c)
Is it possible to move them such that we obtain the configuration in Table A.1(b)? Or in
Table A.1(c)? If so, how many moves are needed? (Two knights are not allowed to be at
the same square at the same time.)
E1.4 Read an understand the proof of Theorem 4.1 in Bondy and Murty.
63
64 A. WEEKLY EXERCISES
E1.5 Does there exist a connected graph in which all edges are cut edges? Does there exist a
connected graph in which all vertices are cut vertices?
E1.6 (1.13 FN) Show that a simple graph G with n vertices, is connected if d(v) ≥ 12 (n − 1) for
all v ∈ V (G). Is this the best possible bound?
A.2 Week 2
E2.1 (4.1 FN) Run Dijkstra’s Algorithm on the graph below, and find the distance from s to
every vertex. Find and mark the shortest paths from s to all vertices.
4 3
3 1 3 3 3 2
4 3 4
2 2 2 1 3 3 3 4
s 3 4 4 6
3 2 5 1 7 3 4 2
5 6 1
3 2 2 3 2 3
4 2
E2.2 (4.6 FN) Run Dijkstra’s Algorithm on the graph. Find and mark the shortest path from s
to q.
1 3 3 4 5 4 q
2 1 1 3 2 4 2
1 4 4 3 2 6
1 1 3 4 1 2 2
3 1 2 9 1 3
3 3 3 2 3 3 3
s 2 2 3 7 4 4
E2.3 (1.8.1 BM) Run Dijkstra’s Algorithm on the graph below. Find and mark the shortest path
from s to all other vertices.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 65
1 2
2 6 5 3 9 7 9
s 8 1 6 2
1 7 2 4 3 1 4
9 1
E2.4 (1.8.2 BM) What additional instructions to Dijkstra’s Algorithm are needed in order that
Dijkstra’s Algorithm determine shortest paths rather than merely distances?
E2.5 (1.8.6 BM) Describe a good algorithm for determining
(a) the components of a graph.
(b) the girth (size of smallest cycle) of a graph.
How good are your algorithms?
E2.6 (If you have time). This exercise (1.5.7 BM) is related to the home work exercise FN 1.16.
Note that in the following we require that the graphs are simple (that is, they have no
loops and no multiple edges).
A sequence d = (d1 , d2 , . . . , dn ) is graphic is there is a simple graph with degree sequence
d. Let d = (d1 , d2 , . . . , dn ) be a non-increasing sequence of non-negative integers, and
denote the sequence (d2 − 1, d3 − 1, . . . , dd1 +1 − 1, dd1 +2 , . . . , dn ) by d0 .
(a) Show that d is graphic if and only if d0 is graphic.
(b) Using that, describe an algorithm for constructing a simple graph with degree
sequence d, if such a graph exists.
A.3 Week 3
E3.1 (2.5.1 BM) Show, by applying Kruskal’s Algorithm, that the tree indicated in this figure is
indeed optimal (i.e. the total cost is minimum).
6 6 3 2
7 2
8 3 4 3
E3.2 Run The Chinese Postman’s Algorithm on the following graph and find the postman’s
walk.
66 A. WEEKLY EXERCISES
4 3
3 1 3 3 3 2
4 3 4
2 2 2 1 3 3 3 4
s 3 4 4 6
3 2 5 1 7 3 4 2
5 6 1
3 2 2 3 2 3
4 2
E3.3 Run The Chinese Postman’s Algorithm on the following graph and find the postman’s
walk.
1 3 3 4 5 4
2 1 1 3 2 4 2
1 4 4 3 2 6
1 1 3 4 1 2 2
3 1 2 9 1 3
3 3 3 2 3 3 3
s 2 2 3 7 4 4
E3.4 Run The Chinese Postman’s Algorithm on the following graph. This time the walk should
start in s and end in q. How long is the walk? More generally, if the walk starts and ends
in distinct vertices, how should the algorithm for the Chinese Postman problem walk be
modified?
4 3
3 1 3 3 3 2
4 3 4
2 2 2 1 3 3 3 4
s 3 4 4 6 q
3 2 5 1 7 3 4 2
5 6 1
3 2 2 3 2 3
4 2
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 67
E3.5 Kruskal’s Algorithm finds a spanning tree in which the sum of the weights of the edges is
smallest possible. If all weights are positive, then how do we find a spanning tree such
that the product of the edges is smallest possible? Can we use Kruskal’s Algorithm?
E3.6 Kruskal’s Algorithm grows a forest. Suppose we start at a vertex x and insist that we
want to grow a tree. Let us each time choose a smallest edge joining a vertex in the tree
with a vertex not in the tree. Is this the same as Kruskal’s Algorithm? Does it always
give a spanning tree of smallest total weight? This modification of Kruskal’s Algorithm is
sometimes called Prim’s Algorithm.
A.4 Week 4
E4.1 (5.2.1 BM) Show that it is impossible, using 1 × 2 rectangles, to exactly cover an 8 × 8
square from which two opposite corner squares have been removed.
E4.2 (5.1.3 BM) For each k > 1, find an example of a k-regular simple graph that has no
perfect matching.
E4.3 (5.1.2 BM) Show that a tree has at most one perfect matching.
E4.4 (5.2.2 BM) Show that a bipartite graph G has a perfect matching if and only if |N (S)| ≥ |S|
for all S ⊆ V . Give an example to show that the above statement does not remain valid if
the condition that G be bipartite is dropped.,
E4.5 (5.2.5 BM) A line of a matrix is a row or a column of the matrix. Show that the minimum
number of lines containing all the 1’s of a (0, 1)-matrix is equal to the maximum number
of 1’s, no two of which are in the same line.
E4.6 (5.1.4 BM) Two people play a game on a graph G by alternately selecting distinct vertices
v0 , v1 , v2 , . . . such that, for i > 0, vi is adjacent to vi−1 . The last player able to select a
vertex wins. Show that the first player has a winning strategy if and only if G has no
perfect matching.
A.5 Week 5
E5.1 Which of the benzoids shown in Figure A.2 can be realized? Find the Pauling bonds of all
edges.
68 A. WEEKLY EXERCISES
(a)
(b)
Figure A.2:
E5.2 Find the total number of perfect matchings and all the Pauling bonds of the red hexagon
in Figure A.3.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 69
Figure A.3:
E5.3 (5.3.3 BM) Show that a tree T has a perfect matching if and only if o(T − v) = 1 for
all v ∈ V (T ). Remember that o(G) is the number of odd components in G, that is, the
number of connected components in G with an odd number of vertices.
E5.4 The leftmost figure below shows what we shall call a 15-game. It consists of 15 bricks
(each with a number) placed on a square divided into 16 squares. You are allowed to
move a brick into the empty square (assuming that the brick is on a neighbouring square).
We can describe each configuration by a bipartite graph as indicated in the figure.
1 2 3 4 3 1 2 4 2 1 3 4
5 6 7 8 5 6 7 8 5 6 7 8
9 10 11 12 9 10 11 12 9 10 11 12
13 14 15 13 14 15 13 14 15
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
15 15 15 15 15 15
16 16 16
70 A. WEEKLY EXERCISES
The left hand part are the 15 bricks. The right hand part are the 16 squares. The edges
tell where the bricks are placed.
E5.5 (BM 5.2.4) Let A1 , A2 , . . . , Am be subsets of a set S. A system of distinct representatives for
the family (A1 , A2 , . . . , Am ) is a subset {a1 , a2 , . . . , am } of S such that ai ∈ Ai , 1 ≤ i ≤ m,
and ai 6= aj forSi 6= j. Show that (A1 , A2 , . . . , Am ) has a system of distinct representatives
if and only if i∈J Ai ≥ |J| for all subsets J of {1, 2, . . . , m}.
A.6 Week 6
E6.1 (4.8 FN) Solve the job assignment problem for Table A.2.
5 2 3 3
3 4 1 1
6 4 2 1
2 4 1 1
Table A.2: Table for E6.1
E6.2 (4.9 FN) Solve the job assignment problem for Table A.3.
8 6 7 10
9 8 8 6
4 2 1 10
8 6 6 10
Table A.3: Table for E6.2
E6.3 (FN Exam January 1993, Problem 3) The domino board in Figure A.4 contains 18 black
and 18 white cells. Find the maximum number of dominoes you can cut out of the figure.
Show in two different ways that the given number is maximum:
• By a marking process
• By Konigs Theorem
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 71
E6.4 (FN Exam January 1994, Problem 2) Find the structure rank of the matrix A. Now find a
minimum system of rows and columns in A which covers all 1’s. Determine the complexity
of the algorithm you use for an n × n matrix.
1 0 0 1 0 1 0 0 0
0 1 0 0 0 1 0 1 1
0 0 1 1 0 0 0 0 0
0 0 1 1 1 0 0 0 0
0
A= 0 0 0 1 0 1 1 1
0 0 1 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0
1 1 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0
A.7 Week 7
E7.1 (FN 3.1) Find a maximum s-t flow in the network in Figure A.5. Then show a minimum
s-t cut.
3
3 2
1
s 3
2
4 1 t
4
1 3
E7.2 (FN 3.2) Find a maximum s-t flow in the undirected network in Figure A.6. Then show a
minimum s-t cut.
72 A. WEEKLY EXERCISES
s 3 2 2 t
4 4
6 7
4 1 5
2,2 3,3
x 3,1 1,0 y
4,3 5,2
2,2
b c
Figure A.7: A flow-network with flow and capacity on each edge.
E7.4 (BM 11.2.3) If (S, S) and (T, T ) are minimum cuts in N , show that (S ∪ T, S ∪ T ) and
(S ∩ T, S ∩ T ) are also minimum cuts in N .
E7.5 (BM 11.2.2) Show that, if there exists no directed (x, y)-path in N , then the value of a
maximum flow and the capacity of a minimum cut are both zero.
E7.6 Consider the following algorithm for finding a minimum covering in a bipartite graph:
Take a vertex x of maximum degree and delete it. In the new graph, take a vertex y of
maximum degree and delete it. (If there is a choice, take one on the same side as x if
possible.) Continue like this. Stop when all vertices have degree 0. Prove that there is
a tree on 7 (or less?) vertices which shows that the algorithm does not always find a
minimum covering.
A.8 Week 8
E8.1 Find the critical edges and edges with optimum capacity in the graphs in Figure A.8.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 73
3
s 3 2 2 t
3 2 4 4
1 6 7
s 3
2
4 1 5
4 1 t
4
1
1 3
(a) (b)
Figure A.8: Two networks with source and sink denoted s and t, respectively.
E8.2 (FN 3.8) Find the critical edges and edges with optimum capacity in the following
network.
10
12 10 10 10
s 7 9 20 t
13 1 2
E8.3 (FN 3.4) Consider the network shown below. Find a maximum flow and find a minimum
cut. Then find the number of maximum integer flows.
(Hint for the last question: Start by finding the critical edges and edges with optimum
capacity.)
12 13 11
14 15
13 1 7 19
s t
11 15
35 21 20 30
13 12 10
E8.4 If every edge has flow 0, then the value of the flow is clearly zero. Is the converse true?
(In other words, is it possible that the value of a flow can be zero, although some of the
edges have positive flow?)
E8.5 If s, t are vertices in a network N , then describe an algorithm for deciding if there is a
flow of value 0 such that some of the edges have positive flow.
E8.6 Let f be a flow from s to t in a network N . Divide the vertices of N into two sets X, Y
such that X contains both s and t. Prove that the sum of flow values from X to Y equals
the sum of flow values from Y to X.
74 A. WEEKLY EXERCISES
A.9 Week 9
E9.1 (1.21 FN) Find the connectivity, edge-connectivity and minimum degree of the following
graphs
Lemma A.1 Let x and y be two non-adjacent vertices of a graph G. Then the maximum
number of internally-disjoint (x, y)-paths in G is equal to the minimum number of
vertices whose deletion destroys all (x, y)-paths.
E9.6 Let G be a graph and let S and T be two disjoint subsets of V (G). Show that the
maximum number of vertex-disjoint paths with one end in S and one end in T is equal
to the minimum number of vertices whose deletion separates S from T (that is, after
deletion no component contains a vertex of S and a vertex of T ).
E9.7 Suppose that G is a k-connected graph and that S is a set of k + 1 vertices in G. Can
you be sure that G has a cycle which contains all vertices in S? (The cycle is allowed to
contain some other vertices as well.)
E9.8 Show that if G is k-connected with k ≥ 2, then any k vertices of G are contained together
in some cycle.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 75
A.10 Week 10
E10.3 (BM 1.2.13) A simple graph G is vertex transitive if, any two vertices u and v, are
equivalent under some element of its automorphism group. Informally speaking, a graph
is vertex-transitive if every vertex has the same local environment, so that no vertex can
be distinguished from any other based on the vertices and edges surrounding it. The same
definition applies for edge transitivity. Find a graph, which is vertex-transitive but not
edge-transitive. Then find a graph which is edge-transitive, but not vertex-transitive.
E10.4 Prove that if G is a connected edge-transitive graph with n vertices and m edges, and e
is any edge of G, then the number of spanning trees containing e is (n − 1)τ (G)/m. Use
this to show that if e is an edge of Kn , then τ (Kn − e) = (n − 2)nn−3 .
E10.5 Use Kirchoff’s tree theorem, to prove Scoin’s formula:
Here Kn,m is the complete bipartite graph with n vertices in one part, and m vertices in
the other part.
E10.6 Find the number of spanning trees in the following graph on 19 vertices.
E10.7 Find a closed formula for the number of spanning trees in the wheel graph.
We consider five families of graphs, as indicated below. Each graph contains an edge e
such that the contraction or deletion of e results in a graph in one of the other families.
Now we can use the contraction-deletion formula to write a system of recurrence relations
for the number of spanning trees in these graphs. We write wn to denote the wheel with
n nodes. Try to find a system of relations. Try to solve it.
Figure A.10: The five families of graphs we use to find an explicit formula for the number of spanning
trees in the wheel. We use the Contraction-Deletion Theorem on the emphasized edges, to
find a system of recurrence relations.
A.11 Week 11
E11.1 (5.6 FN) Let A be the set of bold edges in the graph G below. Draw G − A and G/A.
E11.2 (5.11 FN) Find the rank of the adjacency matrix A, the cycle matrix C and the cut matrix
D for the graph below.
E11.3 (6.3 FN) Find, if possible, a resistance network with K edges, such that its determinant
is
1. R1 R2 + R1 R4 + R1 R5 + R2 R3 + R3 R4 + R3 R5 , K = 5
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 77
2. R1 R2 R5 + R3 R5 + R4 R5 , K = 5
3. R1 R2 + R1 R3 + R2 R3 , K = 3
4. R1 R2 + R3 R4 + R1 R3 , K = 4
5. R1 R2 + R1 R3 + R1 R4 + R2 R3 + R2 R4 + R3 R4 , K = 4
E11.4 (6.5 FN) In the network below, find the driving point resistance R between p and q as a
function of x and y, when R1 = x,R2 = y and Ri = 1 for i = 3, 4, 5, 6, 7, 8.
p
R5
R4
R3
R1 R2
R8
R6
R7
q
E11.5 (6.7 FN) In an electrical network like the one below, the edge 1 is a voltage generator
with voltage 1, and the remaining edges are resistors. For j = 2, 3, 4, answer the following:
Is it possible to pick the resistors such that the current in edge j is 0?
1 2
A.12 Week 12
E12.1 (a) Let a, b be diametrically opposite vertices of a cube and let c be a neighbor of a.
Find the probability that a random walk starting at c gets to a before b.
(b) Let a, b be vertices of distance 2 in a cube and let c be a neighbor of a but not a
neighbor of b. Find the probability that a random walk starting at c gets to a before
b.
78 A. WEEKLY EXERCISES
(c) Let a, b be neighboring vertices in a cube. For each third vertex c, find the probability
that a random walk starting at c gets to a before b.
E12.2 For each of the following circuits, find the network determinant and then use Kirchhoff’s
rule to find the current through the resistor R1 in the direction indicated.
R1
R2
V
V R1 V R1 R2 V R1
R2
R3 R3
E12.3 For any three vertices a, b, c in the octahedron, find the probability that a random walk
starting at c gets to a before b.
A.13 Week 13
E13.4 (BM 3.2.4) Show that a connected graph which is not a block has at least two blocks
that each contain exactly one cut-vertex.
E13.5 (BM 3.2.3) Show that if G has no even cycles, then each block of G is either K2 or an
odd cycle.
B
B.1 Week 1
E1.1 The first two graphs are isomorphic. A bijection between them is shown below (there are
several other bijections). The third graph is not isomorphic to the Petersen Graph. To
prove this, one needs to find a property of this graph not shared by the Petersen Graph.
Sometimes this is very easy. For example if the number of vertices or edges differ, or if the
degree sequences are not concordant, then clearly the two graphs can not be isomorphic.
Unfortunately in this case all these properties are the same. However, look at the bold
cycle in the third graph. This cycle has length four, but careful inspection reveals that the
Petersen Graph does not have a cycle of length four. Consequently the third graph is not
isomorphic to the Petersen Graph. Another property that differs between the two graphs
is the diameter. To find the diameter of a graph, consider the shortest distance between
all pairs of vertices u and v in G. The diameter is then the longest of these distances. The
Petersen Graph is vertex transitive (all vertices have the same properties), so to find the
diameter you can take an arbitrary vertex and consider the shortest distances from that
to every other vertex. None of these distances are greater than 2, so the diameter of the
Petersen Graph is 2. But the shortest distance between the two red vertices in the third
graph is 3, so the diameter of this graph must be at least 3 (in fact it is exactly 3).
v5 v7
v1
v8 v1
v7
v2 v0 v2
v8 v6 v6 v0
v9 v5
v9 v4
v3 v4 v3
E1.2 No. If G contains a bridge xy, the vertex set of G can be partitioned into a left and
81
82 B. SOLUTIONS FOR WEEKLY EXERCISES
right part A and B such that xy is the only edge between A and B. Suppose that G is
eularian and contains the euler tour C. Start in any vertex of C and follow the euler tour.
C includes all edges in G exactly once, so at some point it will cross the edge xy. The
tour can not return to the start vertex, since there are no other edges between A and B,
contradicting that C is an euler tour.
1 2 2 3 3
' 4 1 1 4 4 1
3 4 3 2 2
(a) (a) (b) (c)
E1.5 Yes and no. In any tree, all edges are cut-edges. Every connected graph G contains a
non-cut vertex. Consider a spanning tree T in G and take any leaf v (a vertex of degree
1) in that tree. Such a leaf can not be a cut-vertex in G, because T − v is also a spanning
tree of G − v, and hence the graph stays connected after the removal of v.
In case you are not that confident about spanning trees yet, you can find a non-cut vertex
in G as follows: If G has no cycle then G is a tree. Take any leaf in that tree. Otherwise
G contains one or more cycles. In that case consider a cycle and remove an edge in that
cycle. This will not disconnect G. Continue removing edges from cycles until G contains
no cycles. The final graph is connected and has no cycle, so it is a tree. Now consider a
leaf in this tree. Removing this leaf from the original graph will not disconnect it, since all
the other vertices stays connected (e.g. by a path in the tree).
E1.6 This is equivalent (by contraposition) to the following statement:
If G is not connected then it is not the case that d(v) ≥ 12 (n − 1) for all vertices.
Proof (by contradiction) Assume G is disconnected and d(v) ≥ 21 (n − 1) for all
n vertices. Since G is not connected it contains at least two components A and B.
Consider a vertex v ∈ A. Since d(v) ≥ 12 (n − 1), A must in addition to v contain at least
1 1 1
2 (n − 1) vertices. That is |A| ≥ 2 (n − 1) + 1. By the same argument |B| ≥ 2 (n − 1) + 1.
So the number of vertices in G is at least |A| + |B| = n + 1, which is a contradiction.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 83
The bound is best possible in the sense that the following statement is false:
A simple graph G is connected if d(v) ≥ 21 (n − 1) − 1
2 for all v ∈ V (G).
A counterexample is the disconnected graph containing two disjoint copies of K n2 where
n > 2 is even. In that graph every node has degree n2 − 1 = 12 (n − 1) − 12 , but the graph is
not connected.
On a side note: The statement proven in this exercise is not very strong. We can say a
lot more about a graph G with minimum degree 12 (n − 1) besides it being connected. In
fact any two nodes in G will be connected by a path of length 1 or 2, and furthermore G
will contain a Hamilton path! We leave the proofs of these two claims to the reader (the
latter can be derived from Dirac’s Theorem).
B.2 Week 2
E2.1 Below all vertices are labeled with their distance from s (in red). The shortest path tree
rooted at s is highlighted in bold. Note that the shortest path tree is not unique.
5 8 11
4 3
3 1 3 3 3 2
2 5 8 12
4 3 4
2 2 2 1 3 3 3 4
3 6 10 15
s 3 4 4 6
3 2 5 1 7 3 4 2
3 7 12 13
5 6 1
3 2 2 3 2 3
4 2
6 9 11
E2.2 Below all vertices are labeled with their distance from s (in red). The shortest path from
s to q is highlighted in bold and has length 24.
6 6 9 12 16 21 24
1 3 3 4 5 4 q
2 1 1 3 2 4 2
5 9 12 15 17
4 1 4 4 3 2 6 22
1 1 3 4 1 2 2
5 6 8 16 17
3 3 1 2 9 1 3 20
3 3 3 2 3 3 3
s 2 2 3 7 4 4
2 4 7 14 18 22
84 B. SOLUTIONS FOR WEEKLY EXERCISES
E2.3 Below all vertices are labeled with their distance from s (in red). The shortest path tree
rooted at s is highlighted in bold.
2 3 5
1 2
2 6 5 3 9 7 9
7 6 11
s 8 1 6 2 13
1 7 2 4 3 1 4
9 1
1 9 10
E2.4 We can extend the instructions in the algorithm in two different ways.
One way is to maintain which edges are part of shortest paths while the algorithm is
running. When the label l(v) of a node v is updated, we also note from which vertex a(v)
the vertex v is updated. We will use a(v) to denote the vertex which updated v, namely
the ancestor of v.
It is also possible to start by running Dijkstra’s Algorithm and then use the algorithm in
Section 3.1.1 to compute the actual shortest paths.
E2.5 To determine the components of a graph, we could use the following algorithm:
When the algorithm stops, each vertex is labeled by the number of the component it is
part of. The number C will be the total number of components in G. The algorithm
considers each vertex and each edge a constant number of times, so the running time is
O(n + m), where n and m is the number of vertices and edges, respectively, in G.
To determine the girth of a graph G, the following algorithm could be used:
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 85
For each of the m edges in G, the algorithm computes the shortest distance between two
vertices. Using Dijkstra’s algorithm, computing this distance can be done in O(n2 ) time,
so total running time of the algorithm becomes O(mn2 ). To get a better bound, Dijkstra’s
algorithm can be implemented to run in O(m + n log n) time, in which case the running
time becomes O(m2 + mn log n). As it suffices to use distance classes instead of Dijkstra’s
algorithm, the complexity can even be lowered to O(m2 ).
E2.6 The first step in solving this exercise is to understand the relationship between d and d0 .
Let d1 be the first number in the sequence d. The formal definition d0 = (d2 − 1, d3 −
1, . . . , dd1 +1 − 1, dd1 +2 , . . . , dn ) can be a little confusing, but it simply means: To construct
d0 , take the d1 numbers after d1 in d and subtract 1 from each of them. These numbers
are the first numbers in d0 (or more precisely, in a permutation of d0 ). The remaining
numbers of d0 are the same as in d. For example let d = (4, 4, 4, 3, 2, 2, 2, 1), then d0
consists of the 4 numbers succeeding the first element of d (the underlined numbers), but
where 1 is subtracted from each of these numbers. Thus d0 is (3, 3, 2, 1, 2, 2, 1) and after
the permutation d0 = (3, 3, 2, 2, 2, 1, 1), since the sequence must be non-increasing. Now
let us consider how to solve this exercise.
(a) First, we should prove that d is graphic if and only if d0 is graphic. One direction is
easy: Suppose that d0 = (d01 , d02 , . . . , d0n ) is graphic and consider a simple graph G
having this degree sequence. Now add a vertex to G and connect it to the first d01 + 1
nodes of d0 . This new graph will then have the non-increasing degree sequence d.
The other direction is more interesting. We must show that if there is a graph with
degree sequence d, then there is also one with degree sequence d0 . So let us assume
that d is graphic, and investigate a simple graph G having this degree sequence.
Consider the vertex v corresponding to d1 (i.e. v has degree d1 ). If this vertex is
adjacent to the vertices corresponding to d2 , d3 , . . . , dd1 +1 as illustrated in Figure B.1
then we are done, since removing v from G will create a graph with degree sequence
d0 .
86 B. SOLUTIONS FOR WEEKLY EXERCISES
G
v
d1
Figure B.1: If G has the above structure, we can simply remove v to obtain a new simple graph with the
degree sequence d0 = (d2 − 1, d3 − 1, . . . , dd1 +1 − 1, dd1 +2 , . . . , dn ).
So let us assume that v is not adjacent to at least one of the vertices corresponding
to d2 , d3 , . . . , dd1 +1 . Suppose that x is such a vertex, then v must also be adjacent to
a vertex z corresponding to one of dd1 +2 , dd1 +3 , . . . , dn , since if this was not the case
d(v) < d1 , which is a contradiction. Since d is non-increasing d(x) ≥ d(z) and from
this fact follows a very important observation:
There must be a vertex y adjacent to x but not to z.
If this is not the case, the degree of z would be strictly greater than that of x, which
is a contradiction. The situation can be illustrated as shown in Figure B.2.
G y z
v x
d1
Figure B.2: The case when v is not adjacent to all the vertices corresponding to d2 , d3 , . . . , dd1 +1 . The
dashed edges vx and yz illustrates missing edges. Note that y can be anywhere in G.
We now remove the edges xy and vz from G and insert the edges vx and yz. This
operation causes v and x to become adjacent without changing the degree sequence
of G. Note that none of the edges from v to d2 , d3 , . . . , dd1 +1 are removed, so we can
repeat this operation until v is adjacent to all of these vertices. Then we have the
situation illustrated in Figure B.1, and we then remove v to obtain a graph having
the degree sequence d0 .
(b) Given a sequence d, the construction given in the previous proof also provides an
algorithm for finding a graph having this degree sequence, or proving that no such
graph exists. The algorithm is as follows: From d construct d0 and repeat until you
have a sequence consisting of only 1’s and 0’s (or until you have a sequence that can
not be formed, e.g. (4, 1, 1, 0, 0, 0), in which case d is non-graphic). This sequence of
1’s and 0’s is graphic if and only if the number of 1’s is even. In that case, construct a
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 87
graph G0 (a matching) with this degree sequence by pairing vertices (If the number
of 1’s is odd, then by the theorem, d can not be graphic). Now use the construction
from the proof to add vertices to G0 until you get a graph with degree sequence d.
B.3 Week 3
E3.1 When the input graph does not have distinct edge weights, there might be a choice
of which edge to add next in Kruskal’s algorithm, and this choice can lead to different
minimum spanning trees in G. In this exercise you simply have to verify that there is an
execution of Kruskal’s algorithm that results in the indicated spanning tree.
E3.2 A minimum tour in the graph is shown below (there are many others). The waste graph
is K6 and contains a minimum perfect matching of size 5 + 6 + 6 = 17. The total edge
weight is 130, so the tour has length 130 + 17 = 147.
4 3
3 1 3 3 3 2
4 3 4
2 2 2 1 3 3 3 4
s 3 4 4 6
3 2 5 1 7 3 4 2
5 6 1
3 2 2 3 2 3
4 2
E3.3 A minimum trail is shown below (there are many others). The waste graph is K14 and
contains a minimum perfect matching of size 1+5+3+3+5+4+2 = 23. The waste graph
is quite big, so you should spend a while convincing yourself that no smaller matching
exists. The total edge weight is 130, so the tour has length 130 + 23 = 143.
1 3 3 4 5 4
2 1 1 3 2 4 2
1 4 4 3 2 6
1 1 3 4 1 2 2
3 1 2 9 1 3
3 3 3 2 3 3 3
s 2 2 3 7 4 4
E3.4 A minimum trail is shown below (there are many others). The waste graph is K4
and contains a minimum perfect matching of size 7 + 6 = 13. The tour has length
130 + 13 = 133.
88 B. SOLUTIONS FOR WEEKLY EXERCISES
4 3
3 1 3 3 3 2
4 3 4
2 2 2 1 3 3 3 4
s 3 4 4 6 q
3 2 5 1 7 3 4 2
5 6 1
3 2 2 3 2 3
4 2
In general when the postman starts and ends in distinct vertices s and q, the goal is to
create a graph having an euler trail between s and q. This is the case if and only if the
degrees of s and q are odd and the degrees of all other vertices are even. We normally
add all vertices of odd degree to the waste graph W , since this causes the degree of these
vertices in G to be increased by one, when the minimum matching in W is added to G.
Hence, in this case we should only add s to W iff d(s) is even (and the same goes for q).
Another and maybe more convenient way to achieve exactly the same thing is as follows.
Start by adding an extra edge e between s and q having a very large weight say w(w) = ∞
(or if you don’t like ∞, take a number greater than the sum of all weights), and denote
this graph as G0 . Then solve the Chinese Postman problem as usual on G0 to obtain an
euler tour. Finally remove the edge between s and q to get an euler trail between s and q
(since in G0 , e will only be traversed once).
E3.5 If all edge weights are positive, a spanning tree which minimizes the sum of the edge
weights will also minimize the product, so we can just use Kruskal’s algorithm as usual.
Proof Let G be a connected graph with positive edge weights, and let T be a spanning
tree returned by Kruskal’s algorithm that minimizes the sum of the edge weights. We
denote the edges in T as e1 , e2 , . . . , en−1 . Now suppose you replace all edge weights in
G by their logarithmic value and then run Kruskal’s algorithm on this modified graph.
Since log is an increasing function, taking the logarithm does not change the order in
which Kruskal’s algorithm considers the edges, so Kruskal’s algorithm will return the
same spanning tree T as for the original graph. This means that T also is the spanning
tree where
is smallest possible. Again, due to the monotonicity of logarithms, this implies that T
is also the spanning tree in which e1 · e2 · . . . · en−1 is smallest possible.
E3.6 No and yes. Prim’s algorithm is not the same as Kruskal’s algorithm, since Kruskal’s algo-
rithm grows a forest and Prim’s algorithm grows a tree.However, as Kruskal’s algorithm,
Prim’s algorithm will always find a spanning tree of smallest total weight. The proof,
stated below, is similar to that for Kruskal’s algorithm.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 89
where the last inequality comes from the fact that w(xy) ≤ w(zw). This implies that
w(T 0 ) = w(TM ), and thus T 0 is a minimum spanning tree.
B.4 Week 4
E4.1 Consider the matching of size 30 shown below. The two unsaturated vertices are both
white, implying that this is a maximum matching.
E4.2 If k is even, just consider Kk+1 . This graph is k-regular but contains no perfect matching,
since it has an odd number of vertices. If k is odd, we can use the construction illustrated
in Figure B.4.
90 B. SOLUTIONS FOR WEEKLY EXERCISES
Kk+1
Kk+1
k−1
v
2
Kk+1
Figure B.4: For odd k > 1, a k-regular graph with no perfect matching can be constructed as follows.
Create k copies of Kk+1 and denote them C1 , C2 , . . . , Ck . Let Mi be a matching of size k−1
2
in Ci . For each edge in Mi insert a vertex on the middle, and glue those vertices together.
Finally create a single vertex v, and join it to the special vertex we created in each of the
components C1 , . . . , Ck .
Let G be the graph obtained by the above construction, we must argue that
k−1
• Kk+1 contains a matching of size 2 . In fact, since any two vertices are con-
k+1
nected, Kk+1 contains a matching of size 2 .
Proof Consider a tree T and suppose T contains two perfect matchings M1 and M2 .
Now consider H = M1 ∆M2 = (M1 ∪ M2 ) \ (M1 ∩ M2 ). In the general case, the
components of H are either:
1. A path with edges alternately in M1 and M2 , or
2. An even cycle with edges alternately in M1 and M2 ,
but since T is a tree 2. is not possible, so all components of H must be of the first type.
Now consider a longest path in H and let u denote one of the vertices of degree 1.
Since u can not be both M1 - and M2 -saturated, M1 and M2 can not both be perfect
matchings.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 91
E4.4 Let G = (V, E) be a bipartite graph and let (A, B) denote the bipartition of V . We must
prove that G has a perfect matching if and only if |N (S)| ≥ |S| for all S ⊆ V . Remember
that N (S) is the set of vertices directly joined to a vertex in S.
Proof The forward direction is easy. Suppose that G has a perfect matching M and
consider any set S ⊆ V . For each v ∈ S, take the vertex that v is matched to under M .
This gives a set of size |S|, so |N (S)| ≥ |S|.
To prove the other direction assume that |N (S)| ≥ |S| for any S ⊆ V . By Hall’s
theorem (see Theorem 6.3) we then know that there is a matching M saturating all
vertices in A. We now show that |A| = |B| implying that M is a perfect matching. By
our assumption |A| ≤ |N (A)| and |B| ≤ |N (B)|. Also, since G is bipartite |N (A)| ≤ B
and |N (B)| ≤ |A|. Together this gives
B.5 Week 5
E5.1 (a) can be realized. It has 9 perfect matchings and the Pauling Bonds are as shown
in Figure B.5(a). (b) does not have perfect matching and can not be realized. To see
why, consider the matching M (shown in red) and the covering C (shown in blue) in
Figure B.5(b). Since they have the same size, M is a maximum matching (and C is also a
minimum covering). This is a consequence of Lemma 6.1.
4 5
1 2 3 3
5 4
2 1 3 34
4 5 4
3 3 1 2 1 2 1 1 1 2 1 3 3
4
5 4 3 4 5
3 3 1 1 2 1 3 3
4
3
4 4 1 2 1 2 1 1 1 2 1 5 4
3 4 3 5 3 3
3 3 1 2
5 4 2 1
3 3
(a) The Pauling Bonds. (b) A matching and a covering of size 20.
1, 1 2, 1 2, 3 1, 1
286 286
1+ 659
1+ 659
2, 1 1, 1
(a) Finding the number of perfect matchings in the benzoid. (b) The Pauling bonds.
E5.3 We start by showing that if T has a perfect matching, then o(T − v) = 1 for all v ∈ V (T ).
Consider some vertex v in T .
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 93
C1
v
C2 C4
C3
Figure B.7: T , where v is matched to a vertex in C3 . Here C1 , C2 , C3 and C4 are the connected compo-
nents of T − v.
even even
even even
a b
even even
odd odd
Figure B.8: When a is removed, the only odd component we get is the one containing b. When b is
removed, the only odd component we get is the one containing a.
When removing the vertex b, the component X containing a contains a number of even
components joined to a, so X is an odd component. Since o(T − v) = 1 for all v ∈ T , X
is the unique odd component of T − b, so b will also be matched to a.
E5.4 Moving a brick horizontally, corresponds to moving the right endpoint of an edge e down
one vertex in the bipartite graph. Thus, moving a brick horizontally, does not change the
number of crossings. Moving a brick vertically can change the number of crossings in 4
different ways. By moving a brick vertically, the right endpoint of the edge e is moved 4
vertices in the bipartite graph. There are four cases to consider, and they are shown in
Figure B.9.
94 B. SOLUTIONS FOR WEEKLY EXERCISES
v v v v
v0 v0 v0 v0
(a) Case 1: 3 less (b) Case 2: One more (c) Case 3: One less (d) Case 4: Three
crossings crossing crossing more crossings
Figure B.9: The four cases to consider when moving a brick vertically. In this Figure, the brick moved
from the dashed line, to the bold line.
If we start in a situation where the empty square is in the lower right, and we end in a
situation where the empty square is in the lower right corner, we know that the number
of times the empty square has been moved up, is equal to the number of times the empty
square is moved down. Thus, the number of vertical moves of the empty square is even.
Since we make an even number of vertical moves with the empty square, the parity (even
or odd) of crossings does not change.
In the last situation, the number of crossings is 1 in the start. Since we can never change
the parity of the number of crossings, we can never solve the puzzle.
E5.5 We can look at the problem in the following way. Each set A has to pick a vertex a ∈ A
as its representative, such that no two sets share the same representative. We construct
a bipartite graph G = (X ∪ Y, E) in the following way. For each of the sets Ai create a
vertex vi in X, and for each element aj , create a vertex uj in Y . Now we join a vertex
vi ∈ X with a vertex uj ∈ Y if and only if the element aj is in the set Ai .
Now a system of distinct representatives corresponds to a matching saturating all elements
S
in X. Let S be a subset of {A1 , A2 , . . . , Am }. The union of the elements of S, A∈S A,
corresponds
S to the neighbour set of the corresponding vertices in X. The condition that
| i∈J Ai | ≥ |J| from the question, is equivalent to the condition that |N (S)| ≥ |S| for
all subsets S of X. So the statement is equivalent to the one of Hall’s Theorem and
consequently true.
B.6 Week 6
5 2 3 3 3
3 4 1 1 1
6 4 2 1 4
2 4 1 1 1
2 3 0 0
Table B.1: An optimal solution. The helping numbers are also shown in the matrix to verify that this is
actually an optimal solution.
8 6 7 10 7
9 8 8 6 8
4 2 1 10 7
8 6 6 10 7
1 0 0 3
Table B.2: An optimal solution. The helping numbers are also shown in the matrix to verify that this is
actually an optimal solution.
E6.3 A maximum of 17 dominoes can be carved out of the board. This can be seen by
considering the red matching and the blue covering shown in Figure B.10. Since they
have the same size, the matching is maximum and the covering is minimum.
E6.4 The structure rank of the matrix is 7 and corresponds to the size of a maximum matching
between the rows and columns as shown in Figure B.11(a). The marking procedure stops
as indicated with squares and triangles. The unmarked rows and the marked columns is a
covering of size 7 as shown in Figure B.11(b). Consequently the matching is maximum
and the covering is minimum.
96 B. SOLUTIONS FOR WEEKLY EXERCISES
4 4 4 4 4 4
1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0
0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1
0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0
0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 1 1 1
0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0
1 1 1 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0
B.7 Week 7
E7.1 Figure B.12 shows a maximum s-t flow F . The value of the flow is |F | = 3 + 3 = 6.
The dashed line shows a s-t cut C of size |C| = 1 + 1 + 1 + 3 = 6. It follows from the
Max-Flow-Min-Cut theorem that F is a maximum flow and C a minimum cut.
C
3,2
3,3 2,1
1,1
s 3,3
2,2
4,3 1,1 t
4,3
1,1 3,2
E7.2 Figure B.13 shows a maximum s-t flow F (the arrows indicate the direction of the flow).
The value of the flow is |F | = 2 + 6 = 8. The dashed line shows a s-t cut C of size
|C| = 3 + 4 + 1 = 8. It follows from the Max-Flow-Min-Cut theorem that F is a maximum
flow and C a minimum cut.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 97
1,1
E7.3 (a) There are 8 x-y cuts (A, B) such that x ∈ A and y ∈ B. This can easily be seen by
considering the three vertices a, b, c. For each of these we must make a binary choice
(should it be in A or B). The following list shows the 23 = 8 possible cuts and their
capacities:
S T S T
S T S T
a f
b e
c d
S∪T S∩T
d c
e b
f a
(a) The edges in the cut (S ∪ T, S ∪ T ). (b) The edges in the cut (S ∩ T, S ∩ T ).
E7.5 Since there is no (x, y)-path in N , there is some cut C = (A, B) in N , where x ∈ A and
y ∈ B, and such that there are no edges from A to B. Hence the capacity of this cut is
|C| = 0. Since the value of any flow is less than the capacity of any cut, the value of a
maximum flow is also 0.
E7.6 Consider the tree on 7 vertices shown in Figure B.15.
In the first step, the algorithm picks the vertex of degree 3, and then it is also forced to
pick three of the six remaining vertices to get a covering. This gives a covering of size 4,
but the graph has a covering of size 3 (take the three vertices of degree 2).
B.8 Week 8
E8.1 We start by finding a maximum flow in the graph, then we perform the marking process
to find the red vertices and the green vertices. At last, we use the different rules to find
the critical and optimal edges.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 99
(a) (b)
Figure B.16: The red edges are critical, and the green edges are optimal. The edges which are neither
critical nor optimal are black.
E8.2 As in the last exercise, we find a maximum flow, mark the red and green vertices, and
determine which edges are critical and optimal.
10,2
10,8
12,12 10,10 10,10
3,3
Figure B.17: The red edges are critical, and the green edges are optimal. The edges which are neither
critical nor optimal are black.
E8.3 A maximum flow of value 46 is indicated in the figure below. The critical edges are shown
in red. There are no optimal edges. There are 6 maximum flows.
14,12 15,11
13,13 1,1 7,5 19,16
s 2 11,10 15,13
3 t
To count the number of maximum integer flows, we consider the ways we can change the
flow, while maintaining the maximum flow value. This can only be achieved by sending
flow around a cycle in the network. We only need to consider the cycles that lie completely
within the red, white or green vertices, since the flow in the remaining cycles can not be
changed. In this case, we can restrict our attention to the red and green cycle indicated in
100 B. SOLUTIONS FOR WEEKLY EXERCISES
the figure. In the red cycle, we can choose the flow in 2 ways, and in the green in 3 ways.
Hence the number of maximum flows is 6.
E8.4 The converse is not true. It is indeed possible to have a flow of value zero such that some
edges have positive flow. An example is given below.
1,1
1,1 1,1
s 6,0 5,0 t
E8.5 For a network N , we define a 0+ -flow to be a flow of value 0 where one or more edges
in the network has positive flow. To determine if a network has a 0+ -flow, the following
lemma is useful.
Lemma B.1 Assuming positive edge capacities, a network N has 0+ -flow if and only
if N contains a directed cycle.
Proof If N contains a directed cycle C, we can create a 0+ -flow by taking the zero
flow and sending some flow around C (this does not change the value of the flow).
Contrary, if N contains a 0+ -flow, consider an edge xy with positive flow. y must have
an outgoing edge yz with positive flow, since any flow that goes into y must also exit
y (even if y is s or t). Follow the edge to z and continue following an outgoing edge
with positive flow. Since N is finite, we will eventually come back to a vertex, we have
previously considered, thus having found a directed cycle in N .
By the above lemma, it suffices to check if the network has a directed cycle. An intuitive
algorithm for this is the following.
For each of the m edges, we find the distance classes in N , thus the complexity of this
algorithm is O(m(m + n)) where n is the number of vertices in N . There is a better
algorithm using O(m + n) time, and we leave it for the inquisitive student to find it.
E8.6 Consider a network N = (V, E) and let (X, Y ) be a partition of V such that s ∈ X and
t ∈ X. For each node v ∈ Y we have that the flow into v equals the flow out of v, or put
more formally X X
f (e) − f (e) = 0 .
edge e into v edge e out of v
Summing up these equations for every node v ∈ Y , the flow of the internal edges in Y
cancels out, and only the flow into Y and the flow out of Y remain on the left-hand side.
The right-hand side sums to zero. That is,
X X
f (e) − f (e) = 0 ,
edge e into Y edge e out of Y
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 101
B.9 Week 9
E9.3 Since the graph is K4 and K5 glued together, but missing an edge, we can use Theorem 5.5
to find the number of spanning trees as
E9.4 By Theorem 5.6 we find the number of spanning trees in K4,3 to be 42 · 33 = 432. This
can also be found by contraction-deletion (Theorem 5.1) or by the matrix-tree theorem
(Theorem 5.7).
E9.5 We will show that in a bipartite graph G, the size of a maximum matching is equal to the
size of a minimum covering. Let G = (X, Y ) be a bipartite graph, and let a denote the
size of a maximum matching in G and a0 denote the size of a minimum covering. Now we
want to show a = a0 by using the following lemma
Lemma B.2 Let x and y be two non-adjacent vertices of a graph G. Then the maximum
number of internally-disjoint (x, y)-paths in G is equal to the minimum number of
vertices whose deletion destroys all (x, y)-paths.
From G, we create a new graph N , by adding two new vertices s and t, where we connect
s to every vertex in X and t to every vertex in Y . Now we let b denote the maximum
number of internally distinct s-t paths and b0 denote the minimum number of vertices
different from s and t, such that their deletion will destroy all paths from s to t.
By our Lemma, we know that b = b0 . We now show that a = b and that a0 = b0 , implying
that a = a0 . If we have a matching of size a in G, we can use those edges in N to find at
least a internally distinct s-t paths, thus b ≥ a. If we have b internally distinct s-t paths in
N , we can use the edges between X and Y on those paths to find a matching of size at
least b in G, thus a ≥ b. This gives us a = b.
102 B. SOLUTIONS FOR WEEKLY EXERCISES
If we have a0 vertices in G which covers all the edges of G, then we can use these a0
vertices to remove all edges between X and Y in N , and by that removing all paths from
s to t, thus b0 ≤ a0 . If we have b0 vertices in N which deletion separates s from t, we can
use these b0 vertices in G to cover every edge, thus a0 ≤ b0 . This gives us a0 = b0 which
implies a = a0 .
E9.6 We have Menger’s Theorem which states that the maximum number of completely disjoint
s-t paths is equal to the minimum number of vertices which removal disconnects s from t.
Now construct a new graph N from G by adding a vertex s, connecting it to every vertex
in S and adding a vertex t connecting it to every vertex in T . Now Menger’s Theorem
gives us that the maximum number of completely disjoint paths from S to T is equal to
the minimum number of vertices which removal disconnects S from T . This is a more
general version of Menger’s Theorem, which uses sets instead of vertices.
E9.7 No. Consider the following 3-connected graph where the red vertices are in S:
Now assume there is a simple cycle C using all 4 of the vertices in S. Since G is bipartite
there are no edges between vertices in S, thus every other vertex on C must be in S, but
since |S| is even, this can not be the case.
E9.8 As shown in the previous exercise, the existence of a cycle containing an arbitrary (k + 1)-
subset S of the vertices of a k-connected graph G is not guaranteed for k ≥ 2. In this
exercise, we prove that if the size of S is lowered from k + 1 to k, such a cycle will exist
in G.
Theorem B.1 Let G = (V, E) be a k-connected graph, k ≥ 2, and let S ⊆ V such
that |S| = k, then G has a cycle containing all vertices of S (and possibly some other
vertices as well).
Proof The proof is by induction on k. We start by proving the base case k = 2.
Base case: Since G is 2-connected any two vertices will be connected by at least two
internally disjoint paths forming a cycle.
Inductive step: Now suppose G is k-connected and consider a set S of k vertices of G.
Let S 0 be a (k − 1)-subset of S and let x denote the vertex which is in S but not in S 0 .
It follows from the induction hypothesis that G has a cycle C = c1 c2 . . . c` c1 containing
the vertices of S 0 . We now show how to extend C to a cycle also containing x.
Case ` ≥ k: We add a vertex s to G and join it to k vertices of C. The resulting graph
is still k-connected, so there must be k internally disjoint paths from x to s. All of
these k paths must intersect C at some point, since s is only joined to vertices
of C. Consider the k − 1 vertices of S lying on C, it follows from the pidginhole
principle that at least two of the paths from x to s must meet C in two vertices ci
and cj such that none of the vertices ci+1 , ci+2 , . . . , cj−1 are part of S. Hence the
cycle C 0 = x . . . ci ci−1 . . . cj+1 cj . . . x will contain all vertices of S.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 103
B.10 Week 10
E10.2 The first graph has 75 spanning trees and the second has 368. The Petersen graph has
2000 spanning trees.
E10.3 One graph which is vertex transitive, but not edge transitive is the Prism graph shown
in Figure B.19(a). By rotations and reflections every vertex of the Prism graph can be
mapped to any other. The graph is clearly not edge transitive, since it has edges that are
only contained in cycles of length four, and other edges which are contained in cycles of
length three and four.
One graph which is edge transitive, but not vertex transitive is the graph shown in
Figure B.19(b). By reflecting the graph at the center, one edge can be mapped into the
other. The graph is clearly not vertex transitive, since it contains vertices of different
degrees. This example can be generalized as follows. Take any complete bipartite
graph Kp,q where p 6= q. In this graph, every edge can be mapped into any other by a
permutation of the vertices in one partition.
(a) (b)
E10.4 For a graph G containing n vertices and m edges, we let τe (G) denote the number of
spanning trees of G containing a specific edge e ∈ E(G). We start by proving the following
lemma.
Lemma B.3 For any edge e in an edge transitive graph G,
(n − 1)
τe (G) = τ (G/e) = τ (G)
m
Proof Let e1 , e2 , . . . , em denote the edges of G and consider the sum
Now focus on a specific spanning tree T of G. This spanning tree will contribute by
one to exactly n − 1 of the terms in the above sum. Namely the terms corresponding
to the edges in T . Since each of the τ (G) spanning trees are counted n − 1 times, we
have that
τe1 (G) + τe2 (G) + . . . + τem−1 (G) + τem (G) = (n − 1)τ (G) .
104 B. SOLUTIONS FOR WEEKLY EXERCISES
G is edge transitive so all edges must have the same properties. In particular they
must be part of the same number of spanning trees, and hence τe1 (G) = τe2 (G) =
. . . = τem (G). If we denote this number by τe (G), we have established that
τe (G) · m = τe1 (G) + τe2 (G) + . . . + τem−1 (G) + τem (G) = (n − 1)τ (G) ,
The first part of the theorem now follows from the Contraction-Deletion theorem (see
Theorem 5.1).
E10.5 Scoin’s formula can be proved using Kirchoff’s Matrix-Tree Theorem. Start by removing
a row and column from the Laplacian matrix for Kn,m . Then use row and column
operations to transform the matrix into an upper- or lower triangular matrix for which
the determinant can be calculated as the product of the diagonal.
E10.6 The graph has 86 = 262444 spanning trees. This can be found by observing that the
graph is composed of six copies of a much simpler graph having 8 spanning trees joined
together by cut-vertices.
E10.7 We consider the 5 different graphs, denoted wn , an , bn , dn , en where n denote the number
of vertices, shown in Figure B.19
Figure B.19: The five families of graphs we use to find an explicit formula for the number of spanning
trees in the wheel. We use the Contraction-Deletion Theorem on the emphasized edges, to
find a system of recurrence relations.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 105
Now we find the following set of recurrence relations by using the Contraction-Deletion
theorem on the bold edges, marked in the graphs.
Our idea is, to show that τ (an ) and τ (dn ) follow the same recurrence relation, and then
use that their sum τ (wn ) must also follow that recurrence relation. We start by considering
the two last equations for τ (dn ) and τ (en ).
Now we isolate τ (en−1 ) in the first equation, and plug it into the second equation to
obtain
(τ (dn+1 ) − τ (dn )) = τ (dn ) + (τ (dn ) − τ (dn−1 ))
which reduces to
τ (dn+1 ) = 3τ (dn ) − τ (dn−1 )
When we have this, we change the index and get the following equation
and then we subtract these two equations with different index from each other to get
which is our final recurrence relation for τ (dn ). From the last relation, we can see that
τ (bn−1 ) = τ (dn ). Which we plug into the first relation τ (wn ) = τ (an ) + τ (bn−1 )
Now, we plug this into the second relation τ (an ) = τ (dn−1 ) + τ (wn−1 ) to obtain
thus giving
τ (an ) − τ (an−1 ) = 2τ (dn−1 )
106 B. SOLUTIONS FOR WEEKLY EXERCISES
which is the final recurrence relation for τ (an ). Now we have that both τ (an ) and τ (dn )
follow the recurrence relation 0 = xn − 4xn−1 + 4xn−2 − xn−3 , and therefore, their sum
τ (wn ) must follow the same recurrence relation. Now we guess for a solution τ (wn ) = αn .
is the general solution to the recurrence relation. We see that α1 = 1 is a root in the
equation, and isolate (α − 1) to get
0 = (α − 1)(α2 − 3α + 1)
√ !n √ !n
3+ 5 3− 5
A +B +C
2 2
Now we solve with these initial conditions, to obtain the values A = 1, B = 1, C = −2,
giving the final equation for the number of spanning trees in the wheel on n vertices
√ !n √ !n
3+ 5 3− 5
τ (Wn ) = + −2
2 2
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 107
B.11 Week 11
(a) G − A
(b) G/A
E11.2 Let A denote the adjacency matrix, C the cycle matrix and D the cut matrix. By Theorem
39.3 in FN, we know that the rank of C can be found as m − n + 1 which is 15 − 10 + 1 = 6
in our graph, and that the rank of D is n − 1 which is 10 − 1 = 9 in our case. By Theorem
36.1 in FN, we know that the rank of A can be found in the same way as D, so the rank
of A is also 10 − 1 = 9.
E11.3 1. Yes, the following graph
R2 R4
R1
R5
R3
2. No. In a graph on n vertices, each spanning tree must have n − 1 edges. Since we
have both the term R1 R2 R5 and the term R3 R5 , the graph must have a spanning
tree with 2 edges, and a spanning tree with 3 edges, which is clearly not possible.
3. Yes, the following graph
R1
R2
R3
4. No. Any spanning tree leaves out 2 edges. Thus every spanning tree has 2 edges.
Since the number of edges in a spanning tree is n − 1, our graph has 3 vertices. There
are three possible graphs with 3 vertices and 4 edges.
108 B. SOLUTIONS FOR WEEKLY EXERCISES
By the determinant, we can see that the graph we are considering must have exactly
3 spanning trees, which leaves us with
but since all four resistors appear in the determinant, this can not be the case either.
5. No. By the same argument as before. We still have 4 edges and 3 vertices, but now
we need to find a graph with 6 spanning trees, which is not possible either.
E11.4 We can find the driving point resistance R between p and q by
∆(G/pq)
Rp,q =
∆(G)
where ∆(G) is the network determinant of G. This gives us the driving point resistance
We do not have an xy term in the denominator since no spanning tree in G can contain
neither x nor y.
E11.5 Answer: No, Yes, No.
(a) For R2 observe that that the cotree-product πR2 (Γ) of all R2 -trees P Γ in N have the
same sign. Hence there are no values of the resistors that can cause Γ πR2 (Γ) to be
zero. Thus for the current to be zero, it follows from Kirchoff’s rule that the network
determinant ∆(N ) must be infinitely large, which is impossible.
(b) For R3 observe that this edge is part of fundamental cycles in N with opposite
orientations. Consider one R3 -tree Γ of N in which the fundamental cycle containing
R3 has positive orientation. Now let the value of the resistors not in Γ be a very
large number, and let the values of the resistors in Γ be 1. This will cause the cotree-
product of Γ to dominate the sum of cotree-products, which will then be positive, so
the current in R3 will be positive as well. Now focus on a R3 -tree Γ0 in which the
fundamental cycle containing R3 has negative orientation. By letting the resistors
not in Γ0 have a very large value and those in Γ0 be 1, the sum of cotree-products
will be dominated by a very large negative term, and hence the current in R3 will be
negative. Notice that the current in R3 is a continuous function, which we have just
argued attains both positive and negative values. This implies that the function has
a root.
(c) For R4 , the argument is similar to that for R2 .
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 109
B.12 Week 12
E12.1 (a) The answer is 35 . The probability that a random walk starting in c gets to a before b is
equal to the node voltage in c, when a voltage generator is connected between a and
b such that U (a) = 1 and U (b) = 0. By rotation symmetry the current in the three
edges leaving a must be the same (try to visualize the cube in 3D). The same is true
for the three edges entering b. The total current leaving a must be equal to the total
current entering b (notice that this value is not 1A!), since no current is generated
in the circuit. Introducing an unknown x to denote the current in each of these six
edges, we have the situation illustrated in Figure B.20(a).
1a 1a
x 2
5
x x 2 2
c 5 c 5
1V 1V 3
1 1
1 − 2x 1 − 2x 5 5 5
3 1 2 2 1 3
1 − 2x 1 − 2x 5 5 5 5 5 5
x x 2 2
1 5 5
1 − 2x 0 5 0
b 1 − 2x b 1
5
x 2
5
2
5
(a) Finding an equation using Kirchhoff’s Current Law (b) Solving the equation for x.
on the node marked in gray.
Figure B.20: Finding the node voltage U (c). Node voltages are indicated in red.
Applying Kirchhoff’s Current Law on the node c marked in gray yields the equation
2
x = 2(1 − 2x) ⇔ x = .
5
Substituting this value for x we arrive at the solution shown in Figure B.20(b).
(b) The answer is 23 . Exploiting the reflection symmetry of the circuit, we immediately
have that four of the node voltages are 12 . Introducing an unknown x to express the
remaining currents, we have the situation illustrated in Figure B.21(a).
110 B. SOLUTIONS FOR WEEKLY EXERCISES
1a 1a
x 1
3
1 1 1 1
2 c 2 2 c 2
1 1 1
2 1
2x 2x 6 3 6
1 1 1 1 1 1 1 1
1V
2 0 2 2 0 2
1V
2 0 2 2 0 2
1 1 1 1
2x 2x 6
1 6
3
1 1 1 1
2 2 2 2
x 1
3
0b 0b
(a) Finding an equation using Kirchhoff’s Voltage Law on (b) Solving the equation for x.
the cycle indicated in gray.
Figure B.21: Finding the node voltage U (c). Node voltages are indicated in red.
Now consider the cycle indicated in gray. By Kirchhoff’s Voltage Law the voltage drop
along this cycle is equal to zero. That is,
1 1 1
+0− x−x=0 ⇔ x= .
2 2 3
Substituting this value for x we arrive at the solution shown in Figure B.21(b).
(c) The answer is shown in Figure B.22(b). First observe that the current in the edge
going directly from a to b is 1. By symmetry, the two remaining edges leaving a and
the two remaining edges entering b all have the same current (try to visualize the
cube in 3D). If we denote the value of this current by x, the remaining currents can
be expressed as shown in Figure B.22(a).
1a 1a
x 5
14
x 5
1V 1 1V 1 14
2 9 1
1 − 2x 3x − 1 7 14 14
0 0
5 5 4 1 9
x 3x − 1 14 14 7 14 14
b b 1 1
3x − 1 6x − 2 14
3 7
7
5 2
x 1 − 2x 14 7
1
3x − 1 14
5
14
(a) Finding an equation using Kirchhoff’s Voltage Law (b) Solving the equation for x.
on the cycle indicated in gray.
Figure B.22: Finding the node voltage U (c). Node voltages are indicated in red.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 111
Now consider the cycle indicated in gray. By Kirchhoff’s Voltage Law the voltage drop
along this cycle is equal to zero. That is,
5
(3x − 1) + (6x − 2) + (3x − 1) − (1 − 2x) = 0 ⇔ x = .
14
Substituting this value for x we arrive at the solution shown in Figure B.22(b).
E12.2 Recall that Kirchhoff’s rule states that the current in R1 is determined by the expression
−V X
iR1 = πR1 (T ) ,
∆(N )
T
V R1
πR1 (T ) = −1
R1 R1
V V
R2 R2
R3 R3
V R1 R2
πR1 (T ) = R2
112 B. SOLUTIONS FOR WEEKLY EXERCISES
(d) The answer is: iR1 = RV1 . The network determinant is ∆ = R1 (R2 + R3 ). The circuit
has the two R1 -trees shown below
R2 R2
V R1 V R1
R3 R3
E12.3 Due to the symmetry of the octahedron, there are only two cases to consider
(i) The distance between a and b is 1
(ii) The distance between a and b is 2
The second case is easy, since one can argue that the current in all edges leaving a and in
all edges entering b must be the same. This gives the node voltages (probabilities) shown
in Figure B.23.
a
1
1 1
2 2
1V 1
1 2
2
0
b
Figure B.23: The distance between a and b is 2.
We now consider the case in which the distance between a and b is 1. By reflection
symmetry, we can quickly find two nodes having node voltage 12 . Introducing an unknown
x to denote the current in the remaining edge leaving a, we can express all remaining
currents by x as shown in Figure B.24(a).
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 113
1
2
a
1
1 1
2 −x 2 −x
1 1 1V
2 2 1 3
1 − 2x 2 5
1 1 1
2 −x 2 −x 2
0
x x
b
1 1 1
1 2 2 2
0
1
a b
1V
2
5
(a) Finding an equation using Kirchhoff’s Current (b) Solving the equation for x.
Law on the node marked in gray.
Applying Kirchhoff’s Current Law on the node marked in gray yields the equation
1 1 2
x= − x + (1 − 2x) + −x ⇔ x= .
2 2 5
Substituting this value for x, we get the final solution depicted in Figure B.24(b).
B.13 Week 13
E13.1 For a planar graph G, we know that v(G) − e(G) + f (G) = 2. If a graph is self-dual the
number of vertices must be equal to the number of faces, since the dual graph G0 has a
vertex for every face in G.
For n ≥ 4 we give a self-dual graph on n vertices. One such graph-family, is the wheel-
graphs.
E13.2 We want to show that every simple plane graph is a spanning subgraph of some simple
plane triangulation. To show this, we will show that any simple plane graph, can be
extended to a plane triangulation by adding edges.
Consider a plane graph G which is not a triangulation. G must have some face f with
degree greater than 3. Take two vertices x and y on the boundary of f , such that
xy ∈
/ E(G). Add xy inside f . This will divide f into two smaller faces. We need to show
that it is always possible to choose two vertices x and y in a face of degree ≥ 4 such that
xy ∈
/ E(G).
In a plane graph G, consider a face f of degree k, and let v1 , v2 , . . . , vk denote the vertices
on the boundary of f . If v1 v3 is not in E(G), add v1 v3 inside f , finishing the proof. If v1 v3
is in E(G), consider v2 v4 . Since v1 v3 was in E(G), it is not possible for v2 v4 to also be in
E(G), since it must lie outside of f , contradicting the planarity of G.
E13.3 We start by showing that, if a graph is planar, all of its blocks are planar. This is easy
to see, since a planar graph with a non planar block is a contradiction. Now we will
show that if all the blocks of a graph G are planar, then G is planar itself. We do it in the
following way: We consider a graph, and assume its blocks are planar. Then we draw
each planar block in such a way, that we can connect them without loosing planarity.
Consider a graph G, where every block is planar and look at a cut vertex x connecting
two blocks A and B. We start by finding a planar embedding of the two blocks A and
B connected by x. Let y be a neighbour of x in A, and let z be a neighbour of x in B.
Now we know, that the edge xy is adjacent to a face fA in A. Now we redraw A in such a
way, that xy lies on the outer face. That can be done in the following way: Draw A on a
sphere, and create a small hole in fA . Now unwrap the sphere, forming a disc, where xy
is on the outer face.
If we do this for both A and B, we get x on the outer boundary of both A and B, and we
can now connect A to B by x without loosing planarity.
Now we will show, that a minimal nonplanar graph is a simple block. We assume different,
namely that we have a minimal nonplanar graph G which is not a simple block. Here
minimal means that removing anything from the graph, will result in planarity. If we
consider one of its blocks B, it must be planar, since removing the rest of G to obtain B
will result in planarity. In this way, we can argue that every block of G is planar. Now we
know, from the previous result, that G itself must be planar.
E13.4 Let G be a connected graph which is not a block. We must prove that G contains at least
two blocks that each contain exactly one cut-vertex. To do this, we will use an auxiliary
bipartite graph H = (X, Y ) obtained from G as follows:
Construction of H = (X, Y ): X consists of all cut-vertices of G and Y contains
a vertex for each block in G. There is an edge from v ∈ X to b ∈ Y if and only
if v is contained in the corresponding block in G.
Figure B.26 shows an example of this construction.
S UPPLEMENTARY N OTES FOR G RAPH T HEORY I 115
v4
v3 v3
v4
v1 v2
v2 v1
X Y
(a) The original graph G, where each block has its own (b) The constructed bipar-
color. The cut vertices are denoted v1 , v2 , v3 , v4 . tite graph H.
x
y
Figure B.27: An impossible block structure. The cycle C is marked with bold edges. Since C is an odd
cycle (by assumption), one of the two smaller cycles has to be of even length.
Consider the three paths from x to y. Two of these must have the same parity (odd or
even), and therefore B contains an even cycle, but this is a contradiction. So unless B is
K2 it will be just a single odd cycle.
C
C OMPLEXITY OF A LGORITHMS
We often look at algorithms for different problems, and generally, it is interesting whether or not
the algorithm is efficient. We need a way to talk about efficiency of an algorithm, and difficulty
of a problem in a formal way. Sometimes, complexity is also used to denote efficiency.
To denote the efficiency of an algorithm, we will introduce the so-called Big O-notation. Big
O-notation says something about the time consumption of an algorithm on some input. We
will say that an algorithm uses time g(n) on input of size n. Now we can define O-notation as
follows
Definition C.1 We say that g(n) ∈ O(f (n)) if and only if there exists two constants c and
n0 such that g(n) ≤ cf (n) for all n ≥ n0 .
For example 2n log2 n ∈ O(n2 ) because if we choose c = 1, then for all n ≥ 4: 2n log2 n ≤ n2 .
When we talk about time complexity and space complexity of algorithms, we use this notation
to refer to some upper-bound for the running time or space requirements for the algorithm.
Example C.1 Consider this simple algorithm for connecting n vertices into a complete
graph:
Now we want to determine the efficiency of this algorithm. It looks at n vertices, and for
each vertex, it looks at n − 1 other vertices, so the total number of pairs considered is
n(n − 1). For each pair, we create an edge, this takes constant time c. So the total time
spend by the algorithm is n(n − 1)c. Now this can be reduced to O(cn2 − cn), and we can
then ignore the constant factor to get O(n2 − n) where n2 dominates. So we end up with an
efficiency of O(n2 ).
117
D
5 7 8 11 12 16
7 12 20 17 24 39
8 13 21 12 19 30
12 21 36 30 32 32
16 24 35 24 35 50
119
E
R ECURRENCE R ELATIONS
This is a polynomial of degree k with distinct roots {α1 , . . . , αk } ∈ Rk , and now an can be
written as
k
X
an = βi αin
i=1
where β1 to βk is constants which can be found by using k different initial conditions for the
recurrence.
We have only described homogeneous linear recurrence relations, and we assumed that the
roots {α1 , . . . , αk } were distinct real numbers - but this is all which will be needed for this
course.
121
F
L IST OF S YMBOLS
General Theory
V (G) The vertex set of G
E(G) The edge set of G
v(G) The number of vertices in G
e(G) The number of edges in G
f (G) The number of faces in G
d(v) The degree of vertex v
din (v) The in-degree of vertex v
dout (v) The out-degree of vertex v
δ(G) The minimum degree in G
∆(G) The maximum degree in G
λ(G) The edge-connectivity of G
κ(G) The vertex-connectivity of G
G−e Removal of e from G
G/e Contraction of e in G
Kn The complete graph on n vertices
Ki,j The complete bipartite graph with i vertices in one part, and j in the other
Ck Cycle of length k
N (v) Neighbours of vertex v
G'H G is isomorphic to H
w(v, u) Weight of edge between v and u
Shortests Paths
l(v) Distance to v from s
N (v) Number of shortest paths from s to v
s Starting vertex
D Distance class
123
124 F. LIST OF SYMBOLS
Spanning Trees
τ (G) Number of spanning trees in G
G H Operation described on page 27
G⊕H Operation described on page 27
D Degree matrix
A Adjacency matrix
Q Laplacian matrix
Matchings
M A matching
C A covering
L Equality graph
ε Bottleneck for change in helping numbers
Benzoids
B A benzenoid
p(t) Total number of Perfect Matchings
p(x, y) The number of Perfect Matchings containing the edge xy
Network Flow
N Flot network
f (e) Flow over edge e
c(e) Capacity of edge e
c(S) Capacity of cut S
Smin Minimum cut
F (G) All possible flows over G
|f | The value of flow f
fmax (G) The maximum flow in G
δ Bottleneck of augmenting path
Electrical Networks
N Electrical Network
π(T ) Co-Tree Product of T
R The Set of Resistors
I The Set of Current Generators
V The Set of Voltage Generators
∆N The Network Determinant
iRk Current trough Resistor Rk
TRk Rk -tree
Rp,q Driving Point Resistance between vertices p and q
U (v) Node Voltage of v
I NDEX
125
126 INDEX
Matching, 29
Matrix-Tree Theorem, 27
MaxFlow-MinCut Theorem, 49
Maximal Matching, 29
Maximum Flow, 48
Maximum Matching, 29
Menger’s Theorem, 51
Minimum Cut, 49
Minimum Spanning Tree, 23
Multigraph, 4
Neighbour, 5
Network determinant, 54
Number of Shortest Paths, 17
O-notation, 117
Optimal Edge, 52
Path, 4
Pauling Bond, 44
Perfect Matching, 29
Petersen Graph, 7
Planar Graph, 10
Random walk, 58
Recurrence Relation, 121
Regular Graph, 7
Resistor, 54
Scoin’s Formula, 27
Self-dual Graph, 10
Shortest Path, 13
Source and Sink of Network, 47
Spanning Tree, 23
st-cut, 48
st-flow, 47
Structure Rank, 36
Subgraph, 8
Valency Spectrum, 5
Vertex Connectivity, 9
Vertex Set, 3
Voltage Generator, 54