Fully-Dynamic Parallel Algorithms for Single-Linkage Clustering

Quinten De Man, Laxman Dhulipala, Kishen N Gowda

TL;DR

This paper introduces the first fully-dynamic, parallel, and batch-parallel algorithms for maintaining a single-linkage clustering hierarchy (dendrogram) under continuous data updates. By leveraging advanced dynamic tree structures, the proposed methods update the clustering tree significantly faster than recomputing it from scratch, achieving near-optimal theoretical bounds for both single and batched edge insertions and deletions.

What Problem Does This Paper Address?

Hierarchical agglomerative clustering (HAC) is a cornerstone of data science, used to discover multi-scale cluster structures in everything from computational biology to image analysis. Single-linkage clustering is a popular variant where the distance between two clusters is defined by their closest pair of points. The output is a single-linkage dendrogram (SLD)—a rooted binary tree illustrating the exact sequence of cluster merges.

An example of a single-linkage dendrogram (SLD) for an edge-weighted tree.

In the real world, datasets are rarely static; edges (similarities) are constantly inserted or deleted. While previous work succeeded in dynamically maintaining a Minimum Spanning Forest (MSF) of the data, an MSF does not explicitly give you the cluster hierarchy. To get the actual dendrogram, practitioners previously had to recompute it from scratch ($O(n \log h)$ time) for every single change. This paper tackles the challenge of explicitly maintaining the SLD structure under a fully-dynamic sequence of edge insertions and deletions without global recomputation.

Methods

The authors introduce DynSLD, a framework built on the insight that an edge update only alters localized paths—called "spines"—within the dendrogram.

Key algorithmic components include:

  • Rake-Compress (RC) Trees: The authors maintain the SLD using a secondary parallel dynamic tree data structure (an RC tree). This allows them to extract any cluster spine and perform path queries in $O(\log n)$ depth.
  • Spine-Merge & Unmerge Primitives: Insertions are handled by merging the characteristic spines of the affected components in sorted order of edge weights. Deletions are treated as the reverse, using connectivity queries on the input forest to "unmerge" a spine.
  • Path Weight Search (PWS) Query: For highly efficient, "output-sensitive" insertions, the authors design a new dynamic tree query. PWS instantly locates where a node should be inserted into a spine in $O(\log n)$ time, bypassing the need to traverse the entire spine.
  • Tree Contraction for Batches: To handle a batch of $k$ updates simultaneously, the algorithm uses parallel tree contraction to identify independent "star" configurations of updates, merging them concurrently using a novel Star-Merge technique.

Datasets

Not discussed in the paper. This is a purely theoretical paper focusing on algorithmic design and complexity analysis; no experimental evaluation on empirical datasets was conducted.

Key Insights and Ideas

  • Height-Bounded Updates Beat Static Recomputation: Even in the absolute worst-case scenario where the dendrogram height $h = n - 1$, the proposed sequential insertion ($O(h)$) and deletion ($O(h \log(1 + n/h))$) algorithms are asymptotically faster than the best static recomputation methods. If the tree is balanced (low $h$), the speedup is massive.
  • Output-Sensitivity: The authors prove that you don't even need to pay a cost proportional to the tree height $h$ for insertions. By using the PWS query and alternating between spines, the work can be bounded by $O(c \log(1 + n/c))$, where $c$ is the number of actual structural pointer changes in the dendrogram.
  • The Connection to Cartesian Trees: The paper formalizes a neat bridge between single-linkage dendrograms and Cartesian trees, showing that their dynamic SLD algorithms can directly yield the first worst-case $O(\log n)$ time algorithms for leaf updates in Cartesian trees.

Key Results

The paper establishes several breakthrough upper bounds for dynamic SLD maintenance:

Update Type Sequential Time Parallel Work Parallel Depth
Insertion $O(h)$ $O(h \log(1 + n/h))$ $O(\log n \log h)$
Deletion $O(h \log(1 + n/h))$ $O(h \log(1 + n/h))$ $O(\log n \log h)$
Output-Sensitive Insertion $O(c \log(1 + n/c))$ $O(c \log(1 + n/c))$ $O(\log n \log h)$
Batch Insertions (size $k$) — $O(k h \log(1 + n/(kh)))$ $O(\log n \log k \log(kh))$
Batch Deletions (size $k$) — $O(k h \log(1 + n/(kh)))$ $O(\log n \log(kh))$

(Where $n$ is the number of vertices, $h$ is the dendrogram height, and $c$ is the number of structural changes).

Limitations and Future Work

  • Asymmetric Deletions: While the authors achieved a near-optimal output-sensitive algorithm for edge insertions (scaling with $c$), doing the same for edge deletions remains an open problem.
  • Lack of Empirical Evaluation: The parallel algorithms are designed for the realistic binary fork-join model, making them great candidates for multi-core hardware. However, implementing these algorithms and evaluating their practical performance on real-world graphs is left for future work.
  • Batch Output-Sensitivity: Combining batch-parallelism with output-sensitivity (scaling with the total number of changes across a batch) is another unexplored frontier.

Summary updated

BibTeX
@inproceedings{man2025fully,
  author = {Quinten De Man and Laxman Dhulipala and Kishen N Gowda},
  title = {{Fully-Dynamic Parallel Algorithms for Single-Linkage Clustering}},
  booktitle = {SPAA},
  year = {2025},
  doi = {10.1145/3694906.3743315},
}
Figure