Playground / Linkage-Based Clustering

Merge the closest clusters, build a dendrogram

Linkage-Based Clustering

Interactive lab

Try it: Linkage-Based Clustering

How agglomerative clustering starts from singletons and repeatedly merges the two closest clusters under single (min), complete (max) or average linkage, building a dendrogram until a stopping rule (k clusters or distance threshold r) says stop.

How it works

  1. Start with every point in its own cluster and compute the distance matrix.
  2. Cluster distance: single = closest pair of members (minimum), complete = farthest pair (max linkage), average = mean over all pairs.
  3. Find the closest pair of current clusters (ties go to the pair listed first) and merge them; the cluster count drops by one.
  4. Update the new cluster's row of the distance matrix and record the merge height in the dendrogram.
  5. Stop when k clusters remain, or when every between-cluster distance is larger than r.

Default run (12 steps): 8 points, each its own cluster. Single linkage; stop when 3 clusters remain. … Done: 3 clusters — {A,B,C} {D,E,F,G} {H}.

Simplified: Toy 2-D data (3–10 points) with Euclidean distance. Real hierarchical clustering uses many more points, other distances and faster data structures.

Educational simulation

Loading the simulation…