Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
October 16, 2018
Review of Definitions: Walk, path, cycle, connected graph, subgraph, induced sub-
graph, connected component.
Trees
A graph with no cycles is acyclic. A tree is a connected acyclic graph. A vertex of degree
greater than 1 in a tree is called an internal vertex, otherwise it is called a leaf. A forest is
an acyclic graph.
Example. Prove that every tree with at least two vertices has at least two leaves and
deleting a leaf from an n-vertex tree produces a tree with n − 1 vertices.
Solution. A connected graph with at least two vertices has an edge. In an acyclic graph,
an endpoint of a maximal non-trivial path (a path that is not contained in a longer path)
has no neighbors other than its only neighbor on the path. Hence, the endpoints of such a
path are leaves.
Let v be a leaf of a tree T and let T 0 = T − v. A vertex of degree 1 belongs to no path
connecting two vertices other than v. Hence, for any two vertices u, w ∈ V (T 0 ), every path
from u to w in T is also in T 0 . Hence T 0 is connected. Since deleting a vertex cannot create
a cycle, T 0 is also acyclic. Thus, T 0 is a tree with n − 1 vertices.
Example. For a n-vertex graph G, the following are equivalent and characterize trees
with n vertices.
(1) G is a tree.
(2) G is connected and has exactly n − 1 edges.
(3) G is minimally connected, i.e., G is connected but G − {e} is disconnected
for every edge e ∈ G.
(4) G contains no cycle but G + {x, y} does, for any two non-adjacent vertices
x, y ∈ G.
(5) Any two vertices of G are linked by a unique path in G.
Solution. (1 → 2). We can prove this by induction on n. The property is clearly true
for n = 1 as G has 0 edges. Assume that any tree with k vertices, for some k ≥ 0, has k − 1
edges. We want to prove that a tree G with k + 1 vertices has k edges. From the example
we did in last class we know that G has a leaf, say v, and that G0 = G − {v} is connected.
By induction hypothesis, G0 has k − 1 edges. Since deg(v) = 1, G has k edges.
2 Lecture Outline October 16, 2018
(2 → 3). Note that G − {e} has n vertices and n − 2 edges. We know that such a graph
has at least 2 connected components and hence is disconnected.
(4 → 5). Note that since G + {x, y} creates a cycle for for any two non-adjacent vertices in
G, it must be that there must be a path between x and y in G. We will now show that there
is exactly one path between any two vertices in G. We will prove this by showing that if
there are two vertices that have two different paths between them then G contains a cycle.
Assume that there are two paths from u to v. Beginning at u, let a be the first vertex at
which the two paths separate and let b be the first vertex after a where the two paths meet.
Then, there are two simple paths from a to b with no common edges. Combining these two
paths gives us a cycle.
(5 → 1). Since there is a path between any two vertices in G, G must be connected. Now
we want to show that G is acyclic. Assume otherwise. Then, any two vertices on the cycle
can reach each other by two disjoint, simple paths that consist of edges of the cycle. This
proves that not every pair of vertices in G has a unique path between them. We have thus
proved the claim by proving the contrapositive.