Lecture13_Trees_summary
Lecture13_Trees_summary
Summary
Aaron Tan
AY2024/25 Semester 1 1
Summary
14. Trees
10.5 Trees
• Definitions: circuit-free, tree, trivial tree, forest
• Characterizing trees: terminal vertex (leaf), internal vertex
2
Summary
10.5 Trees
Definition: Tree
(The graph is assumed to be undirected here.)
A graph is said to be circuit-free if and only if it has no circuits.
A simple graph is called a tree if and only if it is circuit-free and connected.
A trivial tree is a tree that consists of a single vertex.
A simple graph is called a forest if and only if it is circuit-free and not connected.
3
Summary
10.5 Trees
Lemma 10.5.1
Any non-trivial tree has at least one vertex of degree 1.
Theorem 10.5.2
Any tree with n vertices (n > 0) has n – 1 edges.
Lemma 10.5.3
If G is any connected graph, C is any circuit in G, and one of the edges of C is
removed from G, then the graph that remains is still connected.
Theorem 10.5.4
If G is a connected graph with n vertices and n – 1 edges, then G is a tree.
4
Summary
10.6 Rooted Trees
5
Summary
10.6 Rooted Trees
6
Summary
10.6 Rooted Trees
Theorem 10.6.2
For non-negative integers h, if T is any binary tree with height h and t terminal
vertices (leaves), then
t 2h
Equivalently,
log2 t h
7
Summary
10.6 Rooted Trees
Breadth-First Search
In breadth-first search (by E.F. Moore), it starts at the root and
visits its adjacent vertices, and then moves to the next level.
1
The figure shows the order
of the vertices visited. 2 3
4 5 6
7 8 9
BFS
8
Acknowledgement: Wikipedia https://en.wikipedia.org/wiki/Breadth-first_search
Summary
10.6 Rooted Trees
Depth-First Search
Depth-First Search
Proposition 10.7.1
1. Every connected graph has a spanning tree.
2. Any two spanning trees for a graph have the same number of edges.
16