UPGMA joins the two nearest sequences first, placing them at half their distance.

highlighted = computed this step

The smallest distance joins first

UPGMA builds the tree from the bottom up. It finds the smallest distance in the matrix — here 2, between W and X — and joins that pair into the first cluster.

minijd(i,j)=2\min_{i \ne j} d(i,j) = 2
Closest pairThe row of the closest pair is highlighted.·WXYZW0246X2046Y4406Z6660

A cluster sits at half the distance

The new cluster is placed at half the joining distance, so W and X meet at height 1. The next chapter merges the remaining clusters the same way, up to a full tree.

height=22=1\text{height} = \frac{2}{2} = 1
First clusterThe two closest sequences join at half their distance.01WX1