ArticleslgStudy

computer science

Complete-linkage clustering

Complete-linkage clustering is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Complete-linkage clustering rather than just read about it. In short: 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.

Complete-linkage clustering — main illustration
Complete-linkage clustering — illustration

Key takeaways

  • Complete-linkage clustering belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Complete-linkage clustering to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Complete-linkage clustering from memory before moving on to harder problems.

Reference excerpt

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 on the basis of the maximum difference between any two elements in candidate clusters into larger clusters until all elements end up being in the same cluster. The method is also known as farthest neighbour clustering. As with any agglomerative or divisive clustering method, the result 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 D(X,Y) between clusters X and Y — is described by the following expression : D(X,Y)=maxx∈X,y∈Yd(x,y) where

d(x,y) is the distance between elements x∈X and y∈Y ; X and Y are two sets of elements (clusters).

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 N×N 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:

Begin with the disjoint clustering having level L(0)=0 and sequence number m=0. Find the most similar pair of clusters in the current clustering, say pair (r),(s), according to d[(r),(s)]=max⁡d[(i),(j)]where the maximum is over all pairs of clusters in the current clustering. Increment the sequence number: m=m+1. Merge clusters (r) and (s) into a single cluster to form the next clustering m. Set the level of this clustering to L(m)=d[(r),(s)] Update the proximity matrix, D, by deleting the rows and columns corresponding to clusters (r) and (s) and adding a row and column corresponding to the newly formed cluster. The proximity between the new cluster, denoted (r,s), and an old cluster (k) is defined as d[(r,s),(k)]=max⁡{d[(k),(r)],d[(k),(s)]}. If all objects are in one cluster, stop. Else, go to step 2.

Optimally efficient scheme The algorithm explained above is easy to understand but of complexity O(n3). In May 1976, D. Defays proposed an optimally efficient algorithm of only complexity O(n2) 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 (a), Bacillus stearothermophilus (b), Lactobacillus viridescens (c), Acholeplasma modicum (d), and Micrococcus luteus (e).

First step First clustering Let us assume that we have five elements (a,b,c,d,e) and the following matrix D1 of pairwise distances between them:

In this example, D1(a,b)=17 is the smallest value of D1, so we join elements a and b.

First branch length estimation Let u denote the node to which a and b are now connected. Setting δ(a,u)=δ(b,u)=D1(a,b)/2 ensures that elements a and b are equidistant from u. This corresponds to the expectation of the ultrametricity hypothesis. The branches joining a and b to u then have lengths δ(a,u)=δ(b,u)=17/2=8.5 (see the final dendrogram)

First distance matrix update We then proceed to update the initial proximity matrix D1 into a new proximity matrix D2 (see below), reduced in size by one row and one column because of the clustering of a with b. Bold values in D2 correspond to the new distances, calculated by retaining the maximum distance between each element of the first cluster (a,b) and each of the remaining elements: D2((a,b),c)=max(D1(a,c),D1(b,c))=max(21,30)=30 D2((a,b),d)=max(D1(a,d),D1(b,d))=max(31,34)=34 D2((a,b),e)=max(D1(a,e),D1(b,e))=max(23,21)=23 Italicized values in D2 are not affected by the matrix update as they correspond to distances between elements not involved in the first cluster.

Second step Second clustering We now reiterate the three previous steps, starting from the new distance matrix D2 :

Here, D2((a,b),e)=23 is the lowest value of D2, so we join cluster (a,b) with element e.

Second branch length estimation Let v denote the node to which (a,b) and e are now connected. Because of the ultrametricity constraint, the branches joining a or b to v, and e to v, are equal and have the following total length: δ(a,v)=δ(b,v)=δ(e,v)=23/2=11.5 We deduce the missing branch length: δ(u,v)=δ(e,v)−δ(a,u)=δ(e,v)−δ(b,u)=11.5−8.5=3 (see the final dendrogram)

Second distance matrix update We then proceed to update the D2 matrix into a new distance matrix D3 (see below), reduced in size by one row and one column because of the clustering of (a,b) with e : D3(((a,b),e),c)=max(D2((a,b),c),D2(e,c))=max(30,39)=39 D3(((a,b),e),d)=max(D2((a,b),d),D2(e,d))=max(34,43)=43

Third step Third clustering We again reiterate the three previous steps, starting from the updated distance matrix D3.

Here, D3(c,d)=28 is the smallest value of D3, so we join elements c and d.

Third branch length estimation Let w denote the node to which c and d are now connected. The branches joining c and d to w then have lengths δ(c,w)=δ(d,w)=28/2=14 (see the final dendrogram)

Third distance matrix update There is a single entry to update: D4((c,d),((a,b),e))=max(D3(c,((a,b),e)),D3(d,((a,b),e)))=max(39,43)=43

Final step The final D4 matrix is:

So we join clusters ((a,b),e) and (c,d). Let r denote the (root) node to which ((a,b),e) and (c,d) are now connected. The branches joining ((a,b),e) and (c,d) to r then have lengths: δ(((a,b),e),r)=δ((c,d),r)=43/2=21.5 We deduce the two remaining branch lengths: δ(v,r)=δ(((a,b),e),r)−δ(e,v)=21.5−11.5=10 δ(w,r)=δ((c,d),r)−δ(c,w)=21.5−14=7.5

The complete-linkage dendrogram

… excerpt ends here. Continue reading the full article.

Illustrations

Complete-linkage clustering illustration
Complete-linkage clustering illustration
Complete-linkage clustering illustration

Worked examples

Example 1 — a first encounter with Complete-linkage clustering

Start with the simplest possible case. Write down what Complete-linkage clustering claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Complete-linkage clustering before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Complete-linkage clustering ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Complete-linkage clustering

In research
Complete-linkage clustering appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Complete-linkage clustering in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Complete-linkage clustering is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bioinformatics algorithms, Cluster analysis algorithms, Computational phylogenetics, so understanding it makes those chapters shorter.
In everyday life
Look for Complete-linkage clustering outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Complete-linkage clustering” →

How to study Complete-linkage clustering in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Complete-linkage clustering means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Complete-linkage clustering out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Complete-linkage clustering in simple terms?

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.

Why does Complete-linkage clustering matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Complete-linkage clustering?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Complete-linkage clustering.

Tags

  • Bioinformatics algorithms
  • Cluster analysis algorithms
  • Computational phylogenetics

Keep exploring