trees - university of illinois · properties of trees every tree t has the following properties:...
TRANSCRIPT
Trees
Discrete Structures (CS 173)
Madhusudan Parthasarathy, University of Illinois 1
For notes on “free” trees, see Section 5.7 of :http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/readings/MIT6_042JF10_notes.pdf
For notes on rooted trees, see textbook.
You are required to know both free trees and rooted trees in this course.
2
Trees
Definition:
A graph is a tree iff it is acyclic and connected.
Acyclic: no cycles
Leaf: A vertex of degree 1
A forest is just an acyclic graph
(each connected component is a tree).
3
Properties of trees
Every tree T has the following properties:• Any connected subgraph of T is a tree.
• There is a unique simple path between every pair of vertices in T.
• Adding an edge between non-adjacent nodes in T creates a graph with a cycle.
• Removing any edge disconnects the graph.
• If any tree has at least two vertices, then it has at least two leaves.
• The number of vertices in a tree is one larger than the number of vertices: |E|=|V|-1
• If an edge is removed from a tree, then it will result in two trees.
4
5
6
7
If any tree has at least two vertices, then it has at least two leaves.
Proof:Take the longest simple path in the tree (argue why there
must be one)
Then we can argue that u1 and un must be leaves.If u1 had another neighbor than u2, say v, then:Case 1: If v is one of u3,… un, then there would be a cycle.Case 2: If v is not any of u3,…un, then we would have a
longer simple path, which contradicts our assumption.
8
The number of vertices in a tree is one larger than the number of vertices: |E|=|V|-1
Proof:Induction on number of vertices, using the fact that any nontrivial tree
must have a leaf.
9
If an edge is removed from a tree, then it will result in two trees.
Why?
Useful for induction on “free” trees:
- Free trees (nontrivial) have at least one leaf.
- Removing an edge from a free tree, results in two free trees.
10