Hierarchical clustering is used to group similar data points and organise data in a tree-like structure. Key part of this process is linkage which calculates the distance between clusters before they are merged or divided. Different types of linkage is used measure this distance differently. In this article, we’ll look at different linkage methods and see how they affect the cluster formation.
1. Single Linkage
For two clusters R and S the single linkage returns the minimum distance between two points. This method creates long, chain-like clusters because it is sensitive to outliers and can connect clusters based on a very small number of close points.
where
- D(i, j): Distance function between points i and j.

2. Complete Linkage
For two clusters R and S the complete linkage returns the maximum distance between two points. It tends to create compact and spherical clusters because it is more sensitive to outliers and tries to make sure that the clusters are not too far.
where
- D(i, j): Distance function between points i and j.

3. Average Linkage
It returns the average distance between all pairs of points from two clusters. This method maintain a balance between single and complete linkage by considering all pairs of points not just the closest or farthest point. It usually results in clusters that are moderately compact.
where
n_{R} : Number of data-points in Rn_{S} : Number of data-points in S

4. Ward's Linkage
It calculates the distance between two clusters by looking at total spread or variance increase when the clusters are combined. This method creates compact, well-separated clusters by making sure that data within each cluster is as similar as possible.
where
n_R andn_S are the sizes of clusters R and S- D(i, j) is the distance between points
i \in R andj \in S .

5. Centroid Linkage
It calculates the distance between two clusters based on the distance between their central points i.e the average of all points in the cluster. This method works well when clusters are round or evenly shaped but it may not be the best for irregularly shaped clusters.
where
\bar{R} and\bar{S} are the centroids (mean points) of clusters R and SD(\bar{R}, \bar{S}) is the distance between the centroids of clusters R and S.

Each linkage method has its own advantages and we can use them based on our needs and type of data we have.
Read More: