Professional Documents
Culture Documents
Tree
Tree
Tree
What’s a tree?
A tree is a connected
graph with no cycles
Tree
Not Tree
Not Tree
Tree
More on trees
➢A tree has to be a simple graph.
➢Trees appear in numerous instances.
Genealogy of a family
A river with its tributaries and subtributaries
Sorting of mail
How Many n-Node Trees?
1:
2:
3:
4:
5:
How many labeled trees are
there with three nodes?
1 2 3
1 3 2
2 1 3
How many labeled trees are
there with four nodes?
a c
b d
Cayley's
formula
No of trees possible with
n vertices = n (n-2)
When N=4
4 (4-2)
=16
SOME PROPERTIES OF
TREES
Theorem 3.1: There is one and only one path between
➢
G1 G2
x y
5 5 x 4 x3 5!/ 2
labelings
labelings labelings
Example: 5 8
3 4
1 7
2 6
1 3 3 4 4 4
How to reconstruct the unique tree
from a sequence S:
Let I = {1, 2, 3, …, n}
Loop until S is empty
Let i = smallest # in I but not in S
Let s = first label in sequence S
Add edge {i, s} to the tree
Delete i from I 8
5
Delete s from S 3 4
1 7
Add edge {a,b}, where I = {a,b} 2 6
1 3 3 4 4 4