Agglomerative hierarchical clustering method
Complete-linkage clustering is one of several methods of agglomerative hierarchical clustering. At the beginning of the process, each element is in a cluster of its own. The clusters are then sequentially combined into larger clusters until all elements end up being in the same cluster. The method is also known as farthest neighbour clustering. The result of the clustering can be visualized as a dendrogram, which shows the sequence of cluster fusion and the distance at which each fusion took place.
Clustering procedure.
At each step, the two clusters separated by the shortest distance are combined. The definition of 'shortest distance' is what differentiates between the different agglomerative clustering methods. In complete-linkage clustering, the link between two clusters contains all element pairs, and the distance between clusters equals the distance between those two elements (one in each cluster) that are farthest away from each other. The shortest of these links that remains at any step causes the fusion of the two clusters whose elements are involved. 
Mathematically, the complete linkage function — the distance formula_1 between clusters formula_2 and formula_3 — is described by the following expression :
formula_4
where
Algorithms.
Naive scheme.
The following algorithm is an agglomerative scheme that erases rows and columns in a proximity matrix as old clusters are merged into new ones. The formula_10 proximity matrix "D" contains all distances "d"("i","j"). The clusterings are assigned sequence numbers 0,1..., ("n" − 1) and "L"("k") is the level of the kth clustering. A cluster with sequence number "m" is denoted ("m") and the proximity between clusters ("r") and ("s") is denoted "d"[("r"),("s")].
The complete linkage clustering algorithm consists of the following steps:
Optimally efficient scheme.
The algorithm explained above is easy to understand but of complexity formula_26. In May 1976, D. Defays proposed an optimally efficient algorithm of only complexity formula_27 known as CLINK (published 1977) inspired by the similar algorithm SLINK for single-linkage clustering.
Working example.
The working example is based on a JC69 genetic distance matrix computed from the 5S ribosomal RNA sequence alignment of five bacteria: "Bacillus subtilis" (formula_28), "Bacillus stearothermophilus" (formula_29), "Lactobacillus viridescens" (formula_30), "Acholeplasma modicum" (formula_31), and "Micrococcus luteus" (formula_32).
First step.
Let us assume that we have five elements formula_33 and the following matrix formula_34 of pairwise distances between them:
In this example, formula_35 is the smallest value of formula_34, so we join elements formula_28 and formula_29.
Let formula_39 denote the node to which formula_28 and formula_29 are now connected. Setting formula_42 ensures that elements formula_28 and formula_29 are equidistant from formula_39. This corresponds to the expectation of the ultrametricity hypothesis.
The branches joining formula_28 and formula_29 to formula_39 then have lengths formula_49 ("see the final dendrogram")
We then proceed to update the initial proximity matrix formula_34 into a new proximity matrix formula_51 (see below), reduced in size by one row and one column because of the clustering of formula_28 with formula_29.
Bold values in formula_51 correspond to the new distances, calculated by retaining the maximum distance between each element of the first cluster formula_55 and each of the remaining elements:
formula_56
formula_57
formula_58
Italicized values in formula_51 are not affected by the matrix update as they correspond to distances between elements not involved in the first cluster.
Second step.
We now reiterate the three previous steps, starting from the new distance matrix formula_51 :
Here, formula_61 is the lowest value of formula_51, so we join cluster formula_55 with element formula_32.
Let formula_65 denote the node to which formula_55 and formula_32 are now connected. Because of the ultrametricity constraint, the branches joining formula_28 or formula_29 to formula_65, and formula_32 to formula_65, are equal and have the following total length:
formula_73
We deduce the missing branch length:
formula_74 ("see the final dendrogram")
We then proceed to update the formula_51 matrix into a new distance matrix formula_76 (see below), reduced in size by one row and one column because of the clustering of formula_55 with formula_32 :
formula_79
formula_80
Third step.
We again reiterate the three previous steps, starting from the updated distance matrix formula_76.
Here, formula_82 is the smallest value of formula_76, so we join elements formula_30 and formula_31.
Let formula_86 denote the node to which formula_30 and formula_31 are now connected.
The branches joining formula_30 and formula_31 to formula_86 then have lengths formula_92 ("see the final dendrogram")
There is a single entry to update:
formula_93
Final step.
The final formula_94 matrix is:
So we join clusters formula_95 and formula_96.
Let formula_97 denote the (root) node to which formula_95 and formula_96 are now connected.
The branches joining formula_95 and formula_96 to formula_97 then have lengths:
formula_103
We deduce the two remaining branch lengths:
formula_104
formula_105
The complete-linkage dendrogram.
The dendrogram is now complete. It is ultrametric because all tips (formula_28 to formula_32) are equidistant from formula_97 :
formula_109
The dendrogram is therefore rooted by formula_97, its deepest node.
Comparison with other linkages.
Alternative linkage schemes include single linkage clustering and average linkage clustering - implementing a different linkage in the naive algorithm is simply a matter of using a different formula to calculate inter-cluster distances in the initial computation of the proximity matrix and in step 4 of the above algorithm. An optimally efficient algorithm is however not available for arbitrary linkages. The formula that should be adjusted has been highlighted using bold text.
Complete linkage clustering avoids a drawback of the alternative single linkage method - the so-called "chaining phenomenon", where clusters formed via single linkage clustering may be forced together due to single elements being close to each other, even though many of the elements in each cluster may be very distant to each other. Complete linkage tends to find compact clusters of approximately equal diameters.
References.
 ;templatestyles src="Reflist/styles.css" / ;