arXiv:2611.04995cs.LGNov 2026

Manuscript Offprint

arXiv:2611.04995

Exact Selective Inference for Spectral Clustering via Piecewise-Constant Graph Perturbation

Naotoshi Nakamura

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Cluster labels are often used twice: first to discover groups, and then to test whether the discovered groups differ. This double use of the data makes ordinary two-sample pp-values anti-conservative. Selective inference fixes this by conditioning on the clustering event, but for spectral clustering the event appears difficult because the algorithm combines an affinity map, an eigendecomposition, and a rounding step.

We show that, for spectral clustering based on unweighted ε\varepsilon- or kk-nearest-neighbor graphs, the obstruction is the affinity construction rather than the eigendecomposition. Along the one-dimensional perturbation used by the truncated-χ\chi selective test, graph changes occur only at finitely many real roots of data-dependent quadratic distance comparisons. Between these breakpoints, the graph, Laplacian spectrum, embedding, rounding, and reported cluster pair are deterministic functions of a finite graph state. Consequently, in real arithmetic and under a known-scale spherical Gaussian model, the selection set is an exact finite union of intervals, yielding finite-sample selective pp-values for selected spectral-cluster pairs. The same argument gives feature-wise truncated-normal tests. We also record direct extensions to known feature covariance, eigengap-selected KK, and auxiliary-coordinate graphs. We validate null and partial-null calibration, operational power, numerical sensitivity, and model-scope diagnostics, and give a working-model PBMC algorithmic illustration. Smooth kernels such as RBF affinities fall outside the finite-state guarantee.

Keywords: selective inference; spectral clustering; post-clustering inference; graph homotopy; truncated pivots

1. Introduction

Clustering is routinely followed by a confirmatory step: having obtained clusters, the analyst asks whether two of them are truly different, for example whether their feature means differ. The naive approach, namely a two-sample test between the estimated clusters, is invalid, because the clusters were chosen by the data precisely to be separated, so the test rejects far too often even when no structure is present (the “double-dipping” problem (Ball et al., 2019)). Selective inference resolves this by conditioning on the event that the algorithm returned the clusters of interest (Lee et al., 2016; Gao et al., 2024).

For hierarchical clustering with squared-Euclidean Ward linkage, Gao et al. (2024) derived an exact selective test: under a spherical Gaussian model, the difference-in-means statistic follows a χ\chi distribution truncated to the set of perturbations that preserve the clusters, and that set is an analytically computable union of intervals. Chen and Witten (2023) extended the program to kk-means by conditioning on the iterates of Lloyd's algorithm. Subsequent work has extended post-clustering selective inference to convex clustering (Bachoc et al., 2025), dependent observations and features (González-Delgado et al.,

© 2026 N. Nakamura.

2026), and functional or longitudinal data (Zhu et al., 2024); see also the recent review of conditional selective inference by Neufeld et al. (2026). A parallel line based on parametric programming (Le Duy and Takeuchi, 2022) computes the same conditioning set by line search and has recently been assembled into a framework for multi-stage clustering pipelines (Miyata et al., 2026), whose component library covers distance-based outlier detection, variance/correlation feature selection, k-means and DBSCAN. A method-agnostic alternative, data thinning (Neufeld et al., 2024; Dharamshi et al., 2025), splits the data into independent parts and avoids conditioning by testing clusters selected on an independent noisy copy. This is valid, but it targets that randomized selection copy rather than the deterministic clustering returned on the observed data, which is our target.

Conspicuously absent from all of these is spectral clustering (Ng et al., 2001; von Luxburg, 2007), despite its ubiquity. Graph-based representations and decompositions are also central in genomic interaction analysis, including graph-cover formulations for Hi-C data and comparative evaluation of topological-domain callers on RNA-associated interactomes (Sefer, 2021; Alaygut and Sefer, 2026). Spectral clustering composes three operations: an affinity map, an eigendecomposition of a graph Laplacian, and a rounding step (k-means on the spectral embedding); and the eigendecomposition is the step that does not admit the polyhedral / linear-or-quadratic characterization of the selection event on which existing exact post-clustering inference relies (Gao et al., 2024; Bachoc et al., 2025; Le Duy and Takeuchi, 2022). It is therefore natural to suspect that the eigendecomposition is the obstruction. Our central observation is that it is not; the affinity construction is. We make this precise and instantiate an exact-in-real-arithmetic selective test. Many spectral clustering pipelines construct an unweighted ε\varepsilon- or k-nearest-neighbor graph before forming a graph Laplacian; our theorem targets exactly this graph-based regime, while smooth weighted kernels require separate analysis.