CME 305: Discrete Mathematics and Algorithms
Instructor: Professor Amin Saberi (saberi@stanford.edu)
January 7, 2010
Lecture 2: Graphs, Trees, and Cayley’s Theorem
1
Basic Deﬁnitions of Graphs and Trees
A
graph
G
(
V,E
) is a set
V
of
vertices
and a set
E
of
edges
, where
E
=
{
(
a,b
)
,a
∈
V,binV
}
. We usually
denote

V

as
n
, and

E

as
m
. In an
undirected
graph, an edge is an unordered pair of vertices. An ordered
pair of vertices is called a
directed
edge. If we allow
multisets
of edges, i.e. multiple edges between two
vertices, this is known as a
multigraph
. A selfloop or
loop
is an edge between a vertex and itself. An
undirected graph without loops or multiple edges is known as a
simple
graph. In this class, we will assume
graphs to be
simple
and
ﬁnite
(i.e. number of vertices is ﬁnite) unless otherwise stated.
If vertices
a
and
b
share an edge
e
, we say that they are
adjacent
and write
a
∼
b
. If vertex
a
is one of edge
e
’s endpoints, a is
incident
to
e
and we write
a
∈
e
. The
degree
of a vertex is the number of edges incident
to it, denoted
d
i
for vertex
v
i
∈
V
. The
degree sequence
of graph is the sequence
{
d
1
,d
2
,...,d
n
}
.
A
walk
is a sequence of vertices
v
1
....v
k
such that
∀
i
∈
1
..k

1,
v
i
∼
v
i
+1
. A
path
is a walk where
v
i
6
=
v
j
,
∀
i
6
=
j
, i.e. a walk that visits each vertex at most once. A
closed walk
is a walk where
v
1
=
v
k
. A
cycle
is a closed path, i.e. a path combined with the edge (
v
k
,v
1
). A graph is
connected
if there exists a path
between each pair of vertices.
A
tree
is a connected graph with no cycles. A
forest
is a graph where each connected component is a tree.
A node in a forest with degree 1 is called a
leaf
.
2
Basic Properties of Trees
Claim 1
(simple properties of trees)
•
Every tree has at least two leaves (vertices of degree 1), assuming
n
≥
2
.
•
The number of edges in a tree of size
n
is
n

1
Proof:
The ﬁrst property can be seen by starting a path at an arbitrary node, walking to any neighbor that
hasn’t been visited before. After at most
n
steps, we must reach a vertex
v
where there are no untraversed
neighbors. Therefore,
v
must have only one neighbor and is a leaf, otherwise there is a cycle and the graph
is not a tree. We can then traverse a path starting at
v