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.
i=jmind(i,j)=2
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.