Constrained Graph Clustering: A Spectral Algorithm with Generalized Eigenvectors

Shihong Song, He SunNeurIPS 2026

TL;DR

Standard clustering groups similar data points together, while constrained clustering adds explicit rules about which points must be grouped together and which cannot. This paper introduces a fast, theoretically grounded spectral algorithm that solves $k$-way constrained graph clustering using generalized eigenvectors—and shows how to bootstrap its own "cannot-link" rules to dramatically improve clustering even when you aren't given any constraints upfront.

What Problem Does This Paper Address?

Imagine organizing guests at $k$ wedding tables. You have a graph $G$ of friendships ("must-link" constraints: keep them together) and a graph $H$ of bitter rivalries ("cannot-link" constraints: separate them). Mathematically, you want to partition the graph into $k$ clusters while minimizing the cut-ratio: the weight of severed friendships divided by the weight of separated rivals, $\frac{w_G(S, V \setminus S)}{w_H(S, V \setminus S)}$.

Historically, constrained graph clustering suffered from a divide between theory and practice:

  1. Theory stopped at $k=2$: Rigorous mathematical guarantees mostly existed only for splitting a graph into two pieces.
  2. Multi-cluster ($k > 2$) lacked guarantees: Existing algorithms for $k > 2$ relied on complex heuristics without provable approximation bounds.
  3. Missing constraints: What if nobody tells you who the rivals are (i.e., graph $H$ is missing)? Standard constrained methods simply can't run.

Methods

Classic spectral clustering embeds graph nodes into Euclidean space using the bottom $k$ eigenvectors of $G$'s Laplacian matrix, then runs $k$-means. To weave in the "cannot-link" graph $H$, the authors propose Constrained Spectral Clustering (CSC):

  • Generalized Eigenvectors: Instead of looking at $G$'s Laplacian alone, CSC computes the bottom $k$ generalized eigenvectors satisfying $\mathcal{L}_G f_i = \lambda_i \mathcal{L}_H f_i$ (normalized by maximum node degrees across both graphs).
  • Gram-Schmidt Orthogonalization (The Secret Sauce): Standard eigenvectors of symmetric matrices are naturally perpendicular, creating a clean coordinate space for $k$-means. Generalized eigenvectors are not necessarily orthogonal, resulting in a warped embedding space. CSC applies the Gram-Schmidt process to orthogonalize these vectors while preserving the exact subspace they span, then runs $k$-means.
  • Fast Solver: To keep things snappy, CSC approximates the generalized eigenvectors using a fixed 100 iterations of the LOBPCG solver.
Figure 1: The relationship of the vectors involved in proving Theorem 3.

For cases where the cannot-link graph $H$ doesn't exist, the authors introduce Iterative Constrained Spectral Clustering (ICSC). It runs standard spectral clustering on $G$ first, then builds a sparse synthetic $H$ by connecting each node to $O(\log n)$ random nodes from different predicted clusters, and feeds both into CSC—repeating the loop to progressively sharpen the clusters.

Datasets

The authors evaluate their algorithms on existing benchmarks (no new datasets are introduced):

  • Synthetic Data: Graphs generated via the Stochastic Block Model (SBM) up to $n = 10,000$ vertices and $k=10$ clusters, varying intra- and inter-cluster edge probabilities ($p$ and $q$).
  • Real-World Image Datasets: MNIST, USPS, Pendigits, Optdigits, and Digits-8x8. Images become nodes connected to their 3-nearest neighbors to form $G$, while $H$ connects each node to 20 random nodes of different ground-truth labels (or is generated from scratch in ICSC).

Key Insights and Ideas

  • First $O(1)$-Approximation for $k$-way Constrained Clustering: Under a natural assumption that the graph actually contains $k$ well-defined clusters, CSC is the first polynomial-time algorithm proven to achieve a constant-factor approximation of the optimal maximum cut-ratio for any $k$.
  • Why Orthogonalization Matters: Looking for $k$ disjoint clusters is equivalent to searching for $k$ mutually orthogonal indicator vectors. Because generalized eigenvectors aren't orthogonal, they can't directly approximate cluster indicators well; Gram-Schmidt fixes the geometry without losing spectral information (as mapped out in Figure 1).
  • Self-Bootstrapping Works via Spectral Sparsification: When ICSC invents a cannot-link graph from noisy initial clusters, connecting nodes to just $O(\log n)$ outsiders creates a spectral sparsifier of a complete $k$-partite graph. This guarantees high graph expansion (conductance), mathematically weakening the assumptions needed for the next round of clustering to succeed while keeping runtime low.

Key Results

  • Synthetic Benchmarks: On SBM graphs with known constraints, CSC consistently matches or beats all baselines in Adjusted Rand Index (ARI), maintaining high accuracy even as cluster boundaries blur (as $q$ approaches $p=0.2$).
Figure 2: Comparison of the performance (ARI) between CSC and baselines.
  • Real-World Accuracy: CSC achieves the highest ARI and Normalized Mutual Information (NMI) across all five image datasets. On MNIST, CSC hits 0.911 ARI compared to standard spectral clustering's 0.561 and the best baseline's 0.736. On Pendigits, Optdigits, and Digits-8x8, CSC reaches 0.984 ARI.
  • Bootstrapping Without Constraints (ICSC): With zero ground-truth cannot-link info, ICSC doubles clustering quality on noisy synthetic graphs—lifting standard spectral clustering from <0.15 ARI to >0.30 ARI. On MNIST, 7 iterations of ICSC boost ARI from ~0.60 to over 0.75.
  • Speed: Thanks to LOBPCG, CSC is remarkably fast. On a 10,000-node SBM graph, CSC finishes in 8.10s, beating WQD (19.51s), CKCMP (58.67s), and LCA (103.60s). On MNIST ($n=5000$), it takes just 0.23s.

Limitations and Future Work

  • Well-Clustered Assumption: The theoretical $O(1)$-approximation relies on an eigengap-style assumption (Assumption 1)—meaning the input graphs must inherently possess a clear $k$-cluster structure. (Under the Unique Games Conjecture, strong worst-case approximations without assumptions are computationally impossible anyway.)
  • Proving ICSC Convergence: While ICSC reliably climbs to a performance plateau in experiments when generating its own constraints, it currently remains a heuristic pipeline. Rigorously proving why and when ICSC converges to a peak in ARI/NMI is left as an open theoretical question for future work.

Summary updated

Abstract

Given a must-link graph $G = (V, E_G)$ and a cannot-link graph $H=(V,E_H)$ as input, the objective of constrained clustering is to partition $V$ into $k$ parts while minimizing the maximum cut ratio between $G$ and $H$. In this paper we design and analyze a variant of the spectral clustering algorithm using the $k$ smallest generalized eigenvectors as the embedding space. We prove that our proposed algorithm achieves an $O(1)$-approximation of the optimal cut-ratio under a natural assumption on the input graphs. We further study the case in which the cannot-link constraints might not be available, and develop an iterative pipeline that repeatedly applies the output of spectral clustering or constrained clustering to generate new constraints, thereby progressively improving cluster quality. We experimentally compare our proposed algorithm with the previous state-of-the-art, and demonstrate the superior performance of our algorithms on both synthetic and real-world datasets.
BibTeX
@inproceedings{song2026constrained,
  author = {Shihong Song and He Sun},
  title = {{Constrained Graph Clustering: A Spectral Algorithm with Generalized Eigenvectors}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=aSBc9QvaeR},
}
Figure