Faster Dynamic Graph Clustering with Hierarchical Contraction

Suranjan De, Steinar Laenen, He SunNeurIPS 2026

TL;DR

Real-world networks—like citation graphs and social media—constantly grow and shift, making it brutally expensive to re-discover their underlying communities from scratch. This paper introduces a clever "Russian nesting doll" data structure that compresses stable parts of a dynamic graph while unfolding volatile ones, slashing the time needed to query for clusters from nearly linear down to $\widetilde{O}(n^{1/d})$ with minimal overhead per update. If you’ve ever wondered how to get provably accurate communities out of a massive, ever-changing network almost instantaneously, this is how you do it.

What Problem Does This Paper Address?

Graph clustering—grouping nodes so they are more tightly connected to each other than to the rest of the network—is a foundational tool in machine learning. Spectral clustering is the gold standard here, using the eigenvalues and eigenvectors of a graph’s Laplacian matrix to find clean cuts.

However, real-world graphs aren't static snapshots; new edges and vertices stream in continuously, causing clusters to merge, split, or emerge from scratch. Re-running static spectral clustering on a million-node graph every time you want an updated view is computationally prohibitive. While heuristics exist to update embeddings incrementally, they often assume a fixed set of nodes or lack mathematical guarantees on cluster quality.

The previous state-of-the-art with rigorous theoretical guarantees (Laenen and Sun, ICML 2024) achieved fast $O(1)$ edge updates, but querying the current clusters still took $O(n / \log n)$ time—nearly linear in the graph's size $n$. When you need frequent snapshots of a massive network, near-linear queries quickly become a bottleneck.

Methods

The authors combine a standard technique—maintaining a lightweight "cluster-preserving sparsifier" (a sampled skeleton of the graph that keeps the mathematical essence of its clusters)—with two novel structural ideas:

  1. The Semi-Contracted Graph: Initially, every known cluster is squished ("contracted") into a single super-vertex, with edge weights representing the connections between clusters. As new edges arrive, the algorithm leaves massive clusters contracted, knowing they can absorb small perturbations without losing their identity. However, if a cluster has a small volume (relative to the number of recent updates), or if an individual vertex's degree doubles, the algorithm unfolds ("uncontracts") them back into individual vertices so emerging local structures can be seen. This alone drops amortised query time to $\widetilde{O}(n^{1/2})$.
Figure 1: Illustration of our technique. In Figure (a) (the left column), the black and red edges correspond to the edges of Gt and the newly added edges in Gt′, respectively. In Figure (b) (the middle column), the dashed black and red edges represent the corresponding additions in Ht and Ht′. Finally, in Figure (c) (the right column), the black and red edges denote the edges present in ˜︁Gt and ˜︁Gt′, respectively, and we show the bottom “uncontracted” cluster.
  1. Hierarchical Contraction: Why stop at one layer of compression? To break past the $n^{1/2}$ barrier (which comes from occasionally having to rebuild the contracted graph from scratch), the authors stack $d$ semi-contracted graphs on top of each other: $C_1, C_2, \dots, C_d$. Each level is a semi-contracted version of the level above it, shrinking geometrically in size. Deeper, tiny levels are rebuilt frequently from the level just above them, while shallow, larger levels are rebuilt rarely. When a query arrives, spectral clustering runs only on the tiniest bottom graph, $C_d$, yielding $\widetilde{O}(n^{1/d})$ query time at the cost of $O(d)$ amortised update time.

Datasets

No new benchmarks were introduced; the authors evaluated their algorithms on synthetic and established real-world networks converted into streaming edge-insertion workloads:

  • Synthetic Data: Graphs generated via the Stochastic Block Model (SBM) up to 50,000 vertices, simulating newly arriving clusters, merging clusters, and varying query frequencies.
  • Image $k$-NN Graphs: MNIST (70,000 images, 10 classes) and EMNIST letters (145,600 images, 26 classes), where new digit/letter classes are streamed in batches.
  • Large-Scale Networks: ogbn-arxiv (citation network with 169,343 vertices and ~1.16M edges streamed chronologically by publication year) and Reddit (232,965 vertices and ~34.8M edges, streaming new communities sequentially).

Key Insights and Ideas

  • Asymmetric Stability: Large communities have high inertia; adding a handful of edges won't suddenly destroy a 10,000-node cluster. Small clusters, however, are fragile and sensitive to new connections. Unfolding only small clusters and rapidly growing nodes lets the algorithm track structural shifts without paying to inspect the entire graph.
  • Amortising Rebuilds via Hierarchy: Re-clustering a full graph to refresh your compressed representation is expensive. By rebuilding level $i$ using level $i-1$ (which is already compressed) on a staggered schedule, you distribute the heavy lifting across updates so queries remain feather-light.
  • Explicit Speed-vs-Overhead Dial: The hierarchy depth $d$ acts as a tunable knob. Increasing $d$ pushes query times toward near-constant speeds while linearly increasing the background maintenance cost during updates.

Key Results

Across the board, the hierarchical approach matches the clustering accuracy—measured via Adjusted Rand Index (ARI) and Normalized Mutual Information (NMI)—of both full-graph spectral clustering and the 2024 Laenen & Sun (LS24) baseline, while drastically cutting query and total runtimes:

  • High-Frequency Queries (SBM): On a 50,000-node graph with 100 queries, LS24 exhibits steep linear query growth totaling nearly 300 seconds, whereas the hierarchical structure ($d=4$) keeps query times near-constant, finishing the entire workload (updates + queries) in under 50 seconds while maintaining ~0.95–1.00 ARI.
Figure 3: Query frequency analysis on dynamic SBM graphs (n = 50, 000, k = 5).
  • Evolving SBM Clusters: When introducing or merging clusters over 10 batches, total runtime peaks at ~50s for the hierarchical method versus ~120s for LS24, with matching ARI curves.
  • Real-World Scale: OnMNIST and EMNIST, queries become near-instantaneous. On the massive ogbn-arxiv and Reddit graphs, the hierarchical data structure achieves roughly a 4x speedup over full-graph spectral clustering and a 3x speedup over LS24 in cumulative total time, with only a modest dip in ARI/NMI on Reddit.

Limitations and Future Work

  • Insertion-Only Setting: The current model only handles incremental updates—new edges and vertices being added (such that the graph always stays connected). Extending these theoretical guarantees to a fully dynamic setting where edges and vertices can also be deleted remains an open problem.
  • Dynamic Gap Assumption: Like prior theoretical work, the guarantees rely on a mathematical assumption that the graph doesn't completely dissolve into unstructured mush—within a reasonable window of updates, well-defined clusters must exist.
  • Update Overhead Trade-off: Because maintaining deeper hierarchies incurs higher update times, the method shines brightest when queries are frequent; in workloads with millions of updates and almost zero queries, the maintenance overhead becomes more noticeable. Pushing query times even lower is highlighted as a direction for future work.

Summary updated

Abstract

We study clustering algorithms for dynamic evolving graphs $\{ G_t\}$, in which new edges (and potentially new vertices) are added into a graph, and the underlying cluster structure of the graph gradually changes over time. By designing a hierarchical data structure for dynamically maintaining the cluster structure of $\{ G_t\}$, we prove that the cluster structure of $G_T$ can be maintained with $O(d)$ amortised update time and $\widetilde{O}\left(n_T^{1/d}\right)$ amortised query time, for an arbitrary large constant $d$. This significantly improves the previous state-of-the-art (Laenen and Sun, ICML 2024), which requires $O(1)$ update time and $O(n_T/\log n_T)$ amortised query time. We further demonstrate this improvement with experiments on both synthetic and real-world datasets.
BibTeX
@inproceedings{de2026faster,
  author = {Suranjan De and Steinar Laenen and He Sun},
  title = {{Faster Dynamic Graph Clustering with Hierarchical Contraction}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=JDWJEQwXiU},
}
Figure