SLIDE 14 2/4/09 14
Reconstruc4ng Addi4ve Distances Given T
x y z w v a
a b z a
6 10
b
10
z
D2
b c
a c a
3
c
D3
d(a, c) = 3 d(b, c) = d(a, b) – d(a, c) = 3 d(c, z) = d(a, z) – d(a, c) = 7 d(b, x) = d(a, x) – d(a, b) = 5 d(b, y) = d(a, y) – d(a, b) = 4 d(a, w) = d(z, w) – d(a, z) = 4 d(a, v) = d(z, v) – d(a, z) = 6 Correct!!! 5 4 7 3 3 4 6
a x y z a
11 10 10
x
9 15
y
14
z
D1
Neighbors x, y (common parent)
Trees and Neighbors
Previous algorithm relied only on finding neighboring leaves:
- 1. Find neighboring leaves i and j with parent k
- 2. Remove the rows and columns of i and j
- 3. Add a new row and column corresponding to k,
where the distance from k to any other leaf m can be computed as: Dkm = (Dim + Djm – Dij)/2
Compress i and j into k, iterate algorithm for rest of tree