arXiv:2610.07503stat.MLOct 2026

Manuscript Offprint

arXiv:2610.07503

Two-Sample Testing for Random Graphs without Vertex Correspondence

Soham Dan

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

Abstract

Two populations of graphs often have to be compared without any correspondence between their vertices, for instance when networks come from different communities, or when a graph generative model is evaluated against held-out graphs. We study how many graphs such an unaligned two-sample test needs, and which graph statistics can detect which differences. For an Erdős–Rényi null and a planted two-block difference that leaves every expected degree unchanged, we show that m≍t−3m \asymp t^{-3} graphs per group are necessary and sufficient when the per-graph signal-to-noise ratio is t<1t < 1. Signed triangle counts attain this rate, and the lower bound holds for every graph size. With aligned vertices m≍t−1m \asymp t^{-1} graphs suffice, so misalignment costs a factor of order t−2t^{-2}. When the triangle signal cancels, the rate becomes t−4t^{-4} and 4-cycles are needed. Statistics built from trees have exactly the same expectation under both hypotheses, and tests based on finitely many of them have asymptotically no power. In the graphon limit, this class includes degree distributions and message-passing graph neural network features. For a non-constant null, a generic difference is visible at first order, and a simple motif test attains the aligned order of sample size, suggesting that misalignment is costly mainly for differences that are invisible at low orders. We also give an exactly valid test for one or two graphs per group, at a cost in power. In our simulations, the fitted exponents are close to the predicted ones ( −3.04-3.04 against −3-3 for unaligned tests and −1.07-1.07 against −1-1 for aligned ones), and degree-based and random-GNN evaluation metrics stay at their level in a setting where signed triangles need about 65 graphs.

1 Introduction

A two-sample test for networks decides whether two samples of graphs come from the same distribution. Often the vertices of different graphs do not correspond, as with friendship networks of different schools, protein networks of different species, or molecules. The same is true when a graph generative model is evaluated, since its samples are compared with held-out graphs through degree distributions, clustering coefficients, subgraph counts or random graph-neural-network embeddings [You et al., 2018, O'Bray et al., 2022, Thompson et al., 2022, Krimmel et al., 2025]. Without a correspondence, a test can only use quantities that do not depend on how each graph is labelled.

With aligned vertices, the sample complexity of two-sample testing for inhomogeneous random graphs is well understood [Ghoshdastidar et al., 2020, Chatterjee et al., 2023]. Without alignment, many tests have been proposed [Maugis et al., 2020, Bravo-Hermsdorff et al., 2023, Shao et al., 2026, Tang et al., 2017, Sabanayagam et al., 2021], but two basic questions remain open: how many graphs are needed, and which statistics can detect which differences? In practice, an evaluation metric that is insensitive to a class of failures reports a good model however many samples are drawn.

In this paper, we study both questions for graphon models, in which every graph has its own latent vertex positions. Our results suggest that both answers depend on the lowest order at which a

Preprint.

difference becomes visible to label-invariant statistics, and this order can be high for differences that are easy to detect with aligned vertices.

• Sample complexity (Theorem 1). For an Erdős–Rényi null and a planted two-block difference that preserves every expected degree, with per-graph signal-to-noise ratio t<1t < 1, we prove that m≍t−3m \asymp t^{-3} graphs per group are necessary and sufficient and that signed triangles are optimal, with a lower bound that holds for every graph size. With aligned vertices m≍t−1m \asymp t^{-1} graphs suffice, so misalignment costs a factor of order t−2t^{-2}. When the triangle signal cancels, the rate becomes t−4t^{-4} and 4-cycles are needed (Proposition 1).

• Tree statistics (Theorem 2). If the null is regular and the difference preserves degrees, every tree density is exactly unchanged, and tests using finitely many tree statistics have asymptotic power equal to their level. Since degree statistics, colour refinement and message-passing graph neural networks are determined by tree densities on graphons [Grebík and Rocha, 2022, Böker, 2023, Böker et al., 2023], they cannot detect such differences either.

• Order of visibility (Theorem 3). For a non-constant null, a difference is generically visible at first order, and a motif test that does not know the null needs only order 1/t graphs, the aligned rate of Theorem 1. So the factor t−2t^{-2} in Theorem 1 reflects first-order invisibility.

• Few graphs and experiments. We give an exact permutation test for one graph per group (Proposition 2), and our simulations confirm the predicted exponents. Degree- and GNN-based metrics miss degree-preserving changes both in simulations and on protein graphs, where degree-corrected signed cycles reach power 1/2 with at most six graphs.

The second moment behind our lower bound for one graph is due to Mossel et al. [2015] and Banerjee [2018], Ghoshdastidar et al. [2017] use the same planted partition as a hard instance for one graph per group, and the sharp aligned threshold mt=1mt = 1 is known for sparse multilayer block models [Chatterjee et al., 2022]. The population bounds, their comparison with alignment, the distributional invariance of tree statistics and the first-order analysis are new.