Skip to content
AI & Machine Learning Medium #hierarchical#clustering#dendrogram

Hierarchical Clustering Dendrogram

Agglomerative bottom-up merges. Cut the tree at any height to choose cluster count.

A free, animated hierarchical clustering dendrogram you can read here or embed on any website, from Scrollchart.

Hierarchical Clustering Dendrogram

Hierarchical Clustering DendrogramWard linkage merges closest clusters bottom-up; cut height controls cluster count0.000.250.500.751.00DistanceABCDEFGHIJcut3 clusters2D dataLinkage rulesSinglemin pair distanceCompletemax pair distanceAveragemean all pairsWardmin variance gainKey propertyO(n²) memory;no k chosen upfront.Cut post-hoc.Agglomerative clustering needs no k upfront: pick the cut height after seeing the dendrogram

2D points iteratively merged by closest distance (single, complete, average, Ward linkage compared). The dendrogram builds in parallel. A horizontal cut produces N clusters; sliding the cut updates the cluster count live.

Good for

  • Exploratory data analysis tutorials showing how cluster count is chosen post-hoc from the dendrogram
  • Bioinformatics content on gene-expression heatmaps and phylogenetic trees
  • Customer segmentation articles comparing Ward linkage with k-means on the same dataset

Source & accuracy

This hierarchical clustering dendrogram is an editorial illustration built to represent the concept accurately. Where it shows figures, they are typical or representative values chosen to make the relationship clear, not a single underlying dataset. The diagram and its explainer are reviewed and maintained centrally, and updated over time as understanding improves.

Bottom-up merging: building the tree

Hierarchical agglomerative clustering starts with each point as its own cluster. Iteratively, the two closest clusters merge. As they merge, a dendrogram (tree diagram) records the merge and the distance at which it occurred. Keep merging until all points form a single cluster at the root. The dendrogram visually shows the merging history.

Unlike K-means, you do not need to specify the number of clusters up front. Instead, you 'cut' the dendrogram at any height (distance threshold) to retrieve clusters. Cut high, get few large clusters. Cut low, get many small clusters. This flexibility is powerful when cluster count is unknown.

Linkage: how distance is measured between clusters

The choice of linkage (how to compute distance between two clusters) changes the tree structure. Single linkage uses the distance between the two closest points in the clusters (can create long 'chains'). Complete linkage uses the farthest points (tends to form compact clusters). Average linkage uses the mean distance between all pairs of points. Ward linkage merges clusters to minimize the variance within resulting clusters, favoring balanced trees.

Single linkage is fast but prone to chaining (elongated clusters). Complete and Ward linkage produce more balanced dendrograms and tend to match human-perceived clusters better. Hierarchical clustering is slower than K-means on large datasets (quadratic or cubic time complexity), but the dendrogram provides richer information than a flat cluster assignment, making it popular in exploratory analysis and biology (e.g., gene sequencing).

Embed this diagram

Add this animated hierarchical clustering dendrogram to your own site. Copy one line of HTML, or use the embed builder for theme and sizing options.

Reference

What this is
A free, embeddable, animated hierarchical clustering dendrogram for any website.
Who uses it
AI/ML blogs, CS educators.
How to embed
Copy one line of HTML. No signup. No watermark. Works in WordPress, Webflow, Ghost, Substack, plain HTML.
File size
iframe embed, ~80 KB gzipped (loads on demand, does not block your page paint).
License
Free forever. Editorial explainer text included; updated centrally over time.

Embed format options

Copy the universal HTML snippet, the WordPress shortcode, or an iframe fallback - see the WordPress plugin page for details. Any format keeps the same Core Web Vitals profile and the same explainer text.

Embed snippet
<div data-scrollchart="hierarchical-clustering" data-scrollchart-v="1"></div>
<script src="https://scrollchart.com/embed.js" async></script>

Frequently asked questions

Where can I get a free animated "Hierarchical Clustering Dendrogram" for my website?
Scrollchart provides "Hierarchical Clustering Dendrogram" as a free, embeddable animated diagram you can add to any website with one line of HTML. No signup is required and there is no watermark. The diagram and its explainer text are served from scrollchart.com, so the embed stays current without any maintenance on your end.
How do I embed a hierarchical clustering dendrogram in a developer or tech blog?
Copy the one-line snippet from the Scrollchart diagram page and paste it into your post HTML. It works in any static site generator, CMS, or hand-coded HTML page. The embed is a thin loader, not an iframe, so the content is fully in your DOM.