Professional Documents
Culture Documents
GTlecture 2
GTlecture 2
and APPLICATIONS
Trees
Properties
Tree: a connected graph with no cycle (acyclic)
Forest: a graph with no cycle
Paths are trees.
Star: A tree consisting of one vertex adjacent to
all the others.
5 4 3 3 4 5
5 4 4 5
12 6 9 12
CENT-
ROID
D(G ) = ∑d
u , v∈V
G (u , v)
cut vertices
b c d a c
Containing
the diagonal
v
G G·e
Graph Theory and Applications © 2007 A. Yayimli 29
Recursive Solution
Proposition: Let τ(G) denote the number of
spanning trees of a graph G. If e ∈ E is not a
loop, then:
τ(G) = τ(G-e) + τ(G·e)
Example:
a b
e +
c d
G G–e G·e
4 spanning trees 4 spanning trees
det: - 4 + 0 + 0 – 0 – 2 – 2 = - 8
60 51 35 56
Tok 70 Mex
2
13 61 68 78 57 21
Bei 68 NY
51 36
Par
1 10 5 4 5
3 1 9 5
8
2 3 7
7 4 6 2 9 8 2 3
7 4 6
4 5 6
3 4 5
3
2 9 11
2 9 8
6
6
Graph Theory and Applications © 2007 A. Yayimli 43
Tree Application: Branch-and-Bound Method
Knapsack problem:
A container
Several items, each associated with:
a size, and
a value.
Which items should we choose to pack in the
container, so that:
The total value is maximized
The total size do not exceed container’s size.
Container size = 9
Order 1 2 3 4 5
Item E B C D A
Weight 2 8 6 4 3
Value 5 12 9 3 2
Value per unit 2.5 1.5 1.5 0.75 0.67
(0,1,1,0,0)
(0,1,0,0,0) (0,1,0,1,0)
(0,1,0,0,1)
(0,1,0,0,0) w = 8, v = 12
(0,0,0,0,0) (0,0,1,0,0) w = 6, v = 9
(0,0,0,1,0) w = 4, v = 3
(0,0,0,0,1) w = 3, v = 2
(0,1,0,0,0) (0,1,0,1,0) w = 12
(0,0,0,1,0) v = 3
(0,0,0,1,0) v = 3 (0,0,1,0,1) w = 9, v = 11
we cannot branch further