Introduction
Message-passing graph neural networks (MPNNs) [8 , 25 ] are widely used to learn functions on graphs, but their expressive power is limited by symmetries that message passing cannot break [17 , 31 ] . Random node features provide a powerful way to break these symmetries [1 , 6 , 10 , 24 ] . Specifically, continuous random features almost surely give every vertex a unique identifier, enabling universality at any fixed graph size [1 ] . However, these constructions require unbounded precision as graphs grow and do not guarantee that a fixed model can approximate a target uniformly across graph sizes. In practice, we want a trained model to handle larger graphs with a fixed architecture, parameters, and precision. This motivates studying size-uniform approximation, as well as how expressive power depends on the number of random bits per vertex.
Representing the same function across graph sizes is a prerequisite for size generalization, which aims to maintain performance on graphs larger than those seen during training [19 ] [32, 34]. This is essential for learned graph algorithms, particularly in combinatorial optimization, where larger instances may be too expensive to label for training. Neural algorithmic reasoning pursues this goal through inductive biases that favor algorithmic behavior [27 , 28 ] . Such biases, however, cannot yield size generalization if the model class cannot represent a computation across graph sizes. Recent work gives conditions for size-generalization guarantees [19 , 30 ] . Related work studies uniform expressivity for graph transformers and virtual-node MPNNs [22 ] , universality for transformers over arbitrary many context tokens [7 ] , and any-dimensional invariant universality [15 ] [33].
We ask which invariant graph functions a random-feature MPNN can approximate uniformly across graph sizes. To obtain deterministic predictions invariant under vertex relabeling, we consider the expected output over random initializations. Let T : G → R T:\mathcal{G}\to\mathbb{R} T : G → R be an invariant target function, F ‾ ( G ) : = E [ F ^ ( G ) ] \overline{F}(G):=\mathbb{E}[\widehat{F}(G)] F ( G ) := E [ F ( G )] for the population predictor, and set G N : = { G ∈ G : ∣ V ( G ) ∣ = N } \mathcal{G}_N:=\{G\in\mathcal{G}:|V(G)|=N\} G N := { G ∈ G : ∣ V ( G ) ∣ = N } . Fixed-size approximation allows an N N N -dependent predictor F N F_N F N with sup G ∈ G N ∣ F N ( G ) − T ( G ) ∣ ≤ ϵ \sup_{G\in\mathcal{G}_N}|F_N(G)-T(G)|\le\epsilon sup G ∈ G N ∣ F N ( G ) − T ( G ) ∣ ≤ ϵ while size-uniform approximation instead requires one predictor F F F , independent of N N N , with sup G ∈ G ∣ F ‾ ( G ) − T ( G ) ∣ ≤ ϵ \sup_{G\in\mathcal{G}}|\overline{F}(G)-T(G)|\le\epsilon sup G ∈ G ∣ F ( G ) − T ( G ) ∣ ≤ ϵ .
Previous work establishes universality for random-feature MPNNs [1 ] and gives specific algorithmic constructions [11 , 24 ] , but does not characterize how expressive power depends on the number of random bits per node feature and the number of independent evaluations. We develop a framework that quantifies these dependencies and identifies graph pairs that cannot be reliably distinguished with limited resources. Building on expectation-based analyses of randomized GNNs [11 , 12 , 13 ] , we study the functions these models represent in expectation and estimate them by averaging independent evaluations. This lets us use the same notions of approximation and distinguishability as for deterministic architectures [17 , 31 ] , while accounting for their statistical nature. In particular, we develop WL-based combinatorial bounds on distinguishability that translate into limitations on expected approximation.
We study size-uniform approximation for MPNNs with a size-independent Lipschitz constant in the initial random features. This covers mean, max, and order-normalized sum aggregation, as well as unnormalized sums on bounded-degree graphs, and matches the regime of the size-generalization results of Wittig et al. [30 ] . It also prevents models from extracting increasingly detailed node identities from vanishing numerical differences.
Our work Our central reduction shows that, for uniformly Lipschitz MPNNs, continuous random features can be replaced by random features taking finitely many values (which we call random colors drawn from a palette), with arbitrarily small uniform error in expected output. Hence, every invariant function approximable size-uniformly by a finite-dimensional continuous-random-feature MPNN is also size-uniformly approximable by a random-color MPNN. The palette size may depend on the target, accuracy, and model, but not on graph size. Continuous precision is thereby reduced to two discrete resources, the number of colors q q q and the number of independent trials s s s ; see Figure 1 for an overview.
Figure 1. Overview of our random-feature MPNN framework. Size-uniform quantization with a finite palette S ⊂ K S \subset K S ⊂ K . Here ( Q S x ) v = q S ( x v ) (Q_Sx)_v = q_S(x_v) ( Q S x ) v = q S ( x v ) , δ ( S ) = sup z ∈ K ∥ z − q S ( z ) ∥ \delta(S) = \sup_{z\in K}\lVert z-q_S(z)\rVert δ ( S ) = sup z ∈ K ∥ z − q S ( z )∥ , and F ‾ S ( G ) = E [ F ( G , Q S ξ G ) ] \overline{F}_S(G) = \mathbb{E}[F(G,Q_S\xi^G)] F S ( G ) = E [ F ( G , Q S ξ G )] . Both branches use the same MPNN and coupled initializations.
Using CFI graph families [4 ] , we construct an invariant target that no uniformly Lipschitz random-feature MPNN can approximate uniformly across sizes, even on graphs of bounded diameter. The corresponding n n n -vertex pairs are separated by (folklore) 2-dimensional Weisfeiler–Leman (2-WL). A random-color MPNN using q q q colors requires at least s s s independent trials per graph to distinguish them with success probability at least 2/3, where q 10 log ( 3 s ) = Ω ( n ) q^{10 \log(3s)} = \Omega(n) q 10 l o g ( 3 s ) = Ω ( n ) . Thus, additional colors can be exponentially more effective than additional trials on these instances. In addition, random-color MPNNs and higher-order k k k -dimensional Weisfeiler–Leman (k k k -WL) are also incomparable, i.e., for every fixed k k k , a two-color, one-trial MPNN separates a pair that k k k -WL does not, while for every fixed palette and trial budget, 2-WL separates a pair that the random-color model does not.
Finite colors nevertheless support useful size-uniform computations, including color coding for fixed-tree subgraph detection [2 ] and a local MST edge task. Building on Wittig et al. [30 ] , a randomized finite-cover argument then links the represented function class to size-generalization guarantees.
Contributions In summary, our main contributions are as follows.
Framework for randomized expressivity. We develop a population-level framework for random-feature MPNNs, allowing their expressive power to be studied through invariant function approximation, graph distinguishability, and comparisons with the Weisfeiler–Leman hierarchy (§ 2 ).
Size-uniform characterization. We reduce continuous random features to discrete random features (Theorem 3 and Corollary 4) and prove that random-feature MPNNs are not size-uniformly universal (Corollary 6).
Expressivity results. We establish strict color and trial hierarchies for statistical distinguishability by random-color WL (Theorem 7 ), quantify their tradeoff using CFI graphs (Theorem 5), and prove incomparability with higher-order Weisfeiler–Leman (Theorem 8 ).
Scalable computation and learning. We give finite-color constructions for structural algorithms (Theorem 9 and Proposition 10 ), and give sufficient conditions for size-uniform generalization from a suitable finite training set (Theorem 11 ).
Related work Loukas [16 ] showed that MPNNs equipped with unique node identifiers, sufficient expressive message and update functions, and sufficient depth and width can simulate arbitrary distributed computations and, in particular, are Turing complete. Vignac et al. [29 ] incorporated one-hot node identifiers into an equivariant structural message-passing architecture, making the resulting representation independent of the particular identifier assignment.
Randomization offers another route to individualization. Dasoulas et al. [6 ] showed that random node colorings can break symmetries and substantially strengthen MPNNs, while Sato et al. [24 ] demonstrated that random features enable MPNNs to simulate randomized local algorithms and improve approximation guarantees for combinatorial optimization problems. Rosenbluth et al. [21 ] showed that a recurrent GNN with random vertex features can simulate any polynomial-time graph algorithm on connected graphs in polynomial time. GNNs with random node initialization are universal approximators for invariant graph functions on fixed-size graph domains [1 , 9 ] . Pellizzoni et al. [20 ] subsequently analyzed both the expressivity and statistical sample complexity of node-individualized GNNs, establishing more favorable sample-complexity bounds for permutation-equivariant individualization schemes. Kanatsoulis and Ribeiro [11 , 12 ] proved that MPNNs with random features could compute graph properties that standard MPNNs could not, showing that random features can overcome the expressivity limitations of anonymous message passing [31 ] by acting as probabilistic node identifiers. Their guarantees, however, primarily concern fixed-size expressivity or approximation on bounded graph domains and do not characterize when symmetry breaking yields a scalable algorithmic representation that transfers across graph sizes.
Formal Framework
Here, we outline our framework for analyzing MPNNs with random node features. We study the invariant function defined by a model’s expected output and ask whether a fixed model can approximate a target uniformly over graph sizes. To control the precision required of the random features, we impose a graph-size-independent Lipschitz bound on the output with respect to the initial features. We then connect population approximation to statistical graph distinguishability using finite color palettes and independent trials.
Randomized MPNNs
Let G \mathcal{G} G be a class of finite graphs and let K ⊂ R d K \subset\mathbb{R}^{d} K ⊂ R d be a compact node-feature space equipped with a probability distribution ρ K \rho_K ρ K .
A depth-D D D MPNN initializes h G ( 0 ) ( v ) : = x v ∈ R d h_G^{(0)}(v) := x_v \in\mathbb{R}^{d} h G ( 0 ) ( v ) := x v ∈ R d , d > 0 d>0 d > 0 , and updates its representations for ℓ ∈ { 0 , … , D − 1 } \ell\in\{0,\ldots,D-1\} ℓ ∈ { 0 , … , D − 1 } according to
m G ( ℓ ) ( v ) : = AGG ℓ ( { h G ( ℓ ) ( u ) : u ∈ N G ( v ) } ) , m_G^{(\ell)}(v) := \operatorname{AGG}_{\ell}\left(\left\{h_G^{(\ell)}(u):u\in N_G(v)\right\}\right), m G ( ℓ ) ( v ) := AGG ℓ ( { h G ( ℓ ) ( u ) : u ∈ N G ( v ) } ) ,
h G ( ℓ + 1 ) ( v ) : = σ ( W s e l f ( ℓ ) h G ( ℓ ) ( v ) + W a g g ( ℓ ) m G ( ℓ ) ( v ) + b ( ℓ ) ) . h_G^{(\ell+1)}(v) := \sigma\left(W_{\mathrm{self}}^{(\ell)}h_G^{(\ell)}(v)+W_{\mathrm{agg}}^{(\ell)}m_G^{(\ell)}(v)+b^{(\ell)}\right). h G ( ℓ + 1 ) ( v ) := σ ( W self ( ℓ ) h G ( ℓ ) ( v ) + W agg ( ℓ ) m G ( ℓ ) ( v ) + b ( ℓ ) ) .
where σ \sigma σ is coordinate-wise ReLU and b ( ℓ ) b^{(\ell)} b ( ℓ ) is a bias shared by all vertices. We consider mean, max, min, and order-normalized sum aggregation; the detailed hypothesis classes are specified in Section A.2. A graph-level MPNN applies a permutation-invariant readout function READOUT to the final node representations to produce a scalar output F ( G , x ) F(G,x) F ( G , x ) , where x = ( x v ) v ∈ V ( G ) x=(x_v)_{v\in V(G)} x = ( x v ) v ∈ V ( G ) denotes the collection of initial node features.
For G ∈ G G\in\mathcal{G} G ∈ G , a random initialization assigns each vertex an independent random feature drawn from ρ K \rho_K ρ K ,
ξ G = ( ξ v ) v ∈ V ( G ) , ξ v ∼ i . i . d . ρ K . \xi^G=(\xi_v)_{v\in V(G)}, \qquad\xi_v \overset{\mathrm{i.i.d.}}{\sim}\rho_K. ξ G = ( ξ v ) v ∈ V ( G ) , ξ v ∼ i.i.d. ρ K .
The resulting random-feature MPNN has output F ( G , ξ G ) F(G,\xi^G) F ( G , ξ G ) . When the support of ρ K \rho_K ρ K comprises finitely many points, we call the corresponding random features random colors to emphasize their discrete nature, and we refer to the support as the palette. An MPNN with such an initialization is called a random-color MPNN . The color distribution need not be uniform. We consider graphs that are not given node attributes as input and are instead assigned random attributes. It is straightforward to extend our setting to graphs with input node attributes that are concatenated with the random initialization.
Size-uniform approximation
A single initialization produces a random output. Taking its expectation gives a deterministic graph invariant whose approximation power we can analyze. For a graph-level MPNN F F F with fixed parameters, we write its population predictor as
F ‾ ( G ) : = E [ F ( G , ξ G ) ] . \overline{F}(G) := \mathbb{E}[F(G,\xi^G)]. F ( G ) := E [ F ( G , ξ G )] .
Size-uniform approximation requires a single model to achieve the desired accuracy throughout the graph domain, including on arbitrarily large graphs when these belong to the domain.
Definition 1 (Size-uniform approximation). For a graph class G \mathcal{G} G and a graph invariant T T T , a class F \mathcal{F} F of random-feature MPNNs uniformly approximates T T T if, for every ε > 0 \varepsilon> 0 ε > 0 , there exists a single F ∈ F F \in\mathcal{F} F ∈ F with
sup G ∈ G ∣ F ‾ ( G ) − T ( G ) ∣ ≤ ε . \sup_{G \in\mathcal{G}} \lvert\overline{F}(G) - T(G) \rvert\le\varepsilon. G ∈ G sup ∣ F ( G ) − T ( G )∣ ≤ ε . In particular, if G \mathcal{G} G contains graphs of arbitrarily large size, we call this approximation size-uniform. The class F \mathcal{F} F is a size-uniform universal approximator for graph invariants if G \mathcal{G} G contains all finite graphs and it uniformly approximates every graph invariant T : G → R T : \mathcal{G} \to\mathbb{R} T : G → R .
To replace continuous features by finitely many colors, we need small nodewise perturbations to have a controlled effect on the output even as graphs grow. We therefore require a Lipschitz bound that is independent of graph size. Specifically, fix a norm ∥ ⋅ ∥ \lVert\cdot\rVert ∥ ⋅ ∥ on R d \mathbb{R}^{d} R d and use the max-over-nodes input norm ∥ x ∥ i n : = max v ∈ V ( G ) ∥ x v ∥ \lVert x \rVert_{\mathrm{in}} := \max_{v \in V(G)} \lVert x_v \rVert ∥ x ∥ in := max v ∈ V ( G ) ∥ x v ∥ . This norm measures the largest perturbation at any vertex.
Definition 2 (Uniform Lipschitzness). An MPNN F F F is uniformly L L L -Lipschitz with respect to ∥ ⋅ ∥ i n \lVert\cdot\rVert_{\mathrm{in}} ∥ ⋅ ∥ in if, for every graph G G G and all x , x ′ ∈ K V ( G ) x,x' \in K^{V(G)} x , x ′ ∈ K V ( G ) ,
∣ F ( G , x ) − F ( G , x ′ ) ∣ ≤ L ∥ x − x ′ ∥ i n . \lvert F(G,x) - F(G,x') \rvert\le L \lVert x - x' \rVert_{\mathrm{in}}. ∣ F ( G , x ) − F ( G , x ′ )∣ ≤ L ∥ x − x ′ ∥ in .
The same constant L L L applies to every graph. Consequently, perturbing each initial feature by at most δ \delta δ changes the output by at most L δ L\delta L δ , independently of the number of vertices. This is the stability property used in our quantization argument. The following lemma shows that it holds for several standard MPNN architectures.
Lemma 1 (Uniform Lipschitzness of standard MPNNs). For fixed depth, widths, and parameters, ReLU MPNNs with mean, max, min, or order-normalized sum aggregation and mean pooling are uniformly Lipschitz. The same holds for unnormalized sum aggregation on graph classes of bounded degree.
The proof is given in Section A.4.
Colors, trials, and distinguishability
The population predictor describes the function represented in expectation. We next ask how reliably finitely many evaluations can estimate this function and reveal differences between graphs.
We refer to a single evaluation with an independent random initialization as a trial . For an MPNN F F F , draw s s s independent initializations ξ 1 G , … , ξ s G \xi_1^G,\ldots,\xi_s^G ξ 1 G , … , ξ s G and define
F ^ s ( G ) : = 1 s ∑ i = 1 s F ( G , ξ i G ) . (1) \widehat{F}_s(G) := \frac{1}{s}\sum_{i=1}^{s} F(G,\xi_i^G). \tag*{(1)} F s ( G ) := s 1 i = 1 ∑ s F ( G , ξ i G ) . (1)
Then E [ F ^ s ( G ) ] = F ‾ ( G ) \mathbb{E}[\widehat{F}_s(G)] = \overline{F}(G) E [ F s ( G )] = F ( G ) for every s s s , so the number of trials affects estimation but not the represented population function.
Graph-pair distinguishability connects this estimation problem to expressivity: approximating a target that takes different values on two graphs requires separating their population outputs. We measure this separation by the population gap gap F ( G , H ) : = ∣ F ‾ ( G ) − F ‾ ( H ) ∣ \operatorname{gap}_F(G,H) := \lvert\overline{F}(G) - \overline{F}(H) \rvert gap F ( G , H ) := ∣ F ( G ) − F ( H )∣ . Write D K : = sup u , v ∈ K ∥ u − v ∥ D_K := \sup_{u,v \in K} \lVert u-v \rVert D K := sup u , v ∈ K ∥ u − v ∥ for the diameter of the feature space.
For inputs A , B ∈ { G , H } A,B \in\{G,H\} A , B ∈ { G , H } , compute empirical means F ^ s ( A ) \widehat{F}_s(A) F s ( A ) and F ^ s ′ ( B ) \widehat{F}'_s(B) F s ′ ( B ) from two independent batches of s ∈ N s \in\mathbb{N} s ∈ N trials, even when A = B A=B A = B . For a margin Δ > 0 \Delta> 0 Δ > 0 , the test of H 0 : A = B H_0:A=B H 0 : A = B against H 1 : A ≠ B H_1:A \ne B H 1 : A = B rejects H 0 H_0 H 0 when ∣ F ^ s ( A ) − F ^ s ′ ( B ) ∣ > Δ / 2 \lvert\widehat{F}_s(A)-\widehat{F}'_s(B) \rvert> \Delta/2 ∣ F s ( A ) − F s ′ ( B )∣ > Δ/2 . The following proposition shows that a positive population gap can be detected with a number of trials that depends on the gap and the model’s feature sensitivity, but not on graph size.
Proposition 2 (Population separation yields finite-trial distinguishability). Let F F F be uniformly L L L -Lipschitz, and fix G , H ∈ G G,H \in\mathcal{G} G , H ∈ G with gap F ( G , H ) ≥ Δ > 0 \operatorname{gap}_F(G,H) \ge\Delta> 0 gap F ( G , H ) ≥ Δ > 0 . For any α ∈ ( 0 , 1 / 2 ) \alpha\in(0,1/2) α ∈ ( 0 , 1/2 ) , the test above has probability of error at most α \alpha α for every A , B ∈ { G , H } A,B \in\{G,H\} A , B ∈ { G , H } whenever the number of trials is greater than
8 L 2 D K 2 Δ 2 log 2 α . \frac{8L^2D_K^2}{\Delta^2}\log\frac{2}{\alpha}. Δ 2 8 L 2 D K 2 log α 2 .
The proof is given in Section A.
To prove limitations on finite-trial testing, we use random-color Weisfeiler–Leman (random WL). Each trial independently colors the vertices and applies standard Weisfeiler–Leman refinement. An arbitrary test then compares the resulting patterns across trials. These patterns contain enough information to determine the output of an MPNN on the same colored graph. Thus, for uniform q q q -color initializations, limitations of random-color WL also apply to the corresponding random-color MPNNs, including tests that use more than their empirical means.
Definition 3 (Random-color WL distinguishability). Let q , s ∈ N q,s \in\mathbb{N} q , s ∈ N and α ∈ ( 0 , 1 / 2 ) \alpha\in(0,1/2) α ∈ ( 0 , 1/2 ) . A non-isomorphic pair G , H G,H G , H is statistically ( q , s , α ) (q,s,\alpha) ( q , s , α ) -distinguishable by random-color WL if a randomized binary test ψ \psi ψ satisfies
max A , B ∈ { G , H } Pr ( ψ ( Z A , Z B ′ ) ≠ 1 { A ≠ B } ) ≤ α , \max_{A,B \in\{G,H\}} \Pr\bigl(\psi(Z_A,Z'_B) \ne\mathbb{1}\{A \ne B\}\bigr) \le\alpha, A , B ∈ { G , H } max Pr ( ψ ( Z A , Z B ′ ) = 1 { A = B } ) ≤ α , where Z A , Z B ′ Z_A,Z'_B Z A , Z B ′ are independent batches of s s s 1-WL patterns from independent uniform q q q -colorings of A A A and B B B , respectively.
Here, q q q controls the number of colors available within each trial, while s s s controls the number of independent observations. The full construction and statistical reductions are in Section A and Definition 6. These notions complete the connection to function approximation. By Proposition 2, a lower bound ruling out successful testing at a sufficiently large trial budget also rules out the corresponding population gap. Such a bound limits how accurately the model can approximate a target that assigns different values to the two graphs. We formalize the resulting obstruction to size-uniform universality in Corollary 14 in Appendix § 10 .§ 6 .
Expressivity Bounds
We now analyze the expressive power of random-feature MPNNs across graph sizes. We first show that uniform Lipschitzness lets us replace continuous random features with finite random colors, and use this reduction to establish non-universality. We then prove strict color and trial hierarchies for statistical distinguishability and establish incomparability with higher-order Weisfeiler–Leman methods.
From continuous features to random colors
We begin by using uniform Lipschitzness to quantize random features with an error independent of graph size. Let S ⊂ K S \subset K S ⊂ K be a finite palette and let q S : K → S q_S: K \to S q S : K → S be a quantization map taking every point in K K K to its nearest point in S S S , with δ ( S ) : = sup z ∈ K ∥ z − q S ( z ) ∥ \delta(S) := \sup_{z \in K} \lVert z - q_S(z) \rVert δ ( S ) := sup z ∈ K ∥ z − q S ( z )∥ . Applying q S q_S q S to each node gives ( Q S x ) v = q S ( x v ) (Q_Sx)_v = q_S(x_v) ( Q S x ) v = q S ( x v ) , and we consider the quantized population predictor F ‾ S ( G ) : = E [ F ( G , Q S ξ G ) ] \overline{F}_S(G) := \mathbb{E}[F(G,Q_S\xi_G)] F S ( G ) := E [ F ( G , Q S ξ G )] .
Theorem 3 (Size-uniform quantization). Let F F F be a uniformly L L L -Lipschitz MPNN with random features supported on compact K K K . For every finite palette S ⊂ K S \subset K S ⊂ K ,
sup G ∈ G ∣ F ‾ S ( G ) − F ‾ ( G ) ∣ ≤ L δ ( S ) . \sup_{G \in\mathcal{G}} \left| \overline{F}_S(G) - \overline{F}(G) \right| \le L\delta(S). G ∈ G sup F S ( G ) − F ( G ) ≤ L δ ( S ) .
The result follows as ∥ x − Q S x ∥ i n ≤ δ ( S ) \lVert x - Q_Sx \rVert_{\mathrm{in}} \le\delta(S) ∥ x − Q S x ∥ in ≤ δ ( S ) is independent of the number of nodes and Lipschitzness bounds the output change by L δ ( S ) L\delta(S) L δ ( S ) . Compactness ensures the existence of finite palettes S S S with arbitrarily small δ ( S ) \delta(S) δ ( S ) . For a concrete example, consider uniform features on [ 0 , 1 ] d [0,1]^d [ 0 , 1 ] d . An m m m -level grid per coordinate gives quantization to m d m^d m d equally likely colors and quantization error at most L d 2 m \frac{L\sqrt{d}}{2m} 2 m L d .
Corollary 4 (Finite colors suffice). Every graph invariant size-uniformly approximable by uniformly Lipschitz MPNNs with compactly supported random features is also size-uniformly approximable by uniformly Lipschitz random-color MPNNs.
Intuitively, this corollary follows as a sufficiently fine palette preserves a model’s output up to arbitrarily small error. Uniform Lipschitzness then ensures that this same palette remains sufficient as graphs grow. The palette may need to become finer as we demand more accurate approximation, but it need not grow with graph size.
In addition to palettes generated by quantization, we will also consider palettes that are one-hot encodings of colors. We show that these palettes have equivalent approximation power in Section B.
Non-universality and trial lower bounds
We now use quantization to establish limitations on size-uniform approximation. We construct a pair of non-isomorphic graphs using Cai–Fürer–Immerman gadgets [4 ] that require an exponential number of trials to distinguish.
Theorem 5 (Exponential trial requirement). There exist non-isomorphic connected graph pairs ( G k , H k ) (G_k,H_k) ( G k , H k ) , with n k → ∞ n_k \to\infty n k → ∞ vertices and diameter 2 2 2 , such that statistical ( q , s , 1 / 3 ) (q,s,1/3) ( q , s , 1/3 ) -distinguishability by random-color WL requires
s = exp ( Ω ( n k q 10 ) ) s = \exp\left(\Omega\left(\frac{n_k}{q^{10}}\right)\right) s = exp ( Ω ( q 10 n k ) ) for q ≥ 2 q \ge2 q ≥ 2 .
The pair ( G k , H k ) (G_k,H_k) ( G k , H k ) is built from many copies of the 1 1 1 -WL-indistinguishable pair 2 C 3 2\mathcal{C}_3 2 C 3 and C 6 \mathcal{C}_6 C 6 , connected by CFI gadgets so that hiding the distinction within any one pair also hides the distinction between G k G_k G k and H k H_k H k . For a fixed palette, the 2 C 3 2\mathcal{C}_3 2 C 3 and C 6 \mathcal{C}_6 C 6 blocks in each pair are both monochromatic with constant probability, independently across pairs. When this happens, WL cannot distinguish the 2 C 3 2\mathcal{C}_3 2 C 3 and C 6 \mathcal{C}_6 C 6 blocks. The probability that a trial avoids all such events is then exponentially small in graph size, so exponentially many trials are required. These graph pairs can be used to construct a graph invariant taking value 1 on G k G_k G k and 0 on H k H_k H k that uniformly Lipschitz random-feature MPNNs cannot approximate uniformly over graph size. This establishes their non-universality.
Corollary 6 (Failure of size-uniform universality). Uniformly Lipschitz MPNNs with i.i.d. uniform features on [ 0 , 1 ] d [0,1]^d [ 0 , 1 ] d are not size-uniform universal approximators for bounded graph invariants, even for input graphs of bounded diameter or bounded degree.
Colors and trials
The previous section gives an example where colors are exponentially more useful than trials; we now show that increasing either resource strictly increases statistical distinguishability.
Theorem 7 (Strict color and trial hierarchies). For statistical distinguishability by random-color WL as in Definition 3, the following hold.
(i) Trials. For every integer s ≥ 2 s \ge2 s ≥ 2 , there are non-isomorphic finite graphs G s , H s G_s,H_s G s , H s that are statistically ( 2 , s , 1 / 3 ) (2,s,1/3) ( 2 , s , 1/3 ) -distinguishable but are not statistically ( 2 , s − 1 , 1 / 3 ) (2,s-1,1/3) ( 2 , s − 1 , 1/3 ) -distinguishable.
(ii) Colors. For every pair of integers q , s ≥ 1 q,s \ge1 q , s ≥ 1 , there are non-isomorphic finite graphs G q , s , H q , s G_{q,s}, H_{q,s} G q , s , H q , s that are statistically ( q + 1 , s , 1 / 3 ) (q+1,s,1/3) ( q + 1 , s , 1/3 ) -distinguishable but are not statistically ( r , s , 1 / 3 ) (r,s,1/3) ( r , s , 1/3 ) -distinguishable for any 1 ≤ r ≤ q 1 \le r \le q 1 ≤ r ≤ q .
The trial hierarchy is already strict with two colors. Both statements follow from a common graph construction. That is, a parity gadget combines pairs of cycle blocks so that a trial reveals the graph identity when every input pair has at least one nonmonochromatic block. Otherwise, the conditional WL observation laws agree for the two graphs. This yields an explicit revelation probability and an exact expression for the optimal testing error. We then choose the graph parameters so that this error crosses 1 / 3 1/3 1/3 upon adding one trial or one color. The full construction and proofs are given in Section H.
Comparison with Weisfeiler–Leman
We now show that with fixed trials and palette size, random-color MPNNs are incomparable with k k k -WL for k ≥ 2 k \ge2 k ≥ 2 .2
Theorem 8 (Incomparability with higher-order WL). For every k ≥ 2 k \ge2 k ≥ 2 :
(i) There exists a k k k -WL-indistinguishable graph pair that is distinguished with success probability greater than 2 / 3 2/3 2/3 by a uniformly Lipschitz MPNN with order-normalized sum aggregation, using two colors and one trial.
(ii) For every fixed q , s ≥ 1 q,s \ge1 q , s ≥ 1 , there exists a graph pair distinguished by 2-WL, and hence by k k k -WL, that is not statistically ( q , s , 1 / 3 ) (q,s,1/3) ( q , s , 1/3 ) -distinguishable by random-color WL.
For the first direction, start with an n n n -vertex graph pair that k k k -WL cannot distinguish. Attach a path of the same length to every vertex, preserving k k k -WL indistinguishability. The independent binary colors along each path, read in order from its attachment vertex, form an identifier for that original vertex. If the paths have length O ( log n ) O(\log n) O ( log n ) , then these identifiers are unique with high probability, and thus, 2 colors provide enough information to distinguish every original vertex. An MPNN can collect these identifiers and use them to recognize the graph. This example shows how random colors and graph structure can powerfully combine to distinguish vertices.
For the reverse direction, consider the pair ( G k , H k ) (G_k,H_k) ( G k , H k ) from Theorem 5, which is constructed with CFI gadgets. The 2-WL distinctions between the 2 C 3 2C_3 2 C 3 and C 6 C_6 C 6 blocks propagate through the parity tree, revealing which root endpoint carries the marker. The exponential trial lower bound then rules out reliable distinction with any fixed palette and trial count on sufficiently large pairs. The formal incomparability result appears in Section E.
Algorithmic Applications
Finite random colors also support algorithmic computations across graph sizes. We give MPNN constructions for tree subgraph detection via color coding and a local MST edge task, with resource requirements independent of graph size.
Tree subgraph detection
We adapt the color-coding algorithm of Alon et al. [2 ] to random-color MPNNs. Consider a graph G G G with n n n vertices and a fixed rooted tree T T T with k k k vertices. Independently assign each vertex in G G G a uniform color from [ k ] [k] [ k ] . A subgraph of G G G isomorphic to T T T is called colorful if its vertices have distinct colors; each fixed copy is colorful with probability k ! / k k k!/k^k k ! / k k . Alon et al. [2 ] give a dynamic program that searches for colorful copies of T T T , using colors to distinguish their vertices. We show that an MPNN can implement this dynamic program with depth, width, and trial count independent of n n n .
Theorem 9 (Rooted tree detection). Let T T T be a rooted tree with k ≥ 1 k \ge1 k ≥ 1 vertices and let α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) . There is a random-color MPNN using k k k colors, O ( k ) O(k) O ( k ) layers, hidden dimension exp ( O ( k ) ) \exp(O(k)) exp ( O ( k )) , max aggregation, and binary vertex outputs such that, for every graph G G G and vertex v ∈ V ( G ) v \in V(G) v ∈ V ( G ) ,
s = ⌈ k k k ! log 1 α ⌉ s = \left\lceil\frac{k^k}{k!}\log\frac{1}{\alpha} \right\rceil s = ⌈ k ! k k log α 1 ⌉ independent trials suffice to detect a non-induced copy of T T T rooted at v v v with no false positives and false-negative probability at most α \alpha α . The test at v v v accepts when its average binary output is positive.
Taking the maximum over vertex outputs gives a graph-level detector for T T T with the same resource bounds and error guarantees (Corollary 31). The network and trial budgets depend only on k k k and desired confidence, not on the input graph’s size n n n . A subcase is detecting simple paths on k k k vertices. The construction and proof appear in Theorem 30 . Note that without colors, MPNNs with identical initial vertex features cannot solve this task in general. For example, C 6 C_6 C 6 contains a simple four-vertex path whereas 2 C 3 2C_3 2 C 3 does not, but these graphs are indistinguishable by 1-WL and hence indistinguishable by any MPNN with identical initial vertex features (Proposition 28 ).
Local MST edge detection
Next, we consider a task for detecting MST edges that requires only local information. An edge belongs to every minimum spanning tree (MST) if and only if it is the unique minimum-weight edge across some cut. For a graph with uniform weights, this is exactly the set of bridge edges. We analyze the set of such edges that unbalanced cuts can witness, so we need only local information to identify them. Specifically, let G = ( V , E ) G=(V,E) G = ( V , E ) be a simple graph with edge weights w : E → Λ w:E\to\Lambda w : E → Λ in a fixed finite ordered set. Write A k ( G , w ) A_k(G,w) A k ( G , w ) for the edges that uniquely minimize a cut with fewer than k k k vertices on one side of the cut. We give an MPNN that detects such edges. As this is an edge prediction task, we compute the output for each edge by applying a shared MLP, called the edge decoder , to the sum of its endpoint embeddings together with its edge weight.
Proposition 10 (Size-independent local MST edge detection). Fix an integer k ≥ 2 k\ge2 k ≥ 2 , a finite weight set Λ \Lambda Λ , and ε , α ∈ ( 0 , 1 ) \varepsilon,\alpha\in(0,1) ε , α ∈ ( 0 , 1 ) . There is a max-aggregation random-color MPNN with an edge decoder such that, for every such graph G G G , its output A ^ ⊆ E \widehat{A}\subseteq E A ⊆ E misses at most an ε \varepsilon ε fraction of A k ( G , w ) A_k(G,w) A k ( G , w ) and incorrectly includes at most an ε \varepsilon ε fraction of E ∖ A k ( G , w ) E\setminus A_k(G,w) E ∖ A k ( G , w ) , with probability at least 1 − α 1-\alpha 1 − α . Its palette size, depth, and number of independent trials depend only on k , Λ , ε , α k,\Lambda,\varepsilon,\alpha k , Λ , ε , α , not on graph size.
Our construction tests whether removing the candidate edge and all heavier edges leaves its endpoints in different components, with at least one component containing fewer than k k k vertices. Each endpoint collects the colors it can reach, allowing the network to recognize a small component and compare the two endpoints’ components. With sufficiently many colors and trials, this controls both missed edges and false detections. The construction and proof are given in Proposition 33 . In contrast, we also show that MPNNs with identical initial vertex features cannot compute A k A_k A k in general (Theorem 34 ).
Learnability of Randomized GNNs
We study the learnability of randomized MPNNs trained using averages over finitely many random node initializations. We fix the depth D D D , hidden dimensions, aggregation scheme, and initialization law ρ K \rho_K ρ K on a compact feature space K K K , subject to the weight and bias bounds in Section A.2. We consider scalar graph-level outputs with mean pooling and a linear readout.
The graph pseudometric d D r a n d d_D^{\mathrm{rand}} d D rand compares the distributions of depth-D D D neighborhood representations under random node initialization and uniform vertex sampling. It is the Wasserstein distance between these distributions, using a recursive metric reflecting the aggregation scheme; see Section K. Distinct graphs may have distance zero if their representation distributions coincide. The graph domain G \mathcal{G} G is totally bounded under this pseudometric, and the mean predictor F ‾ θ ( G ) : = E [ F θ ( G , ξ G ) ] \overline{F}_{\theta}(G):=\mathbb{E}[F_{\theta}(G,\xi^G)] F θ ( G ) := E [ F θ ( G , ξ G )] , where ξ G ∼ ρ K ⊗ V ( G ) \xi^G\sim\rho_K^{\otimes V(G)} ξ G ∼ ρ K ⊗ V ( G ) , satisfies
∣ F ‾ θ ( G ) − F ‾ θ ( G ′ ) ∣ ≤ B θ d D r a n d ( G , G ′ ) . \left|\overline{F}_{\theta}(G)-\overline{F}_{\theta}(G')\right|\le B_{\theta}d_D^{\mathrm{rand}}(G,G'). F θ ( G ) − F θ ( G ′ ) ≤ B θ d D rand ( G , G ′ ) .
Here, B θ B_{\theta} B θ is an explicit Lipschitz certificate computed from the network parameters; see Section J.2. These properties allow accuracy on a suitable finite training set to control approximation error throughout G \mathcal{G} G . Let f ∗ : G → R f^*:\mathcal{G}\to\mathbb{R} f ∗ : G → R be B ∗ B_* B ∗ -Lipschitz under d D r a n d d_D^{\mathrm{rand}} d D rand . For training graphs G 1 , … , G n G_1,\ldots,G_n G 1 , … , G n and S S S independent initializations ξ i , s G i ∼ ρ K ⊗ V ( G i ) \xi_{i,s}^{G_i}\sim\rho_K^{\otimes V(G_i)} ξ i , s G i ∼ ρ K ⊗ V ( G i ) of each graph, define
F ^ θ , S ( G i ) : = 1 S ∑ s = 1 S F θ ( G i , ξ i , s G i ) , \widehat{F}_{\theta,S}(G_i):=\frac{1}{S}\sum_{s=1}^{S}F_{\theta}(G_i,\xi_{i,s}^{G_i}), F θ , S ( G i ) := S 1 s = 1 ∑ S F θ ( G i , ξ i , s G i ) ,
L ^ r e g ( θ ) : = 1 n ∑ i = 1 n ∣ F ^ θ , S ( G i ) − f ∗ ( G i ) ∣ + λ ( B θ − B ∗ ) + , \widehat{\mathcal{L}}_{\mathrm{reg}}(\theta):=\frac{1}{n}\sum_{i=1}^{n}\left|\widehat{F}_{\theta,S}(G_i)-f^*(G_i)\right|+\lambda(B_{\theta}-B_*)_+, L reg ( θ ) := n 1 i = 1 ∑ n F θ , S ( G i ) − f ∗ ( G i ) + λ ( B θ − B ∗ ) + ,
where λ > 0 \lambda>0 λ > 0 and ( a ) + = max { a , 0 } (a)_+=\max\{a,0\} ( a ) + = max { a , 0 } .
Theorem 11 (Uniform generalization from Monte Carlo training). *For every ε > 0 \varepsilon>0 ε > 0 and δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) , there exist a finite training set { G 1 , … , G n } ⊆ G \{G_1,\ldots,G_n\}\subseteq\mathcal{G} { G 1 , … , G n } ⊆ G and a tolerance η > 0 \eta>0 η > 0 such that the following holds. For any sufficiently large S S S , draw S S S independent initializations of each training graph from ρ K ⊗ V ( G i ) \rho_K^{\otimes V(G_i)} ρ K ⊗ V ( G i ) . Then, with probability at least 1 − δ 1-\delta 1 − δ ,
L ^ r e g ( θ ) < η ⟹ sup G ∈ G ∣ F ‾ θ ( G ) − f ∗ ( G ) ∣ < ε \widehat{\mathcal{L}}_{\mathrm{reg}}(\theta)<\eta\quad\Longrightarrow\quad\sup_{G\in\mathcal{G}}\left|\overline{F}_{\theta}(G)-f^*(G)\right|<\varepsilon L reg ( θ ) < η ⟹ G ∈ G sup F θ ( G ) − f ∗ ( G ) < ε simultaneously for all θ ∈ Θ \theta\in\Theta θ ∈ Θ .*
Thus, sufficiently small sampled regularized error guarantees uniform approximation by the mean predictor, regardless of graph order. The training-set size is controlled by the graph domain’s covering number at a radius determined by the desired accuracy and the target’s Lipschitz constant. Uniform Monte Carlo concentration makes the guarantee hold even when parameters are selected using the same sampled initializations. For any fixed test graph, Monte Carlo concentration controls the error from averaging S ′ S' S ′ fresh independent initializations, without retraining. The proof and an explicit sufficient sample size are given in § 21 and M.
Experiments
We perform a range of experiments to explore the role of random colors in expressivity and size generalization. Section N gives additional details.
Bridge prediction across graph sizes We train random-color MPNNs to identify bridge edges in unweighted Erdős–Rényi graphs with 16 or 32 vertices and test on 512-vertex graphs. Our local MST edge-detection result (Proposition 10 ) motivates examining the size b b b of the smaller endpoint component after deleting a bridge. We train separate models to detect bridges with exactly b ∈ { 4 , 5 , 6 } b \in\{4,5,6\} b ∈ { 4 , 5 , 6 } vertices on the smaller side, treating all other edges as negatives. A standard MPNN with constant initialization and max aggregation assigns the same score to every edge, yielding exactly 50% balanced accuracy for all three target sizes. With 16 trials and a fixed training budget, increasing the number of one-hot colors increases mean balanced test accuracy (Figure 2 ). In particular, larger palettes improve detection, while bridges with larger smaller-side components remain harder to identify. Furthermore, detection generalizes to larger graphs using a fixed finite palette.
Figure 2. Balanced test accuracy 1 − 1 2 ( F N R + F P R ) 1-\frac{1}{2}(\mathrm{FNR}+\mathrm{FPR}) 1 − 2 1 ( FNR + FPR ) for detecting bridges of smaller-side size b b b . Error bars show SE over five training seeds.
Tree substructure detection: colors and trials. Motivated by our color-coding construction (Theorem 9 ), we train models to detect the full balanced degree-three tree of depth two—a root with three children, each with two leaves—as a non-induced subgraph rooted at each vertex. Training and test graphs are random 3-regular graphs on 24 vertices and we vary the palette and trial count. On these graphs, the target is equivalent to the vertex’s two-hop neighborhood having the maximum possible size of 10. We train using the maximum output across trials. At test time, we sum predictions across trials and apply a threshold chosen on validation graphs.
Increasing either the palette size or the number of trials increases mean test accuracy (Figure 3 ). These results support our tree-detection construction (Theorem 9 ): finite colors enable detection, whereas constant initial features give identical outputs at every vertex of these 3-regular graphs. The gains from both resources align with our color and trial hierarchies (Theorem 7 ).
Figure 3. Rooted tree detection with different numbers of colors and trials. Cells show mean node test accuracy (%) ± \pm ± SE across five training seeds.
Inference-time quantization. Motivated by our quantization result (Theorem 3), we examine whether quantizing random features preserves predictive performance. We replicate GCN-RNI on EXP [1 ] and rGIN on TRIANGLE [24 ] , then quantize their random features to two values per coordinate without retraining. EXP classifies graph-encoded Boolean formulas; we evaluate the 64-coordinate baseline and a scalar variant. On TRIANGLE, we predict triangle membership using 20-vertex 3-regular training graphs and 20- and 100-vertex test graphs. Both models retain most of their predictive performance (Table 1 ), supporting our message that finite palettes can preserve the expressive benefits of continuous random features, including under size generalization.
Table 1. Inference-time performance under quantization. Mean ± \pm ± SE across ten folds for EXP, and ten single-trial feature draws of one trained model for TRIANGLE.
Conclusions
We analyze random-feature MPNNs through the vertex distinguishability provided by finite random colors. This offers a natural intermediate between anonymous message passing and the use of continuous random features as unique vertex identifiers. For uniformly Lipschitz MPNNs, finite colors retain the size-uniform approximation power of continuous random features, while making the capabilities and limitations of random-feature MPNNs explicit. Our framework also makes the roles of palette size and trial count clear, laying a theoretical foundation for understanding how to use random features in practice.
An important next step is to identify further algorithms that can be implemented using graph-size-independent numbers of colors and trials. Although our examples establish limitations and incomparability with k k k -WL, a broader characterization of which graph pairs these models can distinguish remains open. Our statistical testing framework permits arbitrary combinations of trials, but our approximation and learning analysis centers on averaging. Studying other ways of combining trial information, beyond averaging and expectation, is another interesting direction, as aggregation across trials is an important architectural choice.
ACKNOWLEDGEMENTS
We thank Sanjoy Dasgupta for insightful discussions during the early stages of this work.
YW, RRN, and MB are supported by NSF grant CCF-2217058, and YW and RRN are additionally supported by NSF grants CCF-2112665 and CCF-2310411. CM is partially funded by a DFG Emmy Noether grant (468502433), Israel ISF-DFG Grant (587125021), and a RWTH Junior Principal Investigator Fellowship under Germany’s Excellence Strategy. AV is supported by the German Research Foundation (DFG) within Research Training Group 2236/2 (UnRAVeL).
AI USE STATEMENT
We used generative AI tools to help refine and check our mathematical arguments, explore mathematical approaches, design and implement experiments, analyze results, and prepare figures. We also used these tools for literature searches and to draft and revise the manuscript. All material developed or modified with AI assistance was explicitly reviewed and verified by the authors.
Additional Framework Details
Graphs with random node features and graph statistics
The graph with random node features is
G ξ : = ( G , ( ξ v ) v ∈ V ( G ) ) , P G : = Law ( G ξ ) . (2) G^{\xi} := (G,(\xi_v)_{v\in V(G)}), \qquad P_G := \operatorname{Law}(G^{\xi}). \tag*{(2)} G ξ := ( G , ( ξ v ) v ∈ V ( G ) ) , P G := Law ( G ξ ) . (2)
Let G K \mathcal{G}_{\mathcal{K}} G K denote the resulting space of graphs with node features. A graph invariant is a function on graphs that is permutation invariant (unchanged by vertex relabeling), and a graph statistic is a scalar-valued graph invariant whose input is a graph with (random) node features. For a graph statistic t t t ,3 we refer to a single evaluation with initialization ξ v ∼ i . i . d . ρ K \xi_v \overset{\mathrm{i.i.d.}}{\sim} \rho_{\mathcal{K}} ξ v ∼ i.i.d. ρ K , as a trial , where the output and its law are
Z t ( G ) : = t ( G ξ ) , P G t : = Law ( Z t ( G ) ) . (3) Z_t(G) := t(G^{\xi}), \qquad P_G^t := \operatorname{Law}(Z_t(G)). \tag*{(3)} Z t ( G ) := t ( G ξ ) , P G t := Law ( Z t ( G )) . (3)
Message-passing neural networks
Let G \mathcal{G} G be a class of graphs with node features and let V 1 ( G ) : = { ( G , v ) : G ∈ G , v ∈ V ( G ) } V_1(\mathcal{G}) := \{(G,v): G\in\mathcal{G}, v\in V(G)\} V 1 ( G ) := {( G , v ) : G ∈ G , v ∈ V ( G )} . A depth-D D D MPNN initializes h G ( 0 ) ( v ) = x v h_G^{(0)}(v)=x_v h G ( 0 ) ( v ) = x v , where x v x_v x v is the initial feature of node v v v , and updates its representations for ℓ = 0 , … , D − 1 \ell=0,\ldots,D-1 ℓ = 0 , … , D − 1 according to
m G ( ℓ ) ( v ) = AGG ℓ ( { { h G ( ℓ ) ( u ) : u ∈ N G ( v ) } } ) , m_G^{(\ell)}(v)=\operatorname{AGG}_{\ell}\left(\left\{\left\{h_G^{(\ell)}(u):u\in N_G(v)\right\}\right\}\right), m G ( ℓ ) ( v ) = AGG ℓ ( { { h G ( ℓ ) ( u ) : u ∈ N G ( v ) } } ) ,
h G ( ℓ + 1 ) ( v ) = UPD ℓ ( h G ( ℓ ) ( v ) , m G ( ℓ ) ( v ) ) . h_G^{(\ell+1)}(v)=\operatorname{UPD}_{\ell}\left(h_G^{(\ell)}(v),m_G^{(\ell)}(v)\right). h G ( ℓ + 1 ) ( v ) = UPD ℓ ( h G ( ℓ ) ( v ) , m G ( ℓ ) ( v ) ) .
In this work, we specialize the update function to
h G ( ℓ + 1 ) ( v ) = σ ( W s e l f ( ℓ ) h G ( ℓ ) ( v ) + W a g g ( ℓ ) m G ( ℓ ) ( v ) + b ( ℓ ) ) , h_G^{(\ell+1)}(v)=\sigma\left(W_{\mathrm{self}}^{(\ell)}h_G^{(\ell)}(v)+W_{\mathrm{agg}}^{(\ell)}m_G^{(\ell)}(v)+b^{(\ell)}\right), h G ( ℓ + 1 ) ( v ) = σ ( W self ( ℓ ) h G ( ℓ ) ( v ) + W agg ( ℓ ) m G ( ℓ ) ( v ) + b ( ℓ ) ) ,
where σ \sigma σ is the coordinate-wise ReLU activation function and b ( ℓ ) ∈ R d ℓ + 1 b^{(\ell)}\in\mathbb{R}^{d_{\ell+1}} b ( ℓ ) ∈ R d ℓ + 1 is a bias shared by all vertices. We consider the following aggregation schemes:
m G , s u m ( ℓ ) ( v ) = 1 ∣ V ( G ) ∣ ∑ u ∈ N G ( v ) h G ( ℓ ) ( u ) , m_{G,\mathrm{sum}}^{(\ell)}(v)=\frac{1}{|V(G)|}\sum_{u\in N_G(v)}h_G^{(\ell)}(u), m G , sum ( ℓ ) ( v ) = ∣ V ( G ) ∣ 1 u ∈ N G ( v ) ∑ h G ( ℓ ) ( u ) ,
m G , m e a n ( ℓ ) ( v ) = 1 ∣ N G ( v ) ∣ ∑ u ∈ N G ( v ) h G ( ℓ ) ( u ) , m_{G,\mathrm{mean}}^{(\ell)}(v)=\frac{1}{|N_G(v)|}\sum_{u\in N_G(v)}h_G^{(\ell)}(u), m G , mean ( ℓ ) ( v ) = ∣ N G ( v ) ∣ 1 u ∈ N G ( v ) ∑ h G ( ℓ ) ( u ) ,
and
m G , m a x ( ℓ ) ( v ) = max u ∈ N G ( v ) h G ( ℓ ) ( u ) , m_{G,\mathrm{max}}^{(\ell)}(v)=\max_{u\in N_G(v)}h_G^{(\ell)}(u), m G , max ( ℓ ) ( v ) = u ∈ N G ( v ) max h G ( ℓ ) ( u ) ,
m G , m i n ( ℓ ) ( v ) = min u ∈ N G ( v ) h G ( ℓ ) ( u ) , m_{G,\mathrm{min}}^{(\ell)}(v)=\min_{u\in N_G(v)}h_G^{(\ell)}(u), m G , min ( ℓ ) ( v ) = u ∈ N G ( v ) min h G ( ℓ ) ( u ) ,
where the maximum and minimum are taken coordinate-wise.
Let θ ∈ Θ \theta\in\Theta θ ∈ Θ collect the update and readout parameters, and let H s u m ( D ) \mathcal{H}_{\mathrm{sum}}^{(D)} H sum ( D ) , H m e a n ( D ) \mathcal{H}_{\mathrm{mean}}^{(D)} H mean ( D ) , H m a x ( D ) \mathcal{H}_{\mathrm{max}}^{(D)} H max ( D ) , and H m i n ( D ) \mathcal{H}_{\mathrm{min}}^{(D)} H min ( D ) denote the corresponding classes of maps h θ ( D ) : V 1 ( G ) → R d D h_{\theta}^{(D)}:V_1(\mathcal{G})\to\mathbb{R}^{d_D} h θ ( D ) : V 1 ( G ) → R d D . The class H m i n ( D ) \mathcal{H}_{\mathrm{min}}^{(D)} H min ( D ) is defined analogously. We assume throughout that
∥ W s e l f ( ℓ ) ∥ 2 , ∥ W a g g ( ℓ ) ∥ 2 ≤ B W , ∥ b ( ℓ ) ∥ 2 ≤ B b . \left\|W_{\mathrm{self}}^{(\ell)}\right\|_2,\ \left\|W_{\mathrm{agg}}^{(\ell)}\right\|_2\leq B_W,\qquad\left\|b^{(\ell)}\right\|_2\leq B_b. W self ( ℓ ) 2 , W agg ( ℓ ) 2 ≤ B W , b ( ℓ ) 2 ≤ B b .
The constants B W , B b < ∞ B_W,B_b<\infty B W , B b < ∞ are shared across all θ ∈ Θ \theta\in\Theta θ ∈ Θ and layers and are independent of graph size. When a linear readout W o u t W_{\mathrm{out}} W out is used, we also assume ∥ W o u t ∥ 2 ≤ B o u t \left\|W_{\mathrm{out}}\right\|_2\leq B_{\mathrm{out}} ∥ W out ∥ 2 ≤ B out .
The graph-level output uses a permutation-invariant readout chosen as part of the architecture:
F θ ( G , x ) = READOUT θ ( { { h G ( D ) ( v ) : v ∈ V ( G ) } } ) . F_{\theta}(G,x)=\operatorname{READOUT}_{\theta}\left(\left\{\left\{h_G^{(D)}(v):v\in V(G)\right\}\right\}\right). F θ ( G , x ) = READOUT θ ( { { h G ( D ) ( v ) : v ∈ V ( G ) } } ) .
We write F ( G , x ) F(G,x) F ( G , x ) for the network output, where x = ( x v ) v ∈ V ( G ) x=(x_v)_{v\in V(G)} x = ( x v ) v ∈ V ( G ) denotes the initial node features.
Population approximation
For a graph statistic t t t , its t t t -mean is the graph invariant defined by
μ t ( G ) : = E G ξ ∼ P G [ t ( G ξ ) ] . (4) \mu_t(G) := \mathbb{E}_{G_{\xi}\sim P_G}[t(G^{\xi})]. \tag*{(4)} μ t ( G ) := E G ξ ∼ P G [ t ( G ξ )] . (4)
Uniform Lipschitzness
Proof of Lemma 1. Take the coordinate maximum norm on each hidden space and the induced matrix norm ∥ ⋅ ∥ ∞ → ∞ \lVert\cdot\rVert_{\infty\to\infty} ∥ ⋅ ∥ ∞ → ∞ . For two initializations x , x ′ x,x' x , x ′ of the same nonempty graph, write
e ℓ : = max v ∈ V ( G ) ∥ h G ( ℓ ) ( v ; x ) − h G ( ℓ ) ( v ; x ′ ) ∥ ∞ . (5) e_{\ell} := \max_{v\in V(G)}\left\lVert h_G^{(\ell)}(v;x)-h_G^{(\ell)}(v;x')\right\rVert_{\infty}. \tag*{(5)} e ℓ := v ∈ V ( G ) max h G ( ℓ ) ( v ; x ) − h G ( ℓ ) ( v ; x ′ ) ∞ . (5)
Mean and order-normalized sum aggregation are nonexpansive in this max-over-nodes norm. Coordinatewise max and min are also nonexpansive, since each coordinate changes by at most e ℓ e_{\ell} e ℓ . For unnormalized sums on graphs of maximum degree at most Δ \Delta Δ , the corresponding bound is Δ e ℓ \Delta e_{\ell} Δ e ℓ . Define empty neighborhood aggregates and the readout of the empty graph to be zero.
Let A ℓ = 1 A_{\ell}=1 A ℓ = 1 for the normalized, max, and min aggregations, and A ℓ = Δ A_{\ell}=\Delta A ℓ = Δ for unnormalized sums. Since ReLU is nonexpansive and the biases cancel in differences, each update satisfies
e ℓ + 1 ≤ ( ∥ W s e l f ( ℓ ) ∥ ∞ → ∞ + A ℓ ∥ W a g g ( ℓ ) ∥ ∞ → ∞ ) e ℓ . (6) e_{\ell+1}\leq\left(\lVert W_{\mathrm{self}}^{(\ell)}\rVert_{\infty\to\infty}+A_{\ell}\lVert W_{\mathrm{agg}}^{(\ell)}\rVert_{\infty\to\infty}\right)e_{\ell}. \tag*{(6)} e ℓ + 1 ≤ ( ∥ W self ( ℓ ) ∥ ∞ → ∞ + A ℓ ∥ W agg ( ℓ ) ∥ ∞ → ∞ ) e ℓ . (6)
Mean pooling is nonexpansive. Composing these bounds with the final linear map gives a feature-Lipschitz constant
L ∞ = ∥ W o u t ∥ ∞ → ∞ ∏ ℓ = 0 D − 1 ( ∥ W s e l f ( ℓ ) ∥ ∞ → ∞ + A ℓ ∥ W a g g ( ℓ ) ∥ ∞ → ∞ ) . (7) L_{\infty}=\lVert W_{\mathrm{out}}\rVert_{\infty\to\infty}\prod_{\ell=0}^{D-1}\left(\lVert W_{\mathrm{self}}^{(\ell)}\rVert_{\infty\to\infty}+A_{\ell}\lVert W_{\mathrm{agg}}^{(\ell)}\rVert_{\infty\to\infty}\right). \tag*{(7)} L ∞ = ∥ W out ∥ ∞ → ∞ ℓ = 0 ∏ D − 1 ( ∥ W self ( ℓ ) ∥ ∞ → ∞ + A ℓ ∥ W agg ( ℓ ) ∥ ∞ → ∞ ) . (7)
This constant is independent of graph size. For any other fixed norm ∥ ⋅ ∥ \lVert\cdot\rVert ∥ ⋅ ∥ on the input space, choose c c c such that ∥ z ∥ ∞ ≤ c ∥ z ∥ \lVert z\rVert_{\infty}\leq c\lVert z\rVert ∥ z ∥ ∞ ≤ c ∥ z ∥ . Then L = c L ∞ L=cL_{\infty} L = c L ∞ gives uniform Lipschitzness with respect to ∥ ⋅ ∥ i n \lVert\cdot\rVert_{\mathrm{in}} ∥ ⋅ ∥ in .
Write D K : = sup u , u ′ ∈ K ∥ u − u ′ ∥ D_K:=\sup_{u,u'\in K}\lVert u-u'\rVert D K := sup u , u ′ ∈ K ∥ u − u ′ ∥ for the diameter of the feature space. The input norm and uniform Lipschitzness are defined in Definition 2.
Uniform Lipschitzness immediately bounds the output diameter, independently of graph size.
Lemma 12 (Uniform output diameter). Let F F F be a uniformly L L L -Lipschitz MPNN. Then, for every graph G G G , Z F ( G ) Z_F(G) Z F ( G ) is supported on an interval of length at most L D K LD_K L D K .
Proof. For any x , x ′ ∈ K V ( G ) x,x'\in K^{V(G)} x , x ′ ∈ K V ( G ) , every nodewise difference is at most D K D_K D K , so ∥ x − x ′ ∥ i n ≤ D K \lVert x-x'\rVert_{\mathrm{in}}\leq D_K ∥ x − x ′ ∥ in ≤ D K . Uniform L L L -Lipschitzness then gives ∣ F ( G , x ) − F ( G , x ′ ) ∣ ≤ L D K \lvert F(G,x)-F(G,x')\rvert\leq LD_K ∣ F ( G , x ) − F ( G , x ′ )∣ ≤ L D K . Thus the image of x ↦ F ( G , x ) x\mapsto F(G,x) x ↦ F ( G , x ) has diameter at most L D K LD_K L D K , which proves the claim.
Empirical averaging
In addition to analyzing the expressivity of the mean of random-feature MPNNs, we also consider the complexity of finite-sample estimation, which is required in practice. To estimate μ t ( G ) \mu_t(G) μ t ( G ) , draw s s s independently initialized trials X 1 , … , X s ∼ P G X_1,\ldots,X_s\sim P_G X 1 , … , X s ∼ P G and define
μ ^ t , s ( G ) : = 1 s ∑ i = 1 s t ( X i ) . (8) \widehat{\mu}_{t,s}(G):=\frac{1}{s}\sum_{i=1}^{s}t(X_i). \tag*{(8)} μ t , s ( G ) := s 1 i = 1 ∑ s t ( X i ) . (8)
For an MPNN F F F , write F ^ s = μ ^ F , s \widehat{F}_s=\widehat{\mu}_{F,s} F s = μ F , s . Then E [ F ^ s ( G ) ] = F ‾ ( G ) \mathbb{E}[\widehat{F}_s(G)]=\overline{F}(G) E [ F s ( G )] = F ( G ) for every s s s , so the number of trials affects estimation but not the represented population function.
Definition 4 (Size-uniform high-probability approximation). For a graph invariant T T T , ε ≥ 0 \varepsilon\geq0 ε ≥ 0 , α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) , and s ∈ N s\in\mathbb{N} s ∈ N , an MPNN F F F size-uniformly approximates T T T with error ε \varepsilon ε and failure probability at most α \alpha α using s s s trials if
inf G ∈ G Pr ( ∣ F ^ s ( G ) − T ( G ) ∣ ≤ ε ) ≥ 1 − α . (9) \inf_{G\in\mathcal{G}}\Pr\left(\left\lvert\widehat{F}_s(G)-T(G)\right\rvert\leq\varepsilon\right)\geq1-\alpha. \tag*{(9)} G ∈ G inf Pr ( F s ( G ) − T ( G ) ≤ ε ) ≥ 1 − α . (9)
For the L L L -Lipschitz models we consider, population-level approximation (as in Definition 1) immediately gives a finite-trial high-probability approximation. The key is that the required number of samples is constant for any fixed model, and in particular independent of graph size.
Proposition 13 (Automatic finite-trial bound). Let T T T be a graph invariant. For ε > 0 \varepsilon> 0 ε > 0 , suppose that F F F is uniformly L L L -Lipschitz and sup G ∈ G ∣ F ‾ ( G ) − T ( G ) ∣ ≤ ε / 2 \sup_{G \in\mathcal{G}} \lvert\overline{F}(G) - T(G) \rvert\le\varepsilon/2 sup G ∈ G ∣ F ( G ) − T ( G )∣ ≤ ε /2 . Then, for any α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) , the invariant F F F size-uniformly approximates the invariant T T T with error ε \varepsilon ε and failure probability at most α \alpha α using any number of trials satisfying
s ≥ 2 L 2 D K 2 ε 2 log 2 α . (10) s \ge\frac{2L^2D_K^2}{\varepsilon^2}\log\frac{2}{\alpha}. \tag*{(10)} s ≥ ε 2 2 L 2 D K 2 log α 2 . (10)
Proof. By Lemma 12 , each of the s s s independent trials averaged by F ^ s ( G ) \widehat{F}_s(G) F s ( G ) lies in an interval of length at most L D K LD_K L D K . Hoeffding’s inequality therefore yields
Pr ( ∣ F ^ s ( G ) − F ‾ ( G ) ∣ ≥ ε 2 ) ≤ 2 exp ( − s ε 2 2 L 2 D K 2 ) ≤ α . (11) \Pr\left(\left\lvert\widehat{F}_s(G)-\overline{F}(G)\right\rvert\ge\frac{\varepsilon}{2}\right)
\le2\exp\left(-\frac{s\varepsilon^2}{2L^2D_K^2}\right)\le\alpha. \tag*{(11)} Pr ( F s ( G ) − F ( G ) ≥ 2 ε ) ≤ 2 exp ( − 2 L 2 D K 2 s ε 2 ) ≤ α . (11)
Thus, with probability at least 1 − α 1-\alpha 1 − α , ∣ F ^ s ( G ) − F ‾ ( G ) ∣ ≤ ε / 2 \lvert\widehat{F}_s(G)-\overline{F}(G)\rvert\le\varepsilon/2 ∣ F s ( G ) − F ( G )∣ ≤ ε /2 . In this case, the triangle inequality and the population approximation hypothesis give
∣ F ^ s ( G ) − T ( G ) ∣ ≤ ∣ F ^ s ( G ) − F ‾ ( G ) ∣ + ∣ F ‾ ( G ) − T ( G ) ∣ ≤ ε 2 + ε 2 = ε . (12) \begin{aligned}
\left\lvert\widehat{F}_s(G)-T(G)\right\rvert
&\le\left\lvert\widehat{F}_s(G)-\overline{F}(G)\right\rvert+\left\lvert\overline{F}(G)-T(G)\right\rvert\\
&\le\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon. \tag*{(12)}
\end{aligned} F s ( G ) − T ( G ) ≤ F s ( G ) − F ( G ) + F ( G ) − T ( G ) ≤ 2 ε + 2 ε = ε . (12)
This bound is independent of G G G so taking the infimum over G \mathcal{G} G completes the proof.
Graph-pair reductions and statistical distinguishability
We also consider whether random-feature MPNNs distinguish graph pairs at the population level. For an MPNN F F F , define its population gap on G , H ∈ G G,H\in\mathcal{G} G , H ∈ G by
gap F ( G , H ) : = ∣ F ‾ ( G ) − F ‾ ( H ) ∣ . (13) \operatorname{gap}_{F}(G,H):=\left\lvert\overline{F}(G)-\overline{F}(H)\right\rvert. \tag*{(13)} gap F ( G , H ) := F ( G ) − F ( H ) . (13)
We say that F F F mean-distinguishes the pair with margin Δ \Delta Δ if gap F ( G , H ) ≥ Δ \operatorname{gap}_{F}(G,H)\ge\Delta gap F ( G , H ) ≥ Δ .
We next connect the population gap to empirical isomorphism testing. For a graph statistic t t t , an s s s -trial test for G , H G,H G , H receives two independent batches
Z A = ( Z t , 1 ( A ) , … , Z t , s ( A ) ) , Z B = ( Z t , 1 ( B ) , … , Z t , s ( B ) ) , (14) \begin{aligned}
Z_A&=(Z_{t,1}(A),\ldots,Z_{t,s}(A)),\\
Z_B&=(Z_{t,1}(B),\ldots,Z_{t,s}(B)), \tag*{(14)}
\end{aligned} Z A Z B = ( Z t , 1 ( A ) , … , Z t , s ( A )) , = ( Z t , 1 ( B ) , … , Z t , s ( B )) , (14)
where A , B ∈ { G , H } A,B\in\{G,H\} A , B ∈ { G , H } and the entries of each batch are i.i.d. with laws P A t P_A^t P A t and P B t P_B^t P B t , respectively. The test returns one when it declares that the batches came from different graphs.
Definition 5 (Statistical distinguishability). For α ∈ ( 0 , 1 / 2 ) \alpha\in(0,1/2) α ∈ ( 0 , 1/2 ) , the pair G , H G,H G , H is statistically ( t , s , α ) (t,s,\alpha) ( t , s , α ) -distinguishable if there is a test ψ \psi ψ such that
max A , B ∈ { G , H } Pr ( ψ ( Z A , Z B ) ≠ 1 { A ≠ B } ) ≤ α . (15) \max_{A,B\in\{G,H\}}\Pr\left(\psi(Z_A,Z_B)\ne\mathbf{1}\{A\ne B\}\right)\le\alpha. \tag*{(15)} A , B ∈ { G , H } max Pr ( ψ ( Z A , Z B ) = 1 { A = B } ) ≤ α . (15) Thus the test must distinguish same from different in all four choices of ( A , B ) (A,B) ( A , B ) .
For observed batches z , z ′ ∈ R s z,z'\in\mathbb{R}^s z , z ′ ∈ R s , consider the empirical-mean test
φ t , Δ , s ( z , z ′ ) : = 1 { ∣ 1 s ∑ i = 1 s z i − 1 s ∑ i = 1 s z i ′ ∣ > Δ 2 } . (16) \varphi_{t,\Delta,s}(z,z'):=\mathbf{1}\left\{\left\lvert\frac{1}{s}\sum_{i=1}^{s}z_i-\frac{1}{s}\sum_{i=1}^{s}z'_i\right\rvert>\frac{\Delta}{2}\right\}. \tag*{(16)} φ t , Δ , s ( z , z ′ ) := 1 { s 1 i = 1 ∑ s z i − s 1 i = 1 ∑ s z i ′ > 2 Δ } . (16)
Proof of Proposition 2. By Lemma 12 , the outputs on each fixed graph lie in an interval of length at most L D K LD_K L D K . Pairing the two batches, the empirical difference is therefore an average of independent variables with range length at most 2 L D K 2L D_K 2 L D K . Its mean is zero when A = B A = B A = B and has absolute value at least Δ \Delta Δ when A ≠ B A \ne B A = B . An error requires a deviation of at least Δ / 2 \Delta/2 Δ/2 , so Hoeffding’s inequality bounds every case by
2 exp ( − s Δ 2 8 L 2 D K 2 ) . (17) 2\exp\left(-\frac{s\Delta^2}{8L^2D_K^2}\right). \tag*{(17)} 2 exp ( − 8 L 2 D K 2 s Δ 2 ) . (17)
Graph isomorphism testing will be particularly useful for bounding the power of random features. Specifically, by contraposition, a lower bound against all s s s -trial tests implies gap F ( G , H ) < Δ \operatorname{gap}_{\mathcal{F}}(G,H) < \Delta gap F ( G , H ) < Δ . Finally, we can convert bounded population gap to non-universality, in the function approximation framework.
Corollary 14 (Non-universality from graph pairs). Let F \mathcal{F} F be a class of random-feature MPNNs. Suppose that, for some β < 1 \beta< 1 β < 1 , for every F ∈ F F \in\mathcal{F} F ∈ F there exist non-isomorphic graphs G , H ∈ G G,H \in\mathcal{G} G , H ∈ G with
gap F ( G , H ) ≤ β . (18) \operatorname{gap}_{\mathcal{F}}(G,H) \le\beta. \tag*{(18)} gap F ( G , H ) ≤ β . (18) Then F \mathcal{F} F is not size-uniformly universal.
Proof. First, enumerate the isomorphism classes in G \mathcal{G} G and consider the graph invariant T ⋆ : G → N T_\star:\mathcal{G}\to\mathbb{N} T ⋆ : G → N that assigns each class its index. If there is some F F F that approximates T ⋆ T_\star T ⋆ uniformly with error strictly less than ( 1 − β ) / 2 (1-\beta)/2 ( 1 − β ) /2 , then gap F ( G , H ) > β \operatorname{gap}_{\mathcal{F}}(G,H) > \beta gap F ( G , H ) > β for G G G and H H H non-isomorphic, contradicting the hypothesis. Hence F \mathcal{F} F does not size-uniformly approximate T ⋆ T_\star T ⋆ .
Quantization for Size-Uniform Function Approximation
Quantization setup
For a finite nonempty palette S ⊂ K S \subset K S ⊂ K , fix a quantization map q S : K → S q_S:K\to S q S : K → S and define its radius by
δ ( S ) : = sup z ∈ K ∥ z − q S ( z ) ∥ . (19) \delta(S) := \sup_{z\in K}\|z-q_S(z)\|. \tag*{(19)} δ ( S ) := z ∈ K sup ∥ z − q S ( z ) ∥. (19)
The corresponding nodewise quantization operator is ( Q S x ) v : = q S ( x v ) (Q_Sx)_v := q_S(x_v) ( Q S x ) v := q S ( x v ) . By construction,
∥ x − Q S x ∥ i n ≤ δ ( S ) for every x ∈ K V ( G ) . (20) \|x-Q_Sx\|_{\mathrm{in}} \le\delta(S)\qquad\text{for every }x\in K^{V(G)}. \tag*{(20)} ∥ x − Q S x ∥ in ≤ δ ( S ) for every x ∈ K V ( G ) . (20)
For δ > 0 \delta> 0 δ > 0 , let N K ( δ ) N_K(\delta) N K ( δ ) be the covering number of K K K . Since K K K is compact, we may choose a palette S δ ⊂ K S_\delta\subset K S δ ⊂ K with ∣ S δ ∣ = N K ( δ ) |S_\delta|=N_K(\delta) ∣ S δ ∣ = N K ( δ ) and take q S δ q_{S_\delta} q S δ to be a nearest-point map, so that δ ( S δ ) ≤ δ \delta(S_\delta)\le\delta δ ( S δ ) ≤ δ . Thus Q S δ ξ G Q_{S_\delta}\xi^G Q S δ ξ G consists of i.i.d. random colors drawn from a palette of size N K ( δ ) N_K(\delta) N K ( δ ) .
To make this concrete, take K = [ 0 , 1 ] d K=[0,1]^d K = [ 0 , 1 ] d , and consider rounding to a uniform grid. For m ∈ N m\in\mathbb{N} m ∈ N , let
T m : = { 2 k − 1 2 m : k = 1 , … , m } ⊂ [ 0 , 1 ] , S m : = T m d . (21) T_m:=\left\{\frac{2k-1}{2m}:k=1,\ldots,m\right\}\subset[0,1],\qquad
S_m:=T_m^d. \tag*{(21)} T m := { 2 m 2 k − 1 : k = 1 , … , m } ⊂ [ 0 , 1 ] , S m := T m d . (21)
Let q S m q_{S_m} q S m round each coordinate to the nearest point in S m S_m S m , and abbreviate Q m : = Q S m Q_m:=Q_{S_m} Q m := Q S m . Let
κ : = sup { ∥ u ∥ : ∥ u ∥ ∞ ≤ 1 } . (22) \kappa:=\sup\{\|u\|:\|u\|_\infty\le1\}. \tag*{(22)} κ := sup { ∥ u ∥ : ∥ u ∥ ∞ ≤ 1 } . (22)
Since rounding changes each coordinate by at most 1 / ( 2 m ) 1/(2m) 1/ ( 2 m ) , we have
∥ x − Q m x ∥ i n ≤ κ 2 m for every x ∈ ( [ 0 , 1 ] d ) V ( G ) . (23) \|x-Q_mx\|_{\mathrm{in}}\le\frac{\kappa}{2m}\qquad\text{for every }x\in([0,1]^d)^{V(G)}. \tag*{(23)} ∥ x − Q m x ∥ in ≤ 2 m κ for every x ∈ ([ 0 , 1 ] d ) V ( G ) . (23)
Consequently,
N K ( κ 2 m ) ≤ m d . (24) N_K\left(\frac{\kappa}{2m}\right)\le m^d. \tag*{(24)} N K ( 2 m κ ) ≤ m d . (24)
If ρ K \rho_K ρ K is uniform, then Q m ξ G Q_m\xi^G Q m ξ G is uniform on the palette S m S_m S m . The random-color WL results below use uniformly distributed colors.
Size-uniform quantization
For an MPNN F F F and a finite palette S ⊂ K S \subset K S ⊂ K , define the population predictor obtained from the quantized features by
F ‾ S ( G ) : = E [ F ( G , Q S ξ G ) ] . (25) \overline{F}_S(G) := \mathbb{E}[F(G,Q_S\xi^G)]. \tag*{(25)} F S ( G ) := E [ F ( G , Q S ξ G )] . (25)
Proposition 15 (Size-uniform quantization). Let F F F be a uniformly L L L -Lipschitz MPNN and let T : G → R T:\mathcal{G}\to\mathbb{R} T : G → R be a graph invariant. Then, for every finite nonempty S ⊂ K S\subset K S ⊂ K ,
sup G ∈ G ∣ F ‾ S ( G ) − T ( G ) ∣ ≤ sup G ∈ G ∣ F ‾ ( G ) − T ( G ) ∣ + L δ ( S ) . (26) \sup_{G\in\mathcal{G}}|\overline{F}_S(G)-T(G)|\leq\sup_{G\in\mathcal{G}}|\overline{F}(G)-T(G)|+L\delta(S). \tag*{(26)} G ∈ G sup ∣ F S ( G ) − T ( G ) ∣ ≤ G ∈ G sup ∣ F ( G ) − T ( G ) ∣ + L δ ( S ) . (26)
Proof. For every graph G G G ,
∣ F ‾ S ( G ) − F ‾ ( G ) ∣ ≤ E [ ∣ F ( G , Q S ξ G ) − F ( G , ξ G ) ∣ ] ≤ L δ ( S ) . (27) \begin{aligned}
|\overline{F}_S(G)-\overline{F}(G)|\leq\mathbb{E}[|F(G,Q_S\xi^G)-F(G,\xi^G)|] \\
&\leq L\delta(S). \tag*{(27)}
\end{aligned} ∣ F S ( G ) − F ( G ) ∣ ≤ E [ ∣ F ( G , Q S ξ G ) − F ( G , ξ G ) ∣ ] ≤ L δ ( S ) . (27)
Taking the supremum over G \mathcal{G} G and applying the triangle inequality completes the proof.
As a consequence, if F ‾ \overline{F} F approximates T T T with error at most ε / 2 \varepsilon/2 ε /2 and L > 0 L>0 L > 0 , taking S = S ε / ( 2 L ) S=S_{\varepsilon/(2L)} S = S ε / ( 2 L ) gives a predictor that uses N K ( ε / ( 2 L ) ) N_K(\varepsilon/(2L)) N K ( ε / ( 2 L )) colors with error at most ε \varepsilon ε . For the midpoint grid on [ 0 , 1 ] d [0,1]^d [ 0 , 1 ] d , taking q = m d q=m^d q = m d gives the explicit rate
sup G ∈ G ∣ F ‾ S m ( G ) − T ( G ) ∣ ≤ sup G ∈ G ∣ F ‾ ( G ) − T ( G ) ∣ + L κ 2 q 1 / d . (28) \sup_{G\in\mathcal{G}}|\overline{F}_{S_m}(G)-T(G)|\leq\sup_{G\in\mathcal{G}}|\overline{F}(G)-T(G)|+\frac{L\kappa}{2q^{1/d}}. \tag*{(28)} G ∈ G sup ∣ F S m ( G ) − T ( G ) ∣ ≤ G ∈ G sup ∣ F ( G ) − T ( G ) ∣ + 2 q 1/ d L κ . (28)
The palette size may depend on the target, accuracy, feature space, and Lipschitz constant, but not on graph size.
Let A \mathcal{A} A be the class of Lipschitz MPNNs with random node features supported on K K K , and let A c o l o r \mathcal{A}_{\mathrm{color}} A color be the subclass of random-color MPNNs as defined in § 2 .
Theorem 16 (Finite colors preserve the approximation class). The classes A \mathcal{A} A and A c o l o r \mathcal{A}_{\mathrm{color}} A color uniformly approximate the same graph invariants.
Proof. One direction follows from A c o l o r ⊆ A \mathcal{A}_{\mathrm{color}}\subseteq\mathcal{A} A color ⊆ A . For the other direction, suppose that A \mathcal{A} A uniformly approximates T T T , and fix ε > 0 \varepsilon>0 ε > 0 . Choose F ∈ A F\in\mathcal{A} F ∈ A whose population predictor has error at most ε / 2 \varepsilon/2 ε /2 , and let L L L be its uniform Lipschitz constant. Choose a finite palette S S S such that L δ ( S ) ≤ ε / 2 L\delta(S)\leq\varepsilon/2 L δ ( S ) ≤ ε /2 . Such a palette exists by compactness. By Proposition 15 , the quantized model belongs to A c o l o r \mathcal{A}_{\mathrm{color}} A color and approximates T T T with error at most ε \varepsilon ε .
One-hot and vector color encodings
The quantization reduction uses the vectors in a finite palette S ⊂ K S\subset K S ⊂ K as colors, while our later results use one-hot vectors for simplicity. We now compare these two representations.
An encoding of q q q colors in a feature space K K K is an injection c : [ q ] → K c:[q]\to K c : [ q ] → K . The one-hot encoding maps i i i to the coordinate basis vector e i ∈ R q e_i\in\mathbb{R}^q e i ∈ R q .
Let c ~ : [ q ] → K ~ \widetilde{c}:[q]\to\widetilde{K} c : [ q ] → K be another encoding, and let ϕ : K ~ → K \phi:\widetilde{K}\to K ϕ : K → K be M M M -Lipschitz. Define its conversion error as
η : = max i ∈ [ q ] ∥ ϕ ( c ~ ( i ) ) − c ( i ) ∥ . (29) \eta:=\max_{i\in[q]}\|\phi(\widetilde{c}(i))-c(i)\|. \tag*{(29)} η := i ∈ [ q ] max ∥ ϕ ( c ( i )) − c ( i ) ∥. (29)
For a coloring χ : V ( G ) → [ q ] \chi:V(G)\to[q] χ : V ( G ) → [ q ] , we can convert the encodings by c ∘ χ : = ( c ( χ v ) ) v ∈ V ( G ) c\circ\chi:=(c(\chi_v))_{v\in V(G)} c ∘ χ := ( c ( χ v ) ) v ∈ V ( G ) .
If F F F is uniformly L L L -Lipschitz, then applying ϕ \phi ϕ nodewise before F F F gives a uniformly L M LM L M -Lipschitz model. Moreover, for i.i.d. colors drawn from any distribution on [ q ] [q] [ q ] , uniform Lipschitzness gives
sup G ∈ G ∣ E F ( G , ϕ ∘ c ~ ∘ χ ) − E F ( G , c ∘ χ ) ∣ ≤ L η . (30) \sup_{G\in\mathcal{G}}|\mathbb{E}F(G,\phi\circ\widetilde{c}\circ\chi)-\mathbb{E}F(G,c\circ\chi)|\leq L\eta. \tag*{(30)} G ∈ G sup ∣ E F ( G , ϕ ∘ c ∘ χ ) − E F ( G , c ∘ χ ) ∣ ≤ L η . (30)
Proposition 17 (Encoding invariance). Fix q q q and any distribution on [ q ] [q] [ q ] . Uniformly Lipschitz MPNNs using one-hot colors and those using any injective vector encoding uniformly approximate the same graph invariants.
Proof. For a fixed finite palette, a biased ReLU network can interpolate each of the assignments e i ↦ c ( i ) e_i \mapsto c(i) e i ↦ c ( i ) and c ( i ) ↦ e i c(i) \mapsto e_i c ( i ) ↦ e i exactly. We implement the conversion using finitely many initial nodewise layers, setting W a g g ( ℓ ) = 0 W_{\mathrm{agg}}^{(\ell)}=0 W agg ( ℓ ) = 0 in these layers.4 Their depth, width, and weights may depend on the encodings, but not on graph size. The conversion therefore has a graph-size-independent Lipschitz constant. Composing it with the original MPNN gives the same output for every coloring. The resulting population predictors are therefore identical, although their Lipschitz constants may differ by a factor that is independent of graph size.
Taking S = S δ S=S_\delta S = S δ and c c c to be a bijection from [ N K ( δ ) ] [N_K(\delta)] [ N K ( δ )] onto S δ S_\delta S δ shows that the vector colors produced by quantization and their one-hot encodings have the same size-uniform approximation power.
Indistinguishability with Random Features Using CFI
In this section we introduce a family of graph pairs that requires an exponential number of trials in the graph size to distinguish with a fixed number of random colors. Our construction applies beyond MPNNs to any test based on the WL patterns of these graphs. The results of Sections 2 and B convert this trial lower bound into non-universality of uniformly Lipschitz MPNNs with continuous random features for bounded graph invariants. The construction gives this obstruction on connected graphs of maximum degree eight. Adding a virtual node gives a second family of diameter two with the same trial lower bound, so non-universality holds under either restriction separately.
Random-color WL
We begin by defining random-color WL, in which graph isomorphism testing is performed by comparing the WL patterns of two graphs over independent random coloring trials. For q ∈ N q \in\mathbb{N} q ∈ N , write [ q ] = { 1 , … , q } [q]=\{1,\ldots,q\} [ q ] = { 1 , … , q } . For a coloring χ : V ( G ) → [ q ] \chi: V(G) \to[q] χ : V ( G ) → [ q ] , define the 1-WL pattern of a vertex recursively. Set
π 0 G , χ ( v ) : = χ ( v ) , (31) \pi_0^{G,\chi}(v) := \chi(v), \tag*{(31)} π 0 G , χ ( v ) := χ ( v ) , (31)
and, for t ≥ 0 t \ge0 t ≥ 0 , let
π t + 1 G , χ ( v ) : = ( π t G , χ ( v ) , { { π t G , χ ( u ) : u ∼ v } } ) . (32) \pi_{t+1}^{G,\chi}(v) := \left(\pi_t^{G,\chi}(v), \{\!\{\pi_t^{G,\chi}(u): u \sim v\}\!\}\right). \tag*{(32)} π t + 1 G , χ ( v ) := ( π t G , χ ( v ) , { { π t G , χ ( u ) : u ∼ v } } ) . (32)
Here u ∼ v u \sim v u ∼ v denotes adjacency and { { ⋅ } } \{\!\{\cdot\}\!\} { { ⋅ } } denotes a multiset. The complete 1-WL pattern of v v v is then π G , χ ( v ) : = ( π t G , χ ( v ) ) t ≥ 0 \pi_{G,\chi}(v):=(\pi_t^{G,\chi}(v))_{t\ge0} π G , χ ( v ) := ( π t G , χ ( v ) ) t ≥ 0 . The graph-level observation is the unlabeled multiset
Π ( G , χ ) : = { { π G , χ ( v ) : v ∈ V ( G ) } } . (33) \Pi(G,\chi):=\{\!\{\pi_{G,\chi}(v):v\in V(G)\}\!\}. \tag*{(33)} Π ( G , χ ) := { { π G , χ ( v ) : v ∈ V ( G )} } . (33)
Sample a random coloring χ G : V ( G ) → [ q ] \chi^G:V(G)\to[q] χ G : V ( G ) → [ q ] with χ G ( v ) ∼ i . i . d . Unif ( [ q ] ) \chi^G(v)\mathrel{\overset{\mathrm{i.i.d.}}{\sim}}\operatorname{Unif}([q]) χ G ( v ) ∼ i.i.d. Unif ([ q ]) and define
Z W L , q ( G ) : = Π ( G , χ G ) . (34) Z_{\mathrm{WL},q}(G):=\Pi(G,\chi^G). \tag*{(34)} Z WL , q ( G ) := Π ( G , χ G ) . (34)
We write P G W L , q P_G^{\mathrm{WL},q} P G WL , q for the law of Z W L , q ( G ) Z_{\mathrm{WL},q}(G) Z WL , q ( G ) .
We use the same setting as Definition 5, with WL observations in place of scalar outputs.
Definition 6 (Random-color WL distinguishability). For q , s ∈ N q,s\in\mathbb{N} q , s ∈ N and α ∈ ( 0 , 1 / 2 ) \alpha\in(0,1/2) α ∈ ( 0 , 1/2 ) , a non-isomorphic pair G , H G,H G , H is statistically ( q , s , α ) (q,s,\alpha) ( q , s , α ) -distinguishable by random-color WL if there is a binary-valued, possibly randomized test ψ \psi ψ satisfying the following. For every A , B ∈ { G , H } A,B\in\{G,H\} A , B ∈ { G , H } , let
Z A = ( Z 1 ( A ) , … , Z s ( A ) ) , Z B ′ = ( Z 1 ′ ( B ) , … , Z s ′ ( B ) ) (35) \begin{aligned}
Z_A &= (Z_1(A),\ldots,Z_s(A)),\\
Z'_B &= (Z'_1(B),\ldots,Z'_s(B)) \tag*{(35)}
\end{aligned} Z A Z B ′ = ( Z 1 ( A ) , … , Z s ( A )) , = ( Z 1 ′ ( B ) , … , Z s ′ ( B )) (35) be independent batches with i.i.d. entries of laws P A W L , q P_A^{\mathrm{WL},q} P A WL , q and P B W L , q P_B^{\mathrm{WL},q} P B WL , q , respectively. Then
max A , B ∈ { G , H } Pr ( ψ ( Z A , Z B ′ ) ≠ 1 { A ≠ B } ) ≤ α . (36) \max_{A,B\in\{G,H\}}\Pr\left(\psi(Z_A,Z'_B)\ne\mathbf{1}\{A\ne B\}\right)\le\alpha. \tag*{(36)} A , B ∈ { G , H } max Pr ( ψ ( Z A , Z B ′ ) = 1 { A = B } ) ≤ α . (36)
Figure 4. The parity/CFI gadget.
The test may post-process the complete WL observations arbitrarily and is not restricted to an empirical mean. For a scalar-output MPNN F F F and a fixed color encoding c : [ q ] → K c:[q]\to K c : [ q ] → K , the observation Z W L , q ( G ) Z_{\mathrm{WL},q}(G) Z WL , q ( G ) determines the network output F ( G , c ∘ χ G ) F(G,c\circ\chi^G) F ( G , c ∘ χ G ) by the standard 1-WL upper bound [31 ] . Thus random-color WL tests include all tests based on random-color MPNN outputs.
We now construct graph pairs whose random-color WL distributions are exponentially close in total variation for any fixed number of colors. The construction uses the parity gadget from Cai et al. [4 ] , which we refer to as the CFI gadget. Let q ≥ 2 q\ge2 q ≥ 2 denote the number of colors.
The parity gadget
The CFI gadget is designed to construct graphs whose isomorphism class depends on the parity of choices made across many local structures.
The core gadget has three distinguished unordered vertex pairs
X = ( x 0 , x 1 ) , Y = ( y 0 , y 1 ) , Z = ( z 0 , z 1 ) , (37) X=(x^0,x^1),\qquad Y=(y^0,y^1),\qquad Z=(z^0,z^1), \tag*{(37)} X = ( x 0 , x 1 ) , Y = ( y 0 , y 1 ) , Z = ( z 0 , z 1 ) , (37)
and four internal vertices
g a b c , ( a , b , c ) ∈ { 0 , 1 } 3 , a ⊕ b ⊕ c = 0. (38) g_{abc},\qquad(a,b,c)\in\{0,1\}^3,\qquad a\oplus b\oplus c=0. \tag*{(38)} g ab c , ( a , b , c ) ∈ { 0 , 1 } 3 , a ⊕ b ⊕ c = 0. (38)
Here ⊕ \oplus ⊕ denotes addition modulo two. Each internal vertex g a b c g_{abc} g ab c is adjacent exactly to the three distinguished vertices
x a , y b , z c . (39) x^a,\qquad y^b,\qquad z^c. \tag*{(39)} x a , y b , z c . (39)
The central property is that endpoint swaps extend to an automorphism over the entire gadget precisely when they have even parity. Interpreting each swap as a bit flip, the third swap is therefore the XOR of the first two. This is the k = 3 k=3 k = 3 case of Lemma 6.1 of Cai et al. [4 ] .
Lemma 18 (Extension property of the parity gadget). Let s X , s Y , s Z ∈ { 0 , 1 } s_X,s_Y,s_Z\in\{0,1\} s X , s Y , s Z ∈ { 0 , 1 } , and let τ \tau τ be the permutation of the distinguished vertices that swaps the endpoints of pair X X X if s X = 1 s_X=1 s X = 1 , swaps the endpoints of pair Y Y Y if s Y = 1 s_Y=1 s Y = 1 , and swaps the endpoints of pair Z Z Z if s Z = 1 s_Z=1 s Z = 1 .
Then τ \tau τ extends to an automorphism of the parity gadget if and only if
s X ⊕ s Y ⊕ s Z = 0. (40) s_X\oplus s_Y\oplus s_Z=0. \tag*{(40)} s X ⊕ s Y ⊕ s Z = 0. (40)
The graph pair family
We now compose the parity gadgets so that a parity choice made at any input pair can be transmitted to a single root pair.
Fix k ≥ 2 k\ge2 k ≥ 2 input vertex pairs
X i = ( x i 0 , x i 1 ) , i = 1 , … , k . (41) X_i=(x_i^0,x_i^1),\qquad i=1,\ldots,k. \tag*{(41)} X i = ( x i 0 , x i 1 ) , i = 1 , … , k . (41)
For each i i i , attach two six-vertex blocks to the input pair as follows. Attach x i 0 x_i^0 x i 0 to all six vertices of a copy of 2 C 3 2C_3 2 C 3 , and attach x i 1 x_i^1 x i 1 to all six vertices of a copy of C 6 C_6 C 6 . Here 2 C 3 2C_3 2 C 3 is the disjoint union of two triangles and C 6 C_6 C 6 is a six-cycle. Thus the two sides of the input pair are non-isomorphic as rooted attached blocks.
Next, build a full binary tree of parity gadgets whose leaves are the input pairs X 1 , … , X k X_1,\ldots,X_k X 1 , … , X k . Each internal node of the tree is one copy of the parity gadget above. We identify each child’s output pair with its parent’s input pair, matching superscripts. The output of the tree is a final vertex pair
R = ( r 0 , r 1 ) . (42) R=(r^0,r^1). \tag*{(42)} R = ( r 0 , r 1 ) . (42)
Finally, attach a marker leaf to r 0 r^0 r 0 in G 0 G_0 G 0 and to r 1 r^1 r 1 in G 1 G_1 G 1 . We write G 0 , k , G 1 , k G_{0,k},G_{1,k} G 0 , k , G 1 , k when the dependence on k k k matters. The 2 k − 1 2k-1 2 k − 1 vertex pairs, k − 1 k-1 k − 1 gadgets, attached blocks, and marker give
n k : = ∣ V ( G 0 , k ) ∣ = ∣ V ( G 1 , k ) ∣ = 20 k − 5. (43) n_k:=|V(G_{0,k})|=|V(G_{1,k})|=20k-5. \tag*{(43)} n k := ∣ V ( G 0 , k ) ∣ = ∣ V ( G 1 , k ) ∣ = 20 k − 5. (43)
Each input endpoint has degree eight, each intermediate endpoint has degree four, and every other vertex has degree at most three. Thus both graphs are connected and have maximum degree eight. The case k = 4 k=4 k = 4 is shown in Figure 5 .
Figure 5. The CFI graph pair with four input pairs (k = 4 k = 4 k = 4 ). The intermediate pairs ( z 1 0 , z 1 1 ) (z_1^0,z_1^1) ( z 1 0 , z 1 1 ) and ( z 2 0 , z 2 1 ) (z_2^0,z_2^1) ( z 2 0 , z 2 1 ) are each shared by a child gadget and the root gadget. Shading indicates vertex roles, not random colors. The diameter-two variants are obtained by adding one virtual node adjacent to every vertex shown in each graph.
For j ∈ { 0 , 1 } j\in\{0,1\} j ∈ { 0 , 1 } , let G ^ j , k \widehat{G}_{j,k} G j , k be obtained from G j , k G_{j,k} G j , k by adding a virtual node ν j \nu_j ν j adjacent to every original vertex, including the marker. We omit k k k when it is clear from context. Then
n ^ k : = ∣ V ( G ^ j , k ) ∣ = n k + 1 = 20 k − 4. (44) \widehat{n}_k:=|V(\widehat{G}_{j,k})|=n_k+1=20k-4. \tag*{(44)} n k := ∣ V ( G j , k ) ∣ = n k + 1 = 20 k − 4. (44)
The graphs G ^ j , k \widehat{G}_{j,k} G j , k have diameter two. Their original vertices have degree at most nine, while ν j \nu_j ν j has degree n k n_k n k , so the virtual node is the unique vertex of degree greater than nine. In random-color WL, it receives an independent uniform color from the same palette as every other vertex.
Non-isomorphism
We next verify that the graphs G 0 G_0 G 0 and G 1 G_1 G 1 , obtained by attaching the marker leaf to r 0 r^0 r 0 and r 1 r^1 r 1 , respectively, are non-isomorphic.
Lemma 19. The graphs G 0 G_0 G 0 and G 1 G_1 G 1 are not isomorphic. The graphs G ^ 0 \widehat{G}_0 G 0 and G ^ 1 \widehat{G}_1 G 1 are also not isomorphic.
Proof. Suppose that γ : V ( G 0 ) → V ( G 1 ) \gamma:V(G_0)\to V(G_1) γ : V ( G 0 ) → V ( G 1 ) is a graph isomorphism, and let m j m_j m j be the marker leaf of G j G_j G j . Since the marker and the unmarked root endpoint are the unique vertices of degrees one and two, respectively, γ ( m 0 ) = m 1 \gamma(m_0)=m_1 γ ( m 0 ) = m 1 , γ ( r 0 ) = r 1 \gamma(r^0)=r^1 γ ( r 0 ) = r 1 , and γ ( r 1 ) = r 0 \gamma(r^1)=r^0 γ ( r 1 ) = r 0 . The four internal vertices of the root gadget are precisely the neighbors of r 0 r^0 r 0 or r 1 r^1 r 1 other than the marker. Since γ \gamma γ preserves adjacency and maps the root pair and marker to their counterparts, it maps this four-vertex set in G 0 G_0 G 0 onto the corresponding set in G 1 G_1 G 1 . The individual internal vertices may be permuted.
For a gadget with output pair W = ( w 0 , w 1 ) W=(w^0,w^1) W = ( w 0 , w 1 ) , let A A A be its set of four internal vertices. Two distinct input vertices u , v u,v u , v belong to the same pair if and only if N ( u ) ∩ N ( v ) ∩ A = ∅ N(u)\cap N(v)\cap A=\varnothing N ( u ) ∩ N ( v ) ∩ A = ∅ , where N ( v ) N(v) N ( v ) denotes the neighborhood of v v v . Since γ \gamma γ preserves this condition, it maps input pairs to input pairs, possibly interchanging the two. Such a pair is a leaf of the gadget tree exactly when its endpoints have degree eight. Otherwise, the four internal vertices of its child gadget are the neighbors of its endpoints outside A A A . Induction from the root therefore shows that γ \gamma γ preserves the pair–gadget tree, up to permutation of sibling subtrees.
For each pair W = ( w 0 , w 1 ) W=(w^0,w^1) W = ( w 0 , w 1 ) , let W ′ = ( u 0 , u 1 ) W'=(u^0,u^1) W ′ = ( u 0 , u 1 ) be its image pair and define s W ∈ { 0 , 1 } s_W\in\{0,1\} s W ∈ { 0 , 1 } by
γ ( w b ) = u b ⊕ s W , b ∈ { 0 , 1 } . (45) \gamma(w^b)=u^{b\oplus s_W},\qquad b\in\{0,1\}. \tag*{(45)} γ ( w b ) = u b ⊕ s W , b ∈ { 0 , 1 } . (45)
Since γ \gamma γ exchanges the root endpoints, s R = 1 s_R=1 s R = 1 . At every input pair X i X_i X i , the non-isomorphic 2 C 3 2C_3 2 C 3 and C 6 C_6 C 6 attachments force s X i = 0 s_{X_i}=0 s X i = 0 . By Lemma 18 , every gadget with input pairs X , Y X,Y X , Y and output pair Z Z Z satisfies
s Z = s X ⊕ s Y . (46) s_Z=s_X\oplus s_Y. \tag*{(46)} s Z = s X ⊕ s Y . (46)
This relation is unchanged when we interchange the two input pairs. We prove s W = 0 s_W=0 s W = 0 for every pair W W W by induction on the height of the subtree rooted at W W W . At height zero, W W W is an input pair X i X_i X i , for which s X i = 0 s_{X_i}=0 s X i = 0 . For the induction step, let Z Z Z be the output pair of a gadget with input pairs X , Y X,Y X , Y . Their subtrees have smaller height, so the induction hypothesis gives s X = s Y = 0 s_X=s_Y=0 s X = s Y = 0 . Hence s Z = s X ⊕ s Y = 0 s_Z=s_X\oplus s_Y=0 s Z = s X ⊕ s Y = 0 . Taking W = R W=R W = R gives s R = 0 s_R=0 s R = 0 , contradicting s R = 1 s_R=1 s R = 1 .
Any isomorphism between G ^ 0 \widehat{G}_0 G 0 and G ^ 1 \widehat{G}_1 G 1 must map ν 0 \nu_0 ν 0 to ν 1 \nu_1 ν 1 , since these are their unique vertices of degree greater than nine. Deleting the virtual nodes would then give an isomorphism between G 0 G_0 G 0 and G 1 G_1 G 1 , which we have ruled out.
Block erasure
We next identify an event under which the random coloring conceals the local difference between the C 6 C_6 C 6 and 2 C 3 2C_3 2 C 3 attachments at an input pair. For each input pair X i X_i X i , let B i B_i B i be the event that both attached six-vertex blocks are monochromatic. The two blocks need not have the same color.
Since a six-vertex block is monochromatic with probability q − 5 q^{-5} q − 5 , we have
Pr ( B i ) = q − 10 . (47) \Pr(B_i)=q^{-10}. \tag*{(47)} Pr ( B i ) = q − 10 . (47)
Lemma 20 (Block erasure). Let G ∈ { G 0 , G 1 } G\in\{G_0,G_1\} G ∈ { G 0 , G 1 } and let χ \chi χ be a coloring for which B i B_i B i holds. Let H H H be obtained from G G G by replacing the 2 C 3 2C_3 2 C 3 attachment at x i 0 x_i^0 x i 0 with C 6 C_6 C 6 and the C 6 C_6 C 6 attachment at x i 1 x_i^1 x i 1 with 2 C 3 2C_3 2 C 3 , on the same vertex sets and with all other edges unchanged. Then
Π ( G , χ ) = Π ( H , χ ) . (48) \Pi(G,\chi)=\Pi(H,\chi). \tag*{(48)} Π ( G , χ ) = Π ( H , χ ) . (48)
Proof. At round zero, corresponding vertices have the same color in G G G and H H H , and each replaced block is monochromatic. Suppose that corresponding vertices have the same patterns at round t t t and that all vertices within each replaced block share a pattern. In both graphs, each block vertex has two neighbors within its block and one at the unchanged attachment endpoint. Thus, at round t + 1 t+1 t + 1 , corresponding block vertices have the same pattern, and all vertices within each block share a pattern. All other vertices have unchanged neighborhoods, so their patterns also agree. By induction, corresponding vertices have the same patterns at every round, and the graph-level observations are equal.
The parity tree is designed so that concealing one input pair also conceals which root endpoint carries the marker leaf.
Let B : = ⋃ i = 1 k B i B:=\bigcup_{i=1}^k B_i B := ⋃ i = 1 k B i be the event that at least one input block pair is erased.
Lemma 21. Conditioned on B B B , the random-color WL sample distributions of G 0 G_0 G 0 and G 1 G_1 G 1 are identical,
Law ( Z W L , q ( G 0 ) ∣ B ) = Law ( Z W L , q ( G 1 ) ∣ B ) . (49) \operatorname{Law}(Z_{\mathrm{WL},q}(G_0)\mid B)=\operatorname{Law}(Z_{\mathrm{WL},q}(G_1)\mid B). \tag*{(49)} Law ( Z WL , q ( G 0 ) ∣ B ) = Law ( Z WL , q ( G 1 ) ∣ B ) . (49) The same equality holds with G ^ 0 \widehat{G}_0 G 0 and G ^ 1 \widehat{G}_1 G 1 in place of G 0 G_0 G 0 and $G_1.
Proof. On B B B , choose an erased input pair X i X_i X i . Let G c o r e G_{\mathrm{core}} G core be the graph formed by the parity gadgets, without the attached blocks or marker. We define an automorphism τ i : V ( G c o r e ) → V ( G c o r e ) \tau_i: V(G_{\mathrm{core}}) \to V(G_{\mathrm{core}}) τ i : V ( G core ) → V ( G core ) along the unique path from X i X_i X i to R R R in the parity-gadget tree. For each pair W = ( w 0 , w 1 ) W=(w^0,w^1) W = ( w 0 , w 1 ) , set s W = 1 s_W=1 s W = 1 if W W W lies on this path and s W = 0 s_W=0 s W = 0 otherwise, and define
τ i ( w b ) = w b ⊕ s W , b ∈ { 0 , 1 } . (50) \tau_i(w^b)=w^{b\oplus s_W}, \qquad b\in\{0,1\}. \tag*{(50)} τ i ( w b ) = w b ⊕ s W , b ∈ { 0 , 1 } . (50)
Each gadget has either two incident pairs swapped or none, so its swap bits satisfy s X ⊕ s Y ⊕ s Z = 0 s_X\oplus s_Y\oplus s_Z=0 s X ⊕ s Y ⊕ s Z = 0 . By Lemma 18 , these swaps extend to a gadget automorphism. Explicitly, on its internal vertices, set
τ i ( g a b c ) = g a ⊕ s X , b ⊕ s Y , c ⊕ s Z . (51) \tau_i(g_{abc})=g_{a\oplus s_X,\ b\oplus s_Y,\ c\oplus s_Z}. \tag*{(51)} τ i ( g ab c ) = g a ⊕ s X , b ⊕ s Y , c ⊕ s Z . (51)
Since the gadget maps agree on shared pairs and the gadgets have disjoint internal vertex sets, these maps define an automorphism τ i \tau_i τ i of G c o r e G_{\mathrm{core}} G core .
To extend τ i \tau_i τ i to a bijection V ( G 0 ) → V ( G 1 ) V(G_0)\to V(G_1) V ( G 0 ) → V ( G 1 ) , map the marker of G 0 G_0 G 0 to that of G 1 G_1 G 1 and fix all attached blocks except those at X i X_i X i . Exchange the two blocks at X i X_i X i using a fixed bijection in one direction and its inverse in the other. Since τ i ( r b ) = r b ⊕ 1 \tau_i(r^b)=r^{b\oplus1} τ i ( r b ) = r b ⊕ 1 , this extension preserves the marker edge. The only edges it fails to preserve are within the exchanged 2 C 3 2C_3 2 C 3 and C 6 C_6 C 6 blocks. For a coloring χ \chi χ satisfying B i B_i B i , both blocks are monochromatic. Thus Lemma 20 gives
Π ( G 0 , χ ) = Π ( G 1 , χ ∘ τ i − 1 ) . (52) \Pi(G_0,\chi)=\Pi(G_1,\chi\circ\tau_i^{-1}). \tag*{(52)} Π ( G 0 , χ ) = Π ( G 1 , χ ∘ τ i − 1 ) . (52)
Here χ ∘ τ i − 1 \chi\circ\tau_i^{-1} χ ∘ τ i − 1 assigns to each image vertex the color of its preimage.
The coloring map χ ↦ χ ∘ τ i − 1 \chi\mapsto\chi\circ\tau_i^{-1} χ ↦ χ ∘ τ i − 1 preserves the set of erased input pairs. If we use the same choice of X i X_i X i for each such set, this map is reversible and gives a bijection between the colorings satisfying B B B . This bijection preserves their uniform conditional law. Since matched colorings have identical WL observations, their laws agree conditioned on B B B .
For the virtual-node graphs, extend each bijection by setting τ i ( ν 0 ) = ν 1 \tau_i(\nu_0)=\nu_1 τ i ( ν 0 ) = ν 1 and carrying the color of ν 0 \nu_0 ν 0 to ν 1 \nu_1 ν 1 . This extension preserves all edges incident to the virtual node. The only remaining discrepancies are within the two exchanged monochromatic blocks. The induction in Lemma 20 still applies: each block vertex receives the additional pattern of the virtual node, and the two virtual nodes receive equal multisets of patterns from all original vertices. Thus corresponding vertices have identical patterns at every round. Since the virtual-node color is independent of B B B , the extended coloring bijection also preserves the uniform conditional law.
Total variation and sample complexity
We now convert the root-hiding event into an upper bound on total variation and, subsequently, into a lower bound on the required number of trials.
Proposition 22 (Upper bound on CFI total variation). The random-color WL distributions of G 0 G_0 G 0 and G 1 G_1 G 1 satisfy
TV ( P G 0 W L , q , P G 1 W L , q ) ≤ ( 1 − q − 10 ) k . (53) \operatorname{TV}\left(P_{G_0}^{\mathrm{WL},q},P_{G_1}^{\mathrm{WL},q}\right)\leq\left(1-q^{-10}\right)^k. \tag*{(53)} TV ( P G 0 WL , q , P G 1 WL , q ) ≤ ( 1 − q − 10 ) k . (53) For fixed q q q , this bound is exp ( − Ω ( k ) ) \exp(-\Omega(k)) exp ( − Ω ( k )) . The same bound holds for G ^ 0 \widehat{G}_0 G 0 and G ^ 1 \widehat{G}_1 G 1 .
Proof. By Lemma 21, the conditional laws on B B B agree. Since B B B has the same probability in both graphs,
TV ( P G 0 W L , q , P G 1 W L , q ) ≤ Pr ( B c ) . (54) \operatorname{TV}\left(P_{G_0}^{\mathrm{WL},q},P_{G_1}^{\mathrm{WL},q}\right)\leq\Pr(B^c). \tag*{(54)} TV ( P G 0 WL , q , P G 1 WL , q ) ≤ Pr ( B c ) . (54) Here B c B^c B c denotes the complement of B B B , namely the event that no input block pair is erased. The events B i B_i B i are independent because they depend on disjoint attached blocks. Therefore
Pr ( B c ) = ∏ i = 1 k Pr ( B i c ) = ( 1 − q − 10 ) k . (55) \Pr(B^c)=\prod_{i=1}^{k}\Pr(B_i^c)=\left(1-q^{-10}\right)^k. \tag*{(55)} Pr ( B c ) = i = 1 ∏ k Pr ( B i c ) = ( 1 − q − 10 ) k . (55) The conditional-law equality in Lemma 21 and the probabilities of the events B i B_i B i are unchanged by adding the virtual node, so the same argument proves the bound for G ^ 0 , G ^ 1 \widehat{G}_0,\widehat{G}_1 G 0 , G 1 .
Corollary 23 (Lower bound on the number of random-color WL trials). Fix q ≥ 2 q \ge2 q ≥ 2 and α ∈ ( 0 , 1 / 2 ) \alpha\in(0,1/2) α ∈ ( 0 , 1/2 ) . If the pair ( G 0 , G 1 ) (G_0,G_1) ( G 0 , G 1 ) is statistically ( q , s , α ) (q,s,\alpha) ( q , s , α ) -distinguishable by random-color WL, then
s ≥ ( 1 − 2 α ) ( 1 − q − 10 ) − k . (56) s \ge(1-2\alpha)(1-q^{-10})^{-k}. \tag*{(56)} s ≥ ( 1 − 2 α ) ( 1 − q − 10 ) − k . (56) In particular, for fixed q q q and α \alpha α , the required number of trials is exp ( Ω ( n k ) ) \exp(\Omega(n_k)) exp ( Ω ( n k )) . The same lower bound holds for ( G ^ 0 , G ^ 1 ) (\widehat{G}_0,\widehat{G}_1) ( G 0 , G 1 ) , with n ^ k \widehat{n}_k n k in place of n k n_k n k in the asymptotic statement.
Proof. By Proposition 22 and subadditivity of total variation under products, s s s independent trials satisfy
TV ( ( P G 0 W L , q ) ⊗ s , ( P G 1 W L , q ) ⊗ s ) ≤ s ( 1 − q − 10 ) k . (57) \operatorname{TV}\left((P_{G_0}^{\mathrm{WL},q})^{\otimes s},(P_{G_1}^{\mathrm{WL},q})^{\otimes s}\right) \le s(1-q^{-10})^k. \tag*{(57)} TV ( ( P G 0 WL , q ) ⊗ s , ( P G 1 WL , q ) ⊗ s ) ≤ s ( 1 − q − 10 ) k . (57)
Here P ⊗ Q P\otimes Q P ⊗ Q denotes the joint law of independent draws from P P P and Q Q Q , and P ⊗ s P^{\otimes s} P ⊗ s denotes the joint law of s s s independent draws from P P P . Let P s : = ( P G 0 W L , q ) ⊗ s P_s := (P_{G_0}^{\mathrm{WL},q})^{\otimes s} P s := ( P G 0 WL , q ) ⊗ s and Q s : = ( P G 1 W L , q ) ⊗ s Q_s := (P_{G_1}^{\mathrm{WL},q})^{\otimes s} Q s := ( P G 1 WL , q ) ⊗ s . A test with failure probability at most α \alpha α has expected output at most α \alpha α under P s ⊗ P s P_s \otimes P_s P s ⊗ P s and at least 1 − α 1-\alpha 1 − α under P s ⊗ Q s P_s \otimes Q_s P s ⊗ Q s . Consequently,
1 − 2 α ≤ TV ( P s ⊗ P s , P s ⊗ Q s ) = TV ( P s , Q s ) ≤ s ( 1 − q − 10 ) k . (58) \begin{aligned}
1-2\alpha&\le\operatorname{TV}(P_s \otimes P_s,P_s \otimes Q_s)\\
&= \operatorname{TV}(P_s,Q_s)\\
&\le s(1-q^{-10})^k. \tag*{(58)}
\end{aligned} 1 − 2 α ≤ TV ( P s ⊗ P s , P s ⊗ Q s ) = TV ( P s , Q s ) ≤ s ( 1 − q − 10 ) k . (58)
Rearranging gives the first claim. The second follows from n k = Θ ( k ) n_k=\Theta(k) n k = Θ ( k ) when q q q and α \alpha α are fixed. For the virtual-node pair, the same total-variation bound applies and n ^ k = Θ ( k ) \widehat{n}_k=\Theta(k) n k = Θ ( k ) , giving the remaining claim.
Non-universality
We now use the trial lower bound to prove non-universality for bounded graph invariants, separately on bounded-degree graphs and bounded-diameter graphs.
Corollary 24 (Non-universality from CFI pairs). The class of scalar-output uniformly Lipschitz MPNNs with uniform initialization on [ 0 , 1 ] d [0,1]^d [ 0 , 1 ] d is not a size-uniform universal approximator for bounded graph invariants on either of the following graph classes:
connected graphs of maximum degree at most eight;
graphs of diameter two.
Proof. Fix a uniformly Lipschitz model F F F . By Proposition 15, choose a midpoint grid S m S_m S m , with m ≥ 2 m \ge2 m ≥ 2 , such that quantization changes each population mean by at most 1 / 8 1/8 1/8 , uniformly over graphs. The quantized features are uniform on the q = m d q=m^d q = m d grid points. The restriction of F F F to S m S_m S m remains uniformly Lipschitz. By Proposition 2, a finite number s s s of trials suffices to detect any quantized population gap of at least 1 / 4 1/4 1/4 with failure probability at most 1 / 3 1/3 1/3 . These tests are also random-color WL tests, and both q q q and s s s are independent of graph size.
Choose H j , k = G j , k H_{j,k}=G_{j,k} H j , k = G j , k for the first graph class and H j , k = G ^ j , k H_{j,k}=\widehat{G}_{j,k} H j , k = G j , k for the second. For sufficiently large k k k , Corollary 23 rules out statistical ( q , s , 1 / 3 ) (q,s,1/3) ( q , s , 1/3 ) -distinguishability of ( H 0 , k , H 1 , k ) (H_{0,k},H_{1,k}) ( H 0 , k , H 1 , k ) . The quantized population gap must therefore be less than 1 / 4 1/4 1/4 . Including the two quantization errors gives gap F ( H 0 , k , H 1 , k ) < 1 / 2 \operatorname{gap}_F(H_{0,k},H_{1,k})<1/2 gap F ( H 0 , k , H 1 , k ) < 1/2 .
For the chosen graph class, define a bounded graph invariant T C F I T_{\mathrm{CFI}} T CFI to equal 1 on graphs isomorphic to H 1 , k H_{1,k} H 1 , k for some k ≥ 2 k \ge2 k ≥ 2 and 0 otherwise. By Lemma 19 and the strictly increasing orders of each family, we have T C F I ( H 0 , k ) = 0 T_{\mathrm{CFI}}(H_{0,k})=0 T CFI ( H 0 , k ) = 0 and T C F I ( H 1 , k ) = 1 T_{\mathrm{CFI}}(H_{1,k})=1 T CFI ( H 1 , k ) = 1 for every k k k . Uniform approximation to T C F I T_{\mathrm{CFI}} T CFI with error less than 1 / 4 1/4 1/4 would force gap F ( H 0 , k , H 1 , k ) > 1 / 2 \operatorname{gap}_F(H_{0,k},H_{1,k})>1/2 gap F ( H 0 , k , H 1 , k ) > 1/2 for every k k k , contradicting the bound above. Thus the model class fails to uniformly approximate a bounded graph invariant on each of the two graph classes.
Colors and trials
The trial lower bound also quantifies the tradeoff between the number of colors and the number of trials.
Corollary 25 (Colors and trials). Distinguishing the CFI pair ( G 0 , k , G 1 , k ) (G_{0,k},G_{1,k}) ( G 0 , k , G 1 , k ) by random-color WL with success probability at least 2 / 3 2/3 2/3 , using q ≥ 2 q \ge2 q ≥ 2 colors and s s s trials per graph, requires
q 10 log ( 3 s ) = Ω ( n k ) . (59) q^{10}\log(3s)=\Omega(n_k). \tag*{(59)} q 10 log ( 3 s ) = Ω ( n k ) . (59) The same conclusion holds for ( G ^ 0 , k , G ^ 1 , k ) (\widehat{G}_{0,k},\widehat{G}_{1,k}) ( G 0 , k , G 1 , k ) with n ^ k \widehat{n}_k n k in place of n k n_k n k .
Proof. By Corollary 23 with α = 1 / 3 \alpha= 1/3 α = 1/3 ,
log ( 3 s ) ≥ − k log ( 1 − q − 10 ) ≥ k q − 10 . (60) \log(3s) \ge-k\log(1-q^{-10}) \ge kq^{-10}. \tag*{(60)} log ( 3 s ) ≥ − k log ( 1 − q − 10 ) ≥ k q − 10 . (60)
Multiplying by q 10 q^{10} q 10 and using n k = 20 k − 5 n_k = 20k - 5 n k = 20 k − 5 proves the claim. For the virtual-node pair, the same trial lower bound and n ^ k = 20 k − 4 \widehat{n}_k = 20k - 4 n k = 20 k − 4 give the stated conclusion.
The number of colors enters this bound polynomially, whereas the number of trials enters only logarithmically. Thus, compensating for a smaller color palette can require exponentially more trials.
Conversely, one trial per graph with q = 3 n k 2 q = 3n_k^2 q = 3 n k 2 colors achieves success probability at least 2 / 3 2/3 2/3 . By the union bound, both colorings are injective with probability at least 1 − 2 ( n k 2 ) / q ≥ 2 / 3 1 - 2\binom{n_k}{2}/q \ge2/3 1 − 2 ( 2 n k ) / q ≥ 2/3 . On this event, one WL refinement determines each graph up to isomorphism. Define the test to return zero if either coloring is not injective and otherwise compare the reconstructed graphs. This test satisfies the required guarantee for every A , B ∈ { G 0 , k , G 1 , k } A, B \in\{G_{0,k}, G_{1,k}\} A , B ∈ { G 0 , k , G 1 , k } . Thus polynomially many colors suffice in a single trial, whereas any fixed number of colors requires exponentially many trials by Corollary 23. For the virtual-node pair, the same injective-coloring test uses q = 3 n ^ k 2 q = 3\widehat{n}_k^2 q = 3 n k 2 colors. Therefore this exponential separation holds both on graphs of maximum degree eight and, separately, on graphs of diameter two.
Separation from Uncolored 1-WL
Now we show that random colors strictly increase expressive power over standard uncolored 1-WL.
Proposition 26 (Random colors detect three-step returns). For arbitrarily large n n n , there are n n n -vertex graphs G n , H n G_n, H_n G n , H n that are 1-WL indistinguishable, but are separated by a depth-3, uniformly Lipschitz random-color MPNN F F F using two initial colors, with gap F ( G n , H n ) = 1 / 4 \operatorname{gap}_F(G_n, H_n) = 1/4 gap F ( G n , H n ) = 1/4 .
Proof. For each ℓ ≥ 1 \ell\ge1 ℓ ≥ 1 , set n = 6 ℓ n = 6\ell n = 6 ℓ . Let G n G_n G n and H n H_n H n be disjoint unions of ℓ \ell ℓ copies of 2 C 3 2C_3 2 C 3 and C 6 C_6 C 6 , respectively. Both graphs are 2-regular on n n n vertices, so uncolored 1-WL yields one color class of size n n n at every round on both graphs. Thus, the graphs are 1-WL indistinguishable.
Define the normalized neighbor-averaging operator M G M_G M G by
( M G x ) v : = 1 deg G ( v ) ∑ u ∼ v x u if deg G ( v ) > 0 , (61) (M_Gx)_v := \frac{1}{\deg_G(v)}\sum_{u\sim v}x_u \quad\text{if }\deg_G(v)>0, \tag*{(61)} ( M G x ) v := deg G ( v ) 1 u ∼ v ∑ x u if deg G ( v ) > 0 , (61)
and set ( M G x ) v = 0 (M_Gx)_v = 0 ( M G x ) v = 0 at isolated vertices. Write M G 3 M_G^3 M G 3 for three successive applications of this operator. For initial features x ∈ [ − 1 , 1 ] V ( G ) x \in[-1,1]^{V(G)} x ∈ [ − 1 , 1 ] V ( G ) , set
F ( G , x ) : = 1 ∣ V ( G ) ∣ ∑ v ∈ V ( G ) ∣ x v + ( M G 3 x ) v ∣ . (62) F(G,x) := \frac{1}{|V(G)|}\sum_{v\in V(G)}\left|x_v + (M_G^3x)_v\right|. \tag*{(62)} F ( G , x ) := ∣ V ( G ) ∣ 1 v ∈ V ( G ) ∑ x v + ( M G 3 x ) v . (62)
The MPNN stores signed values through their positive and negative parts and performs normalized neighbor averaging. In the third layer, it computes the absolute value using ∣ z ∣ = ReLU ( z ) + ReLU ( − z ) |z| = \operatorname{ReLU}(z) + \operatorname{ReLU}(-z) ∣ z ∣ = ReLU ( z ) + ReLU ( − z ) . Normalized averaging is nonexpansive in the max-over-nodes norm, and the final average does not introduce any dependence on ∣ V ( G ) ∣ |V(G)| ∣ V ( G ) ∣ . Thus F F F is uniformly 2-Lipschitz.
Let each vertex receive an independent uniform color ξ v ∈ { − 1 , 1 } \xi_v \in\{-1,1\} ξ v ∈ { − 1 , 1 } . The identity ∣ a + b ∣ = 1 + a b |a+b| = 1+ab ∣ a + b ∣ = 1 + ab for a ∈ { − 1 , 1 } a \in\{-1,1\} a ∈ { − 1 , 1 } and b ∈ [ − 1 , 1 ] b \in[-1,1] b ∈ [ − 1 , 1 ] gives
F ( G , ξ G ) = 1 + 1 ∣ V ( G ) ∣ ∑ v ∈ V ( G ) ξ v ( M G 3 ξ G ) v . (63) F(G,\xi^G) = 1 + \frac{1}{|V(G)|}\sum_{v\in V(G)}\xi_v(M_G^3\xi^G)_v. \tag*{(63)} F ( G , ξ G ) = 1 + ∣ V ( G ) ∣ 1 v ∈ V ( G ) ∑ ξ v ( M G 3 ξ G ) v . (63)
Let r G ( v ) r_G(v) r G ( v ) be the probability that a length-3 random walk from v v v returns to v v v . The centered colors are independent with zero mean, so all terms with u ≠ v u\ne v u = v are zero in expectation, while E ξ v 2 = 1 \mathbb{E}\xi_v^2 = 1 E ξ v 2 = 1 . Therefore,
F ‾ ( G ) = 1 + 1 ∣ V ( G ) ∣ ∑ v ∈ V ( G ) r G ( v ) . (64) \overline{F}(G) = 1 + \frac{1}{|V(G)|}\sum_{v\in V(G)}r_G(v). \tag*{(64)} F ( G ) = 1 + ∣ V ( G ) ∣ 1 v ∈ V ( G ) ∑ r G ( v ) . (64)
On 2 C 3 2C_3 2 C 3 , this probability is 1 / 4 1/4 1/4 at every vertex, as the walk can go around its triangle in one of the two directions. On C 6 C_6 C 6 , it is 0 0 0 , since C 6 C_6 C 6 is bipartite and a walk of odd length cannot return to its starting vertex. Thus F ‾ ( G n ) = 5 / 4 \overline{F}(G_n) = 5/4 F ( G n ) = 5/4 and F ‾ ( H n ) = 1 \overline{F}(H_n) = 1 F ( H n ) = 1 , giving gap F ( G n , H n ) = 1 / 4 \operatorname{gap}_F(G_n,H_n) = 1/4 gap F ( G n , H n ) = 1/4 .
By Proposition 2, this constant population gap yields statistical distinguishability using a constant number of trials.
Incomparability with Higher-Order WL
We now compare random-color MPNNs with higher-order WL, using statistical distinguishability as defined in Definition 6. Under the convention stated in the main text, k k k -WL colors ordered k k k -tuples of vertices. Initially, a tuple’s color records equality and adjacency among its entries. For an update, each vertex w w w gives a list of k k k colors: those of the tuples obtained by replacing the first entry by w w w , then the second, and so on. The new color records the old color and the multiset of these lists over all vertices w w w .
Theorem 27 (Incomparability with higher-order WL). For every k ≥ 2 k \ge2 k ≥ 2 :
some k k k -WL-indistinguishable pair is distinguished with success probability greater than 2 / 3 2/3 2/3 by a uniformly 1 1 1 -Lipschitz two-color MPNN with order-normalized sum aggregation using one random-color trial per graph;
for every fixed q q q , s ≥ 1 s \ge1 s ≥ 1 , some pair distinguished by 2-WL, and hence by k k k -WL, is not statistically ( q , s , 1 / 3 ) (q,s,1/3) ( q , s , 1/3 ) -distinguishable by random-color WL, and hence cannot be distinguished with the same guarantee by any q q q -color MPNN using s s s trials.
Proof. Random colors beat k k k -WL. Choose connected, non-isomorphic CFI graphs C 0 C^0 C 0 , C 1 C^1 C 1 on n n n vertices, each of degree three, that are k k k -WL equivalent [4 Theorem 5.2 and Corollary 6.5] . Forget their colors; this preserves k k k -WL equivalence and non-isomorphism [5 Corollary 7.11] . Attach a path v = v 0 , v 1 , … , v t v=v_0,v_1,\ldots,v_t v = v 0 , v 1 , … , v t to each original vertex v v v , adding t = ⌈ log 2 ( 3 n 2 ) ⌉ t=\lceil\log_2(3n^2)\rceil t = ⌈ log 2 ( 3 n 2 )⌉ new vertices, and denote the resulting graphs by C ^ 0 , C ^ 1 \widehat{C}^0,\widehat{C}^1 C 0 , C 1 , of order N = n ( t + 1 ) N=n(t+1) N = n ( t + 1 ) . Each original vertex now has degree four, while the added vertices have degree one or two. Any isomorphism between the new graphs would therefore map original vertices to original vertices, giving an isomorphism between C 0 C^0 C 0 and C 1 C^1 C 1 . Thus the new graphs remain non-isomorphic.
We verify directly that attaching these paths also preserves k k k -WL equivalence. Consider a tuple ( ( u 1 ) j 1 , … , ( u k ) j k ) ((u_1)_{j_1},\ldots,(u_k)_{j_k}) (( u 1 ) j 1 , … , ( u k ) j k ) , where u i u_i u i is an original vertex and j i ∈ { 0 , … , t } j_i \in\{0,\ldots,t\} j i ∈ { 0 , … , t } is a position on its attached path. We claim that after r r r iterations its color is determined by the path positions ( j 1 , … , j k ) (j_1,\ldots,j_k) ( j 1 , … , j k ) and the color of ( u 1 , … , u k ) (u_1,\ldots,u_k) ( u 1 , … , u k ) after r r r iterations on the original graph. Initially, the original tuple color records which u i u_i u i coincide and which are adjacent. Together with the path positions, this determines equality and adjacency in the new tuple: edges either join consecutive positions on the same path or adjacent original vertices at position zero.
For the induction step, every replacement vertex has the form w ℓ w_\ell w ℓ . Consider the k k k tuples obtained by replacing each entry in turn with w ℓ w_\ell w ℓ . By induction, their list of colors is determined by the corresponding list using w w w in the original graph, together with the path positions. The next original WL color records its current color and the multiset of these lists over all w w w . Repeating this for each ℓ ∈ { 0 , … , t } \ell\in\{0,\ldots,t\} ℓ ∈ { 0 , … , t } accounts for every replacement in the new graph, proving the claim. Since the original graphs have identical tuple-color counts at every iteration, the new graphs do too, for each choice of path positions. Hence C ^ 0 \widehat{C}^0 C 0 and C ^ 1 \widehat{C}^1 C 1 remain k k k -WL equivalent.
Independent uniform binary features give the original vertices independent uniform identifiers z v = ( ξ 1 , … , ξ t ) z_v=(\xi_1,\ldots,\xi_t) z v = ( ξ 1 , … , ξ t ) , with
Pr { an identifier collision } ≤ ( n 2 ) 2 − t ≤ 1 6 . (65) \Pr\{\text{an identifier collision}\}\le\binom{n}{2}2^{-t}\le\frac{1}{6}. \tag*{(65)} Pr { an identifier collision } ≤ ( 2 n ) 2 − t ≤ 6 1 . (65)
We compute these identifiers directly with an order-normalized sum MPNN. Aggregating a constant-one channel at u u u gives deg ( u ) / N \deg(u)/N deg ( u ) / N on these graphs; multiplying by the fixed constant N N N recovers the degree. We mark the degree-one path tips and propagate this indicator to neighbors for t t t rounds, retaining previously reached vertices. The vertex v j v_j v j is first reached by this propagated indicator at round t − j t-j t − j , so the first arrival time identifies its path position. In particular, the original vertices are exactly those first reached at round t t t , so they can identify themselves. Each vertex u u u then stores a binary matrix B u ∈ { 0 , 1 } 2 t × t B_u\in\{0,1\}^{2^t\times t} B u ∈ { 0 , 1 } 2 t × t , whose ( i , j ) (i,j) ( i , j ) entry indicates that color i ∈ { 0 , 1 } i\in\{0,1\} i ∈ { 0 , 1 } has been observed at path position j j j . Initialize all matrices to zero, then at each added vertex in position j j j with color i i i , set entry ( i , j ) (i,j) ( i , j ) to one. For t − 1 t-1 t − 1 rounds, each added vertex combines its own and its neighbors’ matrices entrywise by logical OR (computed by summing and clipping at one), while original vertices keep their matrices zero. Every added vertex then learns its path’s complete matrix. One further aggregation delivers this matrix to the original vertex through its unique path neighbor. Its other neighbors are original vertices and contribute zero. The matrix thus determines z v z_v z v .
Next, original vertices exchange one-hot encodings of their identifiers, with added vertices sending zero. Each original vertex encodes its incident original edges in a matrix whose rows and columns are indexed by the 2 t 2^t 2 t possible identifiable identifiers. In the row indexed by its own identifier, it places a one in each column corresponding to a neighbor’s identifier; all other entries are zero. Added vertices contribute zero matrices. When identifiers are distinct, mean pooling followed by multiplication by N N N gives the original graph’s adjacency matrix in these identifier coordinates. Pooling the one-hot identifiers alongside the matrices also gives the number of vertices with each identifier. On the finite set of possible pooled inputs, a ReLU MLP can represent any function exactly. We choose it to accept precisely when n n n distinct identifiers occur, and the graph encoded on those identifiers is isomorphic to C 0 C^0 C 0 . A collision leaves fewer than n n n occupied identifiers and is rejected. The resulting Boolean output satisfies F ( C 0 ^ ) = 1 F(\widehat{C^0})=1 F ( C 0 ) = 1 precisely on collision-free inputs, and F ( C 1 ^ ) = 0 F(\widehat{C^1})=0 F ( C 1 ) = 0 always.
All the Boolean operations above have exact ReLU implementations. The required neighbor sums are obtained by multiplying the order-normalized sums by the fixed constant N N N .
By Lemma 1 and Lipschitzness of the fixed ReLU readout, this network has a finite size-uniform Lipschitz bound L L L . Divide its output by max { 1 , L } \max\{1,L\} max { 1 , L } to obtain a uniformly 1-Lipschitz network, without changing equality comparisons between outputs. The architecture depends on the chosen pair; this is not a single size-uniform recognition algorithm. Writing p = Pr { F ( C 0 ^ ) = 1 } ≥ 5 / 6 p=\Pr\{F(\widehat{C^0})=1\}\ge5/6 p = Pr { F ( C 0 ) = 1 } ≥ 5/6 for the unscaled output, declare the two inputs the same exactly when their independent single-trial outputs agree. The worst-case success probability is min { p 2 + ( 1 − p ) 2 , 1 , p } ≥ 13 / 18 > 2 / 3 \min\{p^2+(1-p)^2,1,p\}\ge13/18>2/3 min { p 2 + ( 1 − p ) 2 , 1 , p } ≥ 13/18 > 2/3 .
2-WL beats every fixed random-color budget. Use G 0 , m G_{0,m} G 0 , m , G 1 , m G_{1,m} G 1 , m from Section C, with m = 2 h m=2^h m = 2 h input pairs and a perfect binary parity tree. The marker is the unique degree-one vertex, so 2-WL recognizes it. Let Q m Q_m Q m be the graph obtained by deleting the marker. The pair colors reveal whether a replacement vertex is the marker, so 2-WL can recover its refinement on Q m Q_m Q m by omitting this vertex from the updates.
2-WL distinguishes the attachments by their triangle counts: in Q m Q_m Q m , each vertex of a 2 C 3 2C_3 2 C 3 attachment lies in three triangles, whereas each vertex of a C 6 C_6 C 6 attachment lies in two. This separates the input endpoints x i 0 , x i 1 x_i^0,x_i^1 x i 0 , x i 1 consistently in both graphs. Once a gadget’s inputs are distinguished, its internal vertices count their superscript-0 input neighbors, so its output endpoints see the distinct count multisets { 2 , 0 } \{2,0\} { 2 , 0 } and { 1 , 1 } \{1,1\} { 1 , 1 } . Since 2-WL refines ordinary color refinement, these distinctions propagate through successive parity gadgets up the tree, distinguishing the root endpoints r 0 , r 1 r^0,r^1 r 0 , r 1 . The marker’s attachment to r 0 r^0 r 0 or r 1 r^1 r 1 then distinguishes the two graphs.
For fixed q ≥ 2 q\ge2 q ≥ 2 and s ≥ 1 s\ge1 s ≥ 1 , choose m = 2 h m=2^h m = 2 h large enough that s < 1 3 ( 1 − q − 10 ) − m s<\frac{1}{3}(1-q^{-10})^{-m} s < 3 1 ( 1 − q − 10 ) − m . Then Corollary 23 rules out statistical ( q , s , 1 / 3 ) (q,s,1/3) ( q , s , 1/3 ) -distinguishability. For q = 1 q=1 q = 1 , every block pair is erased, so Lemmas 20 and 21 give identical 1-WL observations for every trial count. The same indistinguishability bound extends to MPNNs.
Subgraph Isomorphism for Trees
We now adapt the color-coding algorithm of Alon et al. [2 ] to a random-color MPNN. Specifically, we show that for any rooted tree T T T there exists a random-color MPNN that can decide at each vertex v v v of a given graph G G G if a copy of T T T is rooted at v v v , using a number of layers, hidden dimension size, and number of trials independent of the size of G G G . In this section, we use the MPNN architecture with coordinatewise max aggregation and binary vertex outputs.
First we show that even graph-level detection is impossible for standard MPNNs.
Proposition 28. No MPNN with identical initial vertex features can decide whether an arbitrary graph contains a simple path of length three.
Proof. The graphs C 6 C_6 C 6 and 2 C 3 2C_3 2 C 3 are both 2-regular on six vertices, so they are 1-WL indistinguishable and yield identical outputs under any such MPNN. However, C 6 C_6 C 6 contains a simple path of length three, whereas 2 C 3 2C_3 2 C 3 does not.
Let G = ( V , E , χ ) G=(V,E,\chi) G = ( V , E , χ ) be a colored graph with χ : V → [ k ] \chi:V\to[k] χ : V → [ k ] . A set of vertices U ⊆ V U\subseteq V U ⊆ V is colorful if all vertices in U U U have different colors. For a graph H H H , a colorful subgraph embedding is an injective edge-preserving map ϕ : V ( H ) → V ( G ) \phi:V(H)\to V(G) ϕ : V ( H ) → V ( G ) such that im ϕ \operatorname{im}\phi im ϕ is colorful. The embedded subgraph need not be an induced subgraph.
Let T = ( V ( T ) , E ( T ) ) T=(V(T),E(T)) T = ( V ( T ) , E ( T )) be a rooted tree. For a vertex t ∈ V ( T ) t\in V(T) t ∈ V ( T ) , let T t T_t T t denote the subtree of T T T with root t t t .
Lemma 29 (Colorful tree subgraph isomorphism). Let T T T be a rooted tree with k ≥ 1 k\ge1 k ≥ 1 vertices. There is an MPNN that can determine, for each vertex v v v of a colored graph G = ( V , E , χ ) G=(V,E,\chi) G = ( V , E , χ ) with χ : V → [ k ] \chi:V\to[k] χ : V → [ k ] , whether there is a colorful subgraph embedding of T T T mapping its root to v v v , with hidden dimension exp ( O ( k ) ) \exp(O(k)) exp ( O ( k )) and O ( k ) O(k) O ( k ) message-passing layers.
Proof. We use a dynamic program to find colorful subgraph embeddings of T T T . We first describe the dynamic program and prove its correctness. We then show that this dynamic program can be implemented on an MPNN. Let r r r be the root of T T T . The dynamic program iteratively adds edges to the graph using a post-order traversal from the root r r r ; whenever it visits a nonroot node, it adds the edge connecting that node to its parent. At iteration i ∈ { 0 , … , k − 1 } i \in\{0,\ldots,k-1\} i ∈ { 0 , … , k − 1 } , let T ( i ) T^{(i)} T ( i ) denote the spanning subgraph of T T T with all edges added so far, and let T t ( i ) T_t^{(i)} T t ( i ) denote the subtree of T ( i ) T^{(i)} T ( i ) at node t ∈ V ( T ) t \in V(T) t ∈ V ( T ) , following edges away from r r r . We use a dynamic programming table D D D with entries corresponding to V ( G ) × V ( T ) × { 0 , … , k − 1 } × P ( [ k ] ) V(G) \times V(T) \times\{0,\ldots,k-1\} \times\mathcal{P}([k]) V ( G ) × V ( T ) × { 0 , … , k − 1 } × P ([ k ]) , where P ( [ k ] ) \mathcal{P}([k]) P ([ k ]) denotes the power set of [ k ] [k] [ k ] . The dynamic programming table will store True/False corresponding to
D [ v , t , i , S ] = There is a colorful subgraph embedding ϕ from the subtree T t ( i ) to G such that ϕ ( t ) = v and χ ( im ϕ ) = S . (66) D[v,t,i,S] =
\begin{gathered}
\text{There is a colorful subgraph embedding }\phi\\
\text{from the subtree }T_t^{(i)}\text{ to }G\\
\text{such that }\phi(t)=v\text{ and }\chi(\operatorname{im}\phi)=S.
\end{gathered} \tag*{(66)} D [ v , t , i , S ] = There is a colorful subgraph embedding ϕ from the subtree T t ( i ) to G such that ϕ ( t ) = v and χ ( im ϕ ) = S . (66)
Clearly, there is a colorful embedding from T T T to G G G mapping r r r to v v v if and only if D [ v , r , k − 1 , [ k ] ] D[v,r,k-1,[k]] D [ v , r , k − 1 , [ k ]] is True.
The base case of the dynamic program consists of singleton trees. For all vertices v ∈ V ( G ) v \in V(G) v ∈ V ( G ) and nodes t ∈ V ( T ) t \in V(T) t ∈ V ( T ) , we set the entry D [ v , t , 0 , { χ ( v ) } ] = True D[v,t,0,\{\chi(v)\}]=\text{True} D [ v , t , 0 , { χ ( v )}] = True as t t t is the only node in the subtree T t ( 0 ) T_t^{(0)} T t ( 0 ) . All other entries at iteration zero are False.
Let { a , p } \{a,p\} { a , p } be the edge added at iteration i i i , where a a a is the child and p p p is the parent. We only need to update the dynamic programming table entries corresponding to p p p , since the subtrees at all other nodes remain the same.
D [ v , p , i , S ] = { True if D [ v , p , i − 1 , S ′ ] = True and D [ u , a , i − 1 , S ′ ′ ] = True for some neighbor u of v and some decomposition S = S ′ ⊎ S ′ ′ , False otherwise, (67) D[v,p,i,S] =
\begin{cases}
\text{True} & \text{if }D[v,p,i-1,S']=\text{True}\\
&\text{and }D[u,a,i-1,S'']=\text{True}\\
&\text{for some neighbor }u\text{ of }v\\
&\text{and some decomposition}\\
& S=S'\mathbin{\uplus}S'',\\
\text{False} & \text{otherwise,}
\end{cases} \tag*{(67)} D [ v , p , i , S ] = ⎩ ⎨ ⎧ True False if D [ v , p , i − 1 , S ′ ] = True and D [ u , a , i − 1 , S ′′ ] = True for some neighbor u of v and some decomposition S = S ′ ⊎ S ′′ , otherwise, (67)
where ⊎ \uplus ⊎ denotes disjoint union. For t ≠ p t \ne p t = p , set D [ v , t , i , S ] = D [ v , t , i − 1 , S ] D[v,t,i,S]=D[v,t,i-1,S] D [ v , t , i , S ] = D [ v , t , i − 1 , S ] . As a sketch of why this is correct, observe that any colorful embedding ϕ \phi ϕ of T p ( i ) T_p^{(i)} T p ( i ) with ϕ ( p ) = v \phi(p)=v ϕ ( p ) = v will have to map a a a to a neighbor u u u of v v v , so it can be decomposed as embeddings of T p ( i − 1 ) T_p^{(i-1)} T p ( i − 1 ) and T a ( i − 1 ) T_a^{(i-1)} T a ( i − 1 ) . If we can guarantee embeddings of these trees rooted at v v v and u u u exist, and their images have disjoint color sets, then this implies they can be combined to an embedding of T p ( i ) T_p^{(i)} T p ( i ) rooted at v v v (the images won’t share nodes as they have different colors). Induction over the added edges proves correctness.
We now argue that message passing can achieve this. We initialize node features as one-hot vectors in R k \mathbb{R}^k R k corresponding to node colors χ ( v ) \chi(v) χ ( v ) . Our hidden vectors between iterations will be of size k × 2 k k \times2^k k × 2 k ; after iteration i i i , the node feature h v ( i ) h_v^{(i)} h v ( i ) will correspond to the dynamic programming table entry D [ v , ⋅ , i , ⋅ ] D[v,\cdot,i,\cdot] D [ v , ⋅ , i , ⋅ ] . Accordingly, we index our node features by h v ( i ) [ t , S ] h_v^{(i)}[t,S] h v ( i ) [ t , S ] for t ∈ V ( T ) t \in V(T) t ∈ V ( T ) and S ⊆ [ k ] S \subseteq[k] S ⊆ [ k ] . Our MPNN will then have h v ( i ) [ t , S ] = 1 h_v^{(i)}[t,S]=1 h v ( i ) [ t , S ] = 1 if D [ v , t , i , S ] = True D[v,t,i,S]=\text{True} D [ v , t , i , S ] = True and h v ( i ) [ t , S ] = 0 h_v^{(i)}[t,S]=0 h v ( i ) [ t , S ] = 0 otherwise. Here i i i indexes dynamic-programming iterations, each implemented by a constant number of MPNN layers.
Initially, we apply a linear encoding layer that sets h v ( 0 ) [ t , { χ ( v ) } ] = 1 h_v^{(0)}[t,\{\chi(v)\}]=1 h v ( 0 ) [ t , { χ ( v )}] = 1 for all nodes t ∈ V ( T ) t \in V(T) t ∈ V ( T ) , with all other entries zero. Our message-passing updates will be of the form
m v ( i ) = max u ∈ N G ( v ) h u ( i − 1 ) , m_v^{(i)}=\max_{u\in N_G(v)} h_u^{(i-1)}, m v ( i ) = u ∈ N G ( v ) max h u ( i − 1 ) ,
h v ( i ) = f i ( h v ( i − 1 ) , m v ( i ) ) , (68) h_v^{(i)}=f_i\left(h_v^{(i-1)},m_v^{(i)}\right), \tag*{(68)} h v ( i ) = f i ( h v ( i − 1 ) , m v ( i ) ) , (68)
where the maximum is coordinatewise, and f i f_i f i is a ReLU MLP. At isolated vertices, set m v ( i ) = 0 m_v^{(i)}=0 m v ( i ) = 0 .
We will repeatedly make use of the fact that a two-layer ReLU MLP can implement a threshold function f ( x ) = ReLU ( x ) − ReLU ( x − 1 ) f(x)=\operatorname{ReLU}(x)-\operatorname{ReLU}(x-1) f ( x ) = ReLU ( x ) − ReLU ( x − 1 ) with the property that f ( x ) = 1 f(x)=1 f ( x ) = 1 for x ≥ 1 x\ge1 x ≥ 1 and f ( x ) = 0 f(x)=0 f ( x ) = 0 for x ≤ 0 x\le0 x ≤ 0 .
Each iteration will then correspond to adding an edge to the tree. Max aggregation gives m v ( i ) [ a , S ′ ′ ] = 1 m_v^{(i)}[a,S'']=1 m v ( i ) [ a , S ′′ ] = 1 iff D [ u , a , i − 1 , S ′ ′ ] = T r u e D[u,a,i-1,S''] = \mathrm{True} D [ u , a , i − 1 , S ′′ ] = True for some neighbor u u u of v v v . For each S ⊆ [ k ] S \subseteq[k] S ⊆ [ k ] , we compute the update
f i ( h v ( i − 1 ) , m v ( i ) ) [ p , S ] = f ( ∑ S = S ′ ∪ ˙ S ′ ′ ReLU ( h v ( i − 1 ) [ p , S ′ ] ) + m v ( i ) [ a , S ′ ′ ] − 1 ) . (69) f_i\left(h_v^{(i-1)},m_v^{(i)}\right)[p,S]
=
f\left(\sum_{S=S'\mathbin{\dot\cup}S''}\operatorname{ReLU}\left(h_v^{(i-1)}[p,S']\right)+m_v^{(i)}[a,S'']-1\right). \tag*{(69)} f i ( h v ( i − 1 ) , m v ( i ) ) [ p , S ] = f ( S = S ′ ∪ ˙ S ′′ ∑ ReLU ( h v ( i − 1 ) [ p , S ′ ] ) + m v ( i ) [ a , S ′′ ] − 1 ) . (69)
Thus, this entry is 1 iff there exists S ′ ∪ ˙ S ′ ′ = S S'\mathbin{\dot\cup}S''=S S ′ ∪ ˙ S ′′ = S such that D [ v , p , i − 1 , S ′ ] D[v,p,i-1,S'] D [ v , p , i − 1 , S ′ ] and D [ u , a , i − 1 , S ′ ′ ] D[u,a,i-1,S''] D [ u , a , i − 1 , S ′′ ] are true for some neighbor u u u of v v v . This can be implemented by a three-layer ReLU MLP with hidden dimension O ( k 4 ) O(k^4) O ( k 4 ) . The first layer takes the sum of h v ( i − 1 ) [ p , S ′ ] h_v^{(i-1)}[p,S'] h v ( i − 1 ) [ p , S ′ ] and m v ( i ) [ a , S ′ ′ ] m_v^{(i)}[a,S''] m v ( i ) [ a , S ′′ ] , subtracts 1, and applies ReLU, storing it in an intermediate feature [ p , S ′ , S ′ ′ ] [p,S',S''] [ p , S ′ , S ′′ ] . This feature is 1 iff both inputs are 1. The final two layers sum up over all choices of S ′ ∪ ˙ S ′ ′ = S S'\mathbin{\dot\cup}S''=S S ′ ∪ ˙ S ′′ = S and take a threshold. These two layers set neighbor weights to zero, and copy all entries for t ≠ p t\ne p t = p unchanged through the self-update.
After k − 1 k-1 k − 1 iterations, the vertex output h v ( k − 1 ) [ r , [ k ] ] h_v^{(k-1)}[r,[k]] h v ( k − 1 ) [ r , [ k ]] is 1 iff a colorful copy of T T T is rooted at v v v , and 0 otherwise. Including initialization, the construction uses O ( k ) O(k) O ( k ) layers and hidden dimension O ( k 4 ) = exp ( O ( k ) ) O(k^4)=\exp(O(k)) O ( k 4 ) = exp ( O ( k )) , with parameters depending only on T T T .
Theorem 30 (Random-color MPNN for rooted tree detection). Let T T T be a rooted tree with k ≥ 1 k\ge1 k ≥ 1 vertices. There is a random-color MPNN using k k k initial colors, hidden dimension exp ( O ( k ) ) \exp(O(k)) exp ( O ( k )) , and O ( k ) O(k) O ( k ) message-passing layers, using max aggregation and binary vertex outputs, with the following guarantee. For every graph G G G and vertex v ∈ V ( G ) v\in V(G) v ∈ V ( G ) , one random-color trial accepts at v v v only if G G G contains a copy of T T T rooted at v v v . If such a copy exists, then one trial accepts at v v v with probability at least
k ! k k . (70) \frac{k!}{k^k}. \tag*{(70)} k k k ! . (70) Consequently, for any α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) , running
s = ⌈ k k k ! log ( 1 / α ) ⌉ (71) s=\left\lceil\frac{k^k}{k!}\log(1/\alpha)\right\rceil \tag*{(71)} s = ⌈ k ! k k log ( 1/ α ) ⌉ (71) independent trials and accepting at v v v when its average binary output is positive (equivalently, when any trial accepts at v v v ) decides whether G G G contains a copy of T T T rooted at v v v with false-positive probability 0 and false-negative probability at most α \alpha α for each v v v .
Proof. Use the colored MPNN from Lemma 29 with color set [ k ] [k] [ k ] . In one random-color trial, each vertex of G G G receives an independent uniform color from [ k ] [k] [ k ] , and the colored MPNN checks at each v v v for a colorful copy of T T T rooted at v v v . If the trial accepts at v v v , then the detected colorful copy is in particular an uncolored copy of T T T rooted at v v v , so there are no false positives.
Fix v v v such that G G G contains a copy of T T T rooted at v v v , and fix one such copy. The k k k vertices of this copy receive distinct colors with probability k ! / k k k!/k^k k ! / k k . On this event, the fixed copy is colorful, so the colored MPNN accepts at v v v . Thus one trial accepts at v v v with probability at least k ! / k k k!/k^k k ! / k k . For s s s independent trials, the false-negative probability at v v v is at most
( 1 − k ! k k ) s ≤ exp ( − s k ! k k ) ≤ α . (72) \left(1-\frac{k!}{k^k}\right)^s\le\exp\left(-s\frac{k!}{k^k}\right)\le\alpha. \tag*{(72)} ( 1 − k k k ! ) s ≤ exp ( − s k k k ! ) ≤ α . (72)
Participation in any role follows by running all choices of the pattern root in parallel and taking the maximum at each vertex, with the same asymptotic resource bounds.
Corollary 31 (Tree subgraph detection). For every tree T T T and α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) , max-over-nodes readout in Theorem 30 detects whether a graph contains a subgraph isomorphic to T T T , with the same resource and trial bounds, no false positives, and false-negative probability at most α \alpha α .
Proof. Root T T T arbitrarily and take the maximum over vertex outputs in each trial. A positive graph contains a fixed copy rooted at some vertex, whose miss probability is at most α \alpha α ; a negative graph has no positive vertex outputs. For the empty graph, set the readout to zero.
Corollary 32 (Detecting simple paths). For every k ≥ 1 k \ge1 k ≥ 1 , there is a random-color MPNN that detects whether a graph contains a simple path of length k k k , meaning a path with k k k edges and k + 1 k+1 k + 1 vertices, using k + 1 k+1 k + 1 initial colors, hidden dimension exp ( O ( k ) ) \exp(O(k)) exp ( O ( k )) , and O ( k ) O(k) O ( k ) message-passing layers. One trial has no false positives and accepts with probability at least
( k + 1 ) ! ( k + 1 ) k + 1 (73) \frac{(k+1)!}{(k+1)^{k+1}} \tag*{(73)} ( k + 1 ) k + 1 ( k + 1 )! (73) whenever such a path exists. Hence, for any α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) ,
s = ⌈ ( k + 1 ) k + 1 ( k + 1 ) ! log ( 1 / α ) ⌉ (74) s=\left\lceil\frac{(k+1)^{k+1}}{(k+1)!}\log(1/\alpha)\right\rceil \tag*{(74)} s = ⌈ ( k + 1 )! ( k + 1 ) k + 1 log ( 1/ α ) ⌉ (74) independent trials give false-positive probability 0 0 0 and false-negative probability at most α \alpha α .
Proof. Apply Corollary 31 to the path tree on k + 1 k+1 k + 1 vertices.
A Local MST Edge Task
We next consider a local task for computing MST edges. Let G = ( V , E ) G=(V,E) G = ( V , E ) be a simple graph with edge weights w : E → Λ w:E\to\Lambda w : E → Λ , where Λ \Lambda Λ is a fixed finite ordered alphabet. We aim to identify edges that uniquely minimize the weight across a cut S ⊂ V S\subset V S ⊂ V with ∣ S ∣ < k |S|<k ∣ S ∣ < k . For k ≥ ∣ V ∣ k\ge|V| k ≥ ∣ V ∣ , this is exactly the set of edges occurring in every MST (or every minimum spanning forest if G G G is disconnected).
An edge belongs to every MST if and only if it is the unique minimum-weight edge crossing some cut. The cut, however, may have many vertices on both sides. We therefore consider a local version of this task, identifying only edges whose membership in every MST can be established by a cut with fewer than k k k vertices on one side.
Fix an integer k ≥ 2 k\ge2 k ≥ 2 , and let δ G ( S ) \delta_G(S) δ G ( S ) denote the edges with exactly one endpoint in S S S . This constrained edge set is
A k ( G , w ) : = { e ∈ E : ∃ S ⊂ V , ∣ S ∣ < k , e ∈ δ G ( S ) , w ( e ) < w ( f ) for all f ∈ δ G ( S ) ∖ { e } } (75) A_k(G,w):=\left\{e\in E:
\begin{aligned}
&\exists S\subset V,\ |S|<k,\ e\in\delta_G(S),\\
&w(e)<w(f)\text{ for all }f\in\delta_G(S)\setminus\{e\}
\end{aligned}
\right\} \tag*{(75)} A k ( G , w ) := { e ∈ E : ∃ S ⊂ V , ∣ S ∣ < k , e ∈ δ G ( S ) , w ( e ) < w ( f ) for all f ∈ δ G ( S ) ∖ { e } } (75)
To identify edges in A k A_k A k , we look for a small component separated from the opposite endpoint after removing the candidate edge and all heavier edges. For e = u v e=uv e = uv , define
D e : = ( V , { f ∈ E ∖ { e } : w ( f ) ≤ w ( e ) } ) , (76) D_e:=\left(V,\{f\in E\setminus\{e\}:w(f)\le w(e)\}\right), \tag*{(76)} D e := ( V , { f ∈ E ∖ { e } : w ( f ) ≤ w ( e )} ) , (76)
and let C e ( v ) C_e(v) C e ( v ) denote the connected component of v v v in D e D_e D e . If the endpoints are separated, e e e is uniquely lightest across the boundary of either component. A component with fewer than k k k vertices therefore gives the required cut. Conversely, any qualifying set S S S contains the component of its endpoint. Hence,
e ∈ A k ( G , w ) ⟺ C e ( u ) ≠ C e ( v ) and min { ∣ C e ( u ) ∣ , ∣ C e ( v ) ∣ } < k . (77) e\in A_k(G,w)\Longleftrightarrow C_e(u)\ne C_e(v)\text{ and }\min\{|C_e(u)|,|C_e(v)|\}<k. \tag*{(77)} e ∈ A k ( G , w ) ⟺ C e ( u ) = C e ( v ) and min { ∣ C e ( u ) ∣ , ∣ C e ( v ) ∣ } < k . (77)
We use the edge-feature extension of message passing: messages may depend on the sender’s state and a fixed encoding of the edge weight. Coordinatewise max aggregation and updates implement the filters below using the initial colors, which are retained in the node states. The edge decoder is a shared ReLU MLP of the form d ( h u + h v , w ( u v ) ) d(h_u+h_v,w(uv)) d ( h u + h v , w ( uv )) , where h u , h v h_u,h_v h u , h v are the final endpoint embeddings. An empty maximum is taken to be zero.
The next proposition shows that random colors allow a random color MPNN to compute this task for constant k k k .
Proposition 33 (Finite-color local Kruskal edge detection). Fix an integer k ≥ 2 k\ge2 k ≥ 2 , a finite ordered alphabet Λ \Lambda Λ , and ε , α ∈ ( 0 , 1 ) \varepsilon,\alpha\in(0,1) ε , α ∈ ( 0 , 1 ) . There is a finite-color edge-output MPNN, using a constant number of independent random-color trials, such that for every weighted graph G G G with weights in Λ \Lambda Λ , the random output A ^ ⊆ E ( G ) \widehat A\subseteq E(G) A ⊆ E ( G ) satisfies
Pr { ∣ A ^ ∩ A k ∣ ≥ ( 1 − ε ) ∣ A k ∣ and ∣ A ^ ∖ A k ∣ ≤ ε ∣ E ∖ A k ∣ } ≥ 1 − α . (78) \Pr\left\{
\begin{aligned}
&|\widehat A\cap A_k|\ge(1-\varepsilon)|A_k|\\
&\text{and}\\
&|\widehat A\setminus A_k|\le\varepsilon|E\setminus A_k|
\end{aligned}
\right\}\ge1-\alpha. \tag*{(78)} Pr ⎩ ⎨ ⎧ ∣ A ∩ A k ∣ ≥ ( 1 − ε ) ∣ A k ∣ and ∣ A ∖ A k ∣ ≤ ε ∣ E ∖ A k ∣ ⎭ ⎬ ⎫ ≥ 1 − α . (78) The number of colors, number of trials, and depth depend only on k , ε , α k,\varepsilon,\alpha k , ε , α , and Λ \Lambda Λ , not on ∣ V ( G ) ∣ |V(G)| ∣ V ( G ) ∣ .
Proof. Fix q ≥ 2 k q \ge2k q ≥ 2 k . In one random trial, assign each vertex an independent uniform color
χ ( v ) ∈ [ q ] : = { 1 , … , q } . (79) \chi(v) \in[q] := \{1,\ldots,q\}. \tag*{(79)} χ ( v ) ∈ [ q ] := { 1 , … , q } . (79)
For each λ ∈ Λ \lambda\in\Lambda λ ∈ Λ and $1 \le a \le b \le q$, write
D λ , a , b : = ( V , { x y ∈ E : w ( x y ) < λ or w ( x y ) = λ , { χ ( x ) , χ ( y ) } ≠ { a , b } } ) . (80) D_{\lambda,a,b} := \left(V,\left\{xy \in E: \begin{array}{l} w(xy) < \lambda\ \text{or}\\ w(xy) = \lambda,\ \{\chi(x),\chi(y)\} \ne\{a,b\}\end{array}\right\}\right). \tag*{(80)} D λ , a , b := ( V , { x y ∈ E : w ( x y ) < λ or w ( x y ) = λ , { χ ( x ) , χ ( y )} = { a , b } } ) . (80)
Thus, D λ , a , b D_{\lambda,a,b} D λ , a , b retains edges of weight at most λ \lambda λ , except weight-λ \lambda λ edges with endpoint colors { a , b } \{a,b\} { a , b } . An edge e = u v e=uv e = uv selects the channel λ = w ( e ) \lambda=w(e) λ = w ( e ) and { a , b } = { χ ( u ) , χ ( v ) } \{a,b\}=\{\chi(u),\chi(v)\} { a , b } = { χ ( u ) , χ ( v )} . This channel deletes e e e , but may also delete other edges with the same weight and endpoint colors.
Run k − 1 k-1 k − 1 message-passing rounds in each channel, maintaining the finite state
S t λ , a , b ( v ) ⊆ [ q ] , (81) S_t^{\lambda,a,b}(v) \subseteq[q], \tag*{(81)} S t λ , a , b ( v ) ⊆ [ q ] , (81)
the set of colors seen within distance at most t t t from v v v in D λ , a , b D_{\lambda,a,b} D λ , a , b . Initialize
S 0 λ , a , b ( v ) = { χ ( v ) } , (82) S_0^{\lambda,a,b}(v)=\{\chi(v)\}, \tag*{(82)} S 0 λ , a , b ( v ) = { χ ( v )} , (82)
and update by
S t + 1 λ , a , b ( v ) = S t λ , a , b ( v ) ∪ ⋃ x ∈ N D λ , a , b ( v ) S t λ , a , b ( x ) . (83) S_{t+1}^{\lambda,a,b}(v)=S_t^{\lambda,a,b}(v)\cup\bigcup_{x\in N_{D_{\lambda,a,b}}(v)}S_t^{\lambda,a,b}(x). \tag*{(83)} S t + 1 λ , a , b ( v ) = S t λ , a , b ( v ) ∪ x ∈ N D λ , a , b ( v ) ⋃ S t λ , a , b ( x ) . (83)
We encode each color subset by its indicator vector. The union update is then a coordinatewise OR, which we implement using max aggregation and fixed ReLU updates. All channels are stored in the same node state. To implement the filter, group incoming messages by the sender’s initial color and the edge weight, take coordinatewise maxima within each group, and select the groups allowed by the receiver’s initial color and the channel. These selections are finite Boolean operations and can be implemented by fixed ReLU updates. The number of channels depends only on q q q and Λ \Lambda Λ , not on ∣ V ( G ) ∣ |V(G)| ∣ V ( G ) ∣ .
After k − 1 k-1 k − 1 rounds, set
Σ λ , a , b ( v ) : = S k − 1 λ , a , b ( v ) , \Sigma_{\lambda,a,b}(v):=S_{k-1}^{\lambda,a,b}(v), Σ λ , a , b ( v ) := S k − 1 λ , a , b ( v ) ,
M λ , a , b ( v ) : = 1 { ∣ Σ λ , a , b ( v ) ∣ < k } . (84) M_{\lambda,a,b}(v):=\mathbf{1}\{|\Sigma_{\lambda,a,b}(v)|<k\}. \tag*{(84)} M λ , a , b ( v ) := 1 { ∣ Σ λ , a , b ( v ) ∣ < k } . (84)
For an edge e = u v e=uv e = uv , the desired decision rule uses its selected channel and accepts in one trial if
( M λ , a , b ( u ) ∨ M λ , a , b ( v ) ) and Σ λ , a , b ( u ) ≠ Σ λ , a , b ( v ) . (85) \left(M_{\lambda,a,b}(u)\lor M_{\lambda,a,b}(v)\right)\quad\text{and}\quad\Sigma_{\lambda,a,b}(u)\ne\Sigma_{\lambda,a,b}(v). \tag*{(85)} ( M λ , a , b ( u ) ∨ M λ , a , b ( v ) ) and Σ λ , a , b ( u ) = Σ λ , a , b ( v ) . (85)
To implement this rule from the sum of endpoint embeddings, retain the initial one-hot color and all Σ \Sigma Σ indicators and M M M bits in each final node state. The summed color coordinates determine the unordered endpoint colors, including the case of equal colors, and hence select the channel together with w ( e ) w(e) w ( e ) . The summed M M M coordinate is positive exactly when at least one endpoint has M = 1 M=1 M = 1 . The two Σ \Sigma Σ sets differ exactly when some summed indicator coordinate equals one. On inputs in { 0 , 1 , 2 } \{0,1,2\} { 0 , 1 , 2 } , the ReLU function
r ( x ) = ReLU ( x ) − 2 ReLU ( x − 1 ) + ReLU ( x − 2 ) r(x)=\operatorname{ReLU}(x)-2\operatorname{ReLU}(x-1)+\operatorname{ReLU}(x-2) r ( x ) = ReLU ( x ) − 2 ReLU ( x − 1 ) + ReLU ( x − 2 )
is the indicator of this event. Taking the Boolean OR over these coordinates and the conjunction with the M M M condition gives the decision rule. Channel selection and these Boolean operations are exactly implementable by a fixed ReLU MLP applied to h u + h v h_u+h_v h u + h v and the encoded edge weight. Its width and depth depend only on q q q , k k k , Λ \Lambda Λ . The final network accepts an edge when the average of its s s s independent binary trial outputs is positive, equivalently when any trial accepts it.
Fix an edge e = u v e=uv e = uv . For each endpoint x ∈ { u , v } x\in\{u,v\} x ∈ { u , v } , choose W x = C e ( x ) W_x=C_e(x) W x = C e ( x ) if ∣ C e ( x ) ∣ < k |C_e(x)|<k ∣ C e ( x ) ∣ < k ; otherwise, choose a connected k k k -vertex set W x ⊆ C e ( x ) W_x\subseteq C_e(x) W x ⊆ C e ( x ) containing x x x . Set W = W u ∪ W v W=W_u\cup W_v W = W u ∪ W v , so ∣ W ∣ ≤ 2 k |W|\le2k ∣ W ∣ ≤ 2 k . These sets depend on G , w , e G,w,e G , w , e , not on the random colors.
Suppose that the colors on W W W are all distinct. The selected channel is a subgraph of D e D_e D e , and it retains every edge of D e D_e D e with both endpoints in W W W : the only vertices of W W W with colors χ ( u ) \chi(u) χ ( u ) and χ ( v ) \chi(v) χ ( v ) are u u u and v v v , and e e e is already absent from D e D_e D e . Here we use that G G G is simple. If ∣ C e ( x ) ∣ < k |C_e(x)| < k ∣ C e ( x ) ∣ < k , the channel therefore preserves the whole component, so Σ λ , a , b ( x ) \Sigma_{\lambda,a,b}(x) Σ λ , a , b ( x ) is its color set and M λ , a , b ( x ) = 1 M_{\lambda,a,b}(x) = 1 M λ , a , b ( x ) = 1 . If ∣ C e ( x ) ∣ ≥ k |C_e(x)| \ge k ∣ C e ( x ) ∣ ≥ k , the connected set W x W_x W x lies within distance at most k − 1 k-1 k − 1 from x x x in the channel, so at least k k k distinct colors are seen and M λ , a , b ( x ) = 0 M_{\lambda,a,b}(x) = 0 M λ , a , b ( x ) = 0 .
Consequently, if both endpoint components are large, the decoder rejects. If they are the same small component, their color sets agree, and the decoder again rejects. If they are different and at least one is small, their color sets differ: two small components have disjoint color sets, while a large component contributes at least k k k colors. Thus the decoder is correct whenever the colors on W W W are distinct. This event has probability at least
p ∗ ( q ) : = ( q ) 2 k q 2 k , (86) p_*(q) := \frac{(q)_{2k}}{q^{2k}}, \tag*{(86)} p ∗ ( q ) := q 2 k ( q ) 2 k , (86)
where ( q ) j : = q ( q − 1 ) ⋯ ( q − j + 1 ) (q)_j := q(q-1)\cdots(q-j+1) ( q ) j := q ( q − 1 ) ⋯ ( q − j + 1 ) denotes the falling factorial. Therefore, after s s s independent trials, each target edge is missed with probability at most ( 1 − p ∗ ( q ) ) s (1-p_*(q))^s ( 1 − p ∗ ( q ) ) s , and each non-target edge is falsely accepted with probability at most s ( 1 − p ∗ ( q ) ) s(1-p_*(q)) s ( 1 − p ∗ ( q )) .
Set η : = α ε / 2 \eta:= \alpha\varepsilon/2 η := α ε /2 . Choose q q q large enough that p ∗ ( q ) ≥ 1 / 2 p_*(q) \ge1/2 p ∗ ( q ) ≥ 1/2 , then choose s s s so that ( 1 − p ∗ ( q ) ) s ≤ η (1-p_*(q))^s \le\eta ( 1 − p ∗ ( q ) ) s ≤ η , and finally increase q q q , if necessary, so that
s ( 1 − p ∗ ( q ) ) ≤ η . (87) s(1-p_*(q)) \le\eta. \tag*{(87)} s ( 1 − p ∗ ( q )) ≤ η . (87)
Then each target edge is missed with probability at most η \eta η , and each non-target edge is falsely accepted with probability at most η \eta η . Markov’s inequality applied to the two error counts yields failure probability at most α \alpha α . If either edge class is empty, its error count is identically zero.
Theorem 34 (Deterministic obstruction for the local Kruskal task). Let Λ = { 0 , 1 } \Lambda= \{0,1\} Λ = { 0 , 1 } and let k > 5 k > 5 k > 5 . There is a connected weighted graph ( H , w ) (H,w) ( H , w ) on ten vertices, with weights in Λ \Lambda Λ , such that no deterministic uncolored MPNN with identical initial vertex features and an edge-weight-aware symmetric edge decoder computes A k ( H , w ) A_k(H,w) A k ( H , w ) .
Proof. Take two disjoint copies of K 4 K_4 K 4 , subdivide one edge in each copy, and join the two new subdivision vertices by an edge e ∗ e_* e ∗ (Figure 6 ). Give every edge weight 1.
Figure 6. Counterexample in Theorem 34. Every vertex has degree three and every edge has weight 1. The highlighted edge e ∗ e_* e ∗ is the only bridge; deleting it leaves two five-vertex components. Thus A k ( H , w ) = { e ∗ } A_k(H,w)=\{e_*\} A k ( H , w ) = { e ∗ } for k > 5 k>5 k > 5 .
Every vertex of H H H has degree three. Since the initial vertex features are identical and every edge has the same weight, induction on the message-passing layers shows that all vertex states remain identical. Thus, any symmetric edge decoder receives the same endpoint states and edge weight for every edge.
However, e ∗ e_* e ∗ is a bridge whose removal leaves two components of size 5 < k 5 < k 5 < k , so e ∗ ∈ A k ( H , w ) e_* \in A_k(H,w) e ∗ ∈ A k ( H , w ) . Every other edge lies on a cycle of weight-1 edges, so none uniquely minimizes any cut. Consequently, no deterministic uncolored MPNN with an edge-weight-aware symmetric decoder computes A k A_k A k on this graph.
Expressivity Hierarchies for Colors and Trials
Corollary 25 shows that colors and trials can have very different quantitative effects. We now show that increasing either resource strictly increases expressivity, i.e., the ability to distinguish non-isomorphic graphs with high probability. To do that, we use statistical ( q , s , α ) (q,s,\alpha) ( q , s , α ) -distinguishability by random-color WL as defined in Definition 6, i.e., a test receives s s s independent trials per graph with q q q uniform colors and has failure probability at most α \alpha α for each of the four input pairs.
Specifically, we show the two hierarchy results regarding the number of colors and trials, respectively:
Theorem 35 (Strict hierarchy in the number of trials). For every integer s ≥ 2 s \ge2 s ≥ 2 , there are non-isomorphic finite graphs G s , H s G_s,H_s G s , H s that are ( 2 , s , 1 / 3 ) (2,s,1/3) ( 2 , s , 1/3 ) -distinguishable by random-color WL, but are not statistically ( 2 , s − 1 , 1 / 3 ) (2,s-1,1/3) ( 2 , s − 1 , 1/3 ) -distinguishable.
Ignoring the last trial gives the corresponding non-strict inclusion. The theorem shows that two colors suffice, which is optimal. For colors, we compare budgets of at most q q q colors, i.e., the test may choose a uniform palette of size r ≤ q r \le q r ≤ q , fixed across all its trials.
Theorem 36 (Strict hierarchy in the number of colors). *For every pair of integers q , s ≥ 1 q,s \ge1 q , s ≥ 1 , there are non-isomorphic finite graphs G q , s , H q , s G_{q,s}, H_{q,s} G q , s , H q , s that are statistically ( q + 1 , s , 1 / 3 ) (q+1,s,1/3) ( q + 1 , s , 1/3 ) -distinguishable by random-color WL, but are not statistically ( r , s , 1 / 3 ) (r,s,1/3) ( r , s , 1/3 ) -distinguishable for any 1 ≤ r ≤ q 1 \le r \le q 1 ≤ r ≤ q .
Hence, for every fixed number of trials, increasing the allowed palette size strictly enlarges the set of distinguishable graph pairs. We prove both theorems using one graph class. In each trial, the observation either conceals the graph identity or determines it exactly. We then carefully choose the construction parameters so that the optimal failure probability crosses 1 / 3 1/3 1/3 when one trial or one color is added.
Construction of the graph class
Let ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 be prime, and create the following disjoint union of cycles
A ℓ : = C ℓ , B ℓ : = C 3 ⊔ C ℓ − 3 . (88) A_{\ell} := C_{\ell}, \qquad B_{\ell} := C_{3} \sqcup C_{\ell-3}. \tag*{(88)} A ℓ := C ℓ , B ℓ := C 3 ⊔ C ℓ − 3 . (88)
Both graphs are 2-regular on ℓ \ell ℓ vertices. The following results show that 1-WL distinguishes them unless both graphs are monochromatic.
Lemma 37. Two colored copies of A ℓ A_{\ell} A ℓ and B ℓ B_{\ell} B ℓ are indistinguishable by 1-WL if and only if both are monochromatic in the same color. If a root is added to each graph and joined to every block vertex, the resulting colored graphs are indistinguishable if and only if the blocks are monochromatic in the same color and the two roots have the same initial color.
Proof. Suppose that the colored blocks are indistinguishable, and run color refinement on their disjoint union. For each stable color c c c , let a c a_c a c be its multiplicity in A ℓ A_{\ell} A ℓ and let b c b_c b c be its multiplicity in the triangular component of B ℓ B_{\ell} B ℓ . Every stable color occurring in either graph occurs in both. Let m c d m_{cd} m c d be the number of neighbors of color d d d of a vertex of color c c c .
The quotient on stable colors is connected because A ℓ A_{\ell} A ℓ is connected. A color occurring in the triangle brings all its neighboring colors into the triangle, so b c > 0 b_c > 0 b c > 0 for every stable color c c c . For distinct adjacent colors, counting edges gives
a c m c d = a d m d c , a_c m_{cd} = a_d m_{dc}, a c m c d = a d m d c ,
b c m c d = b d m d c . (89) b_c m_{cd} = b_d m_{dc}. \tag*{(89)} b c m c d = b d m d c . (89)
Hence, the fraction b c / a c b_c/a_c b c / a c is constant on the connected quotient. Summing the multiplicities gives b c = 3 a c / ℓ b_c = 3a_c/\ell b c = 3 a c / ℓ . Since ℓ \ell ℓ is prime and ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 , every positive a c a_c a c is divisible by ℓ \ell ℓ . As ∑ c a c = ℓ \sum_c a_c = \ell ∑ c a c = ℓ , there is only one stable color. Both blocks are therefore monochromatic in the same initial color. Conversely, equally colored monochromatic 2-regular graphs of the same order have identical WL colors.
In the rooted graphs, the roots have degree ℓ \ell ℓ and the block vertices have degree three. Under indistinguishability, the two roots therefore have the same stable color. Removing their common contribution from the block vertices’ neighbor multisets leaves the same argument. The converse follows by a standard induction over the refinement rounds. □
We next use these blocks to distinguish the endpoints of a parity gadget. Fix k ≥ 3 k \ge3 k ≥ 3 input pairs X i = ( x i 0 , x i 1 ) X_i = (x_i^0,x_i^1) X i = ( x i 0 , x i 1 ) , i ∈ [ k ] i \in[k] i ∈ [ k ] , and a root pair R = ( r 0 , r 1 ) R = (r^0,r^1) R = ( r 0 , r 1 ) . Add an edge within every pair. For each input i i i , attach A ℓ A_{\ell} A ℓ to x i 0 x_i^0 x i 0 and B ℓ B_{\ell} B ℓ to x i 1 x_i^1 x i 1 , joining each endpoint to every vertex of its block. For a ∈ { 0 , 1 } k a \in\{0,1\}^k a ∈ { 0 , 1 } k , write
par ( a ) : = a 1 ⊕ ⋯ ⊕ a k . \operatorname{par}(a) := a_1 \oplus\cdots\oplus a_k. par ( a ) := a 1 ⊕ ⋯ ⊕ a k .
Create one internal vertex g a g_a g a for each such vector, with neighborhood
N ( g a ) = { x 1 a 1 , … , x k a k , r par ( a ) } . N(g_a) = \{x_1^{a_1},\ldots,x_k^{a_k},r^{\operatorname{par}(a)}\}. N ( g a ) = { x 1 a 1 , … , x k a k , r par ( a ) } .
Finally, define H b , ℓ , k H_{b,\ell,k} H b , ℓ , k , for b ∈ { 0 , 1 } b \in\{0,1\} b ∈ { 0 , 1 } , by attaching one marker leaf to r b r^b r b . Note that each graph has 2 k ℓ + 2 k + 2 k + 3 2k\ell+ 2k + 2^k + 3 2 k ℓ + 2 k + 2 k + 3 vertices. For fixed ℓ , k \ell,k ℓ , k , set H b : = H b , ℓ , k H_b := H_{b,\ell,k} H b := H b , ℓ , k .
The following results show that 1-WL can recover the structural role of H b H_b H b .
Lemma 38 (Structural roles). The complete WL observation of H b H_b H b identifies the input endpoints, block vertices, internal vertices, root endpoints, and marker leaf. For every t ≥ 0 t \ge0 t ≥ 0 , an input endpoint’s structure after t + 2 t+2 t + 2 rounds determines the t t t -round WL observation of its attached block in isolation. The endpoint also identifies its pair partner through their pair edge. These statements hold for every initial coloring.
Proof. We first look at the vertex degrees of the different structural roles in the graph H b H_b H b :
Table 6.
The degrees are distinct for k ≥ 3 k \ge3 k ≥ 3 and ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 , so one 1-WL round can identify such structures. Each input endpoint has exactly one input-endpoint neighbor (i.e., the partner), and, by construction, its block neighbors are precisely its neighbors of degree 3 3 3 .
For a colored graph ( H b , χ ) (H_b,\chi) ( H b , χ ) , abbreviate its full structures by π t ( v ) = π t H b , χ ( v ) \pi_t(v)=\pi_t^{H_b,\chi}(v) π t ( v ) = π t H b , χ ( v ) . Let β t ( v ) \beta_t(v) β t ( v ) be the structure obtained by running 1-WL inside the block containing the vertex v v v . We prove by induction that π t + 1 ( v ) \pi_{t+1}(v) π t + 1 ( v ) determines β t ( v ) \beta_t(v) β t ( v ) for every block vertex v v v . The base case holds because β 0 ( v ) = χ ( v ) \beta_0(v)=\chi(v) β 0 ( v ) = χ ( v ) . The structure π t + 2 ( v ) \pi_{t+2}(v) π t + 2 ( v ) records its own π t + 1 \pi_{t+1} π t + 1 structure and those of its neighbors. Because t + 1 ≥ 1 t+1 \ge1 t + 1 ≥ 1 , each neighbor pattern determines the neighbor’s degree. Retaining exactly the neighbors of degree 3 and applying the induction hypothesis implies
β t + 1 ( v ) = ( β t ( v ) , { { β t ( u ) : u ∈ N ( v ) , deg ( u ) = 3 } } ) . \beta_{t+1}(v)=\left(\beta_t(v),\{\{\beta_t(u):u\in N(v),\ \operatorname{deg}(u)=3\}\}\right). β t + 1 ( v ) = ( β t ( v ) , {{ β t ( u ) : u ∈ N ( v ) , deg ( u ) = 3 }} ) .
These are exactly the neighbors inside the block. An input endpoint’s π t + 2 \pi_{t+2} π t + 2 pattern then gives the multiset of β t \beta_t β t structures over every vertex of its attached block.
We now show that swapping the endpoints propagates through the gadget.
Lemma 39 (Parity extension). Consider the parity gadget before adding the blocks and marker. Swapping the endpoints of X i X_i X i when s i = 1 s_i=1 s i = 1 and of R R R when s R = 1 s_R=1 s R = 1 extends to an automorphism of the gadget if and only if
s R = s 1 ⊕ ⋯ ⊕ s k . s_R=s_1\oplus\cdots\oplus s_k. s R = s 1 ⊕ ⋯ ⊕ s k .
Proof. Let s = ( s 1 , … , s k ) s=(s_1,\ldots,s_k) s = ( s 1 , … , s k ) ; the input neighbors force g a g_a g a to map to g a ⊕ s g_{a\oplus s} g a ⊕ s . Its root edge is preserved exactly when
par ( a ) ⊕ s R = par ( a ⊕ s ) = par ( a ) ⊕ par ( s ) . \operatorname{par}(a)\oplus s_R=\operatorname{par}(a\oplus s)
=\operatorname{par}(a)\oplus\operatorname{par}(s). par ( a ) ⊕ s R = par ( a ⊕ s ) = par ( a ) ⊕ par ( s ) .
This is equivalent to the stated condition. When it holds, the map preserves every edge. Permuting input pairs also preserves the gadget and does not change this condition.
In addition, we can show that the graphs H 0 , ℓ , k H_{0,\ell,k} H 0 , ℓ , k and H 1 , ℓ , k H_{1,\ell,k} H 1 , ℓ , k are non-isomorphic.
Lemma 40 (Non-isomorphism). For every prime ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 and k ≥ 3 k \ge3 k ≥ 3 , the graphs H 0 , ℓ , k H_{0,\ell,k} H 0 , ℓ , k and H 1 , ℓ , k H_{1,\ell,k} H 1 , ℓ , k are not isomorphic.
Proof. An isomorphism must preserve the roles in Lemma 38 and map the marked root r 0 r^0 r 0 in H 0 H_0 H 0 to r 1 r^1 r 1 in H 1 H_1 H 1 . Moreover, an isomorphism also maps input-pair edges to input-pair edges and preserves the subgraph induced by each endpoint’s degree-three neighbors. Since A ℓ A_\ell A ℓ is connected and B ℓ B_\ell B ℓ is disconnected, it cannot exchange the two endpoint types. It may therefore permute input pairs but cannot swap their endpoints. By Lemma 39, it cannot swap the root endpoints either, leading to a contradiction.
Erasure and the trial law
In one trial, assign every vertex an independent uniform color from [ q ] [q] [ q ] . Hence, a block is monochromatic with probability q 1 − ℓ q^{1-\ell} q 1 − ℓ . For input i i i , let E i E_i E i be the event that both attached blocks are monochromatic while their colors need not agree. By the above, these events are independent and have probability
p ℓ , q : = Pr ( E i ) = q 2 − 2 ℓ . (90) p_{\ell,q} := \Pr(E_i) = q^{2-2\ell}. \tag*{(90)} p ℓ , q := Pr ( E i ) = q 2 − 2 ℓ . (90)
Let
E : = ⋃ i = 1 k E i , D : = E c , (91) E := \bigcup_{i=1}^{k} E_i,\qquad D := E^c, \tag*{(91)} E := i = 1 ⋃ k E i , D := E c , (91)
and
η ℓ , k , q : = Pr ( D ) = ( 1 − p ℓ , q ) k . (92) \eta_{\ell,k,q} := \Pr(D) = (1-p_{\ell,q})^k. \tag*{(92)} η ℓ , k , q := Pr ( D ) = ( 1 − p ℓ , q ) k . (92)
We call input i i i erased when E i E_i E i occurs. For fixed ℓ , k , q \ell,k,q ℓ , k , q , write P b = P H b W L , q P_b=P^{\mathrm{WL},q}_{H_b} P b = P H b WL , q for the probability law of Z W L , q ( H b ) Z_{\mathrm{WL},q}(H_b) Z WL , q ( H b ) .
Lemma 41. For q ≥ 2 q\ge2 q ≥ 2 , the conditional WL observation laws on E E E agree, whereas the conditional laws on D D D have disjoint supports. Moreover, the observation also determines whether E E E or D D D occurred. Consequently, there are mutually singular probability laws Q , Q 0 , Q 1 Q,Q_0,Q_1 Q , Q 0 , Q 1 such that, for b ∈ { 0 , 1 } b\in\{0,1\} b ∈ { 0 , 1 } ,
P b = ( 1 − η ℓ , k , q ) Q + η ℓ , k , q Q b . (93) P_b=(1-\eta_{\ell,k,q})Q+\eta_{\ell,k,q}Q_b. \tag*{(93)} P b = ( 1 − η ℓ , k , q ) Q + η ℓ , k , q Q b . (93) For q = 1 q=1 q = 1 , the two trial laws agree and η ℓ , k , 1 = 0 \eta_{\ell,k,1}=0 η ℓ , k , 1 = 0 .
Proof. We first show that one erased input hides the graph identity. Fix a coloring of H 0 H_0 H 0 in E E E , and choose the least erased index i i i . On the same vertex sets, we replace the block A ℓ A_\ell A ℓ at x i 0 x_i^0 x i 0 by B ℓ B_\ell B ℓ and the block B ℓ B_\ell B ℓ at x i 1 x_i^1 x i 1 by A ℓ A_\ell A ℓ . Therefore, each replaced block is monochromatic, has ℓ \ell ℓ vertices, and is 2-regular internally. At every refinement round, all vertices of such a block have the same structure, determined by two copies of its preceding structure and the structure of its endpoint. A straightforward structural induction therefore shows that these replacements preserve the full WL observation.
The resulting graph is isomorphic to H 1 H_1 H 1 , i.e., swap the endpoints of X i X_i X i and R R R , send g a g_a g a to g a ⊕ e i g_{a\oplus e_i} g a ⊕ e i , exchange the two blocks at input i i i , and fix all other inputs and blocks. Here e i e_i e i is the vector with its only nonzero coordinate at i i i . We now map every vertex color along this isomorphism, including the colors on the internal vertices, endpoints, and marker. We then choose the block bijections in inverse pairs. This defines an involution between the two copies of E E E , i.e., it preserves every event E j E_j E j and hence the least erased index. Also, all colorings have the same probability, so the map preserves the conditional uniform law on E E E . The coupled observations agree. The least erased index is used only to define this map on labeled colorings, i.e., the observer need not recover it.
Next, because the degree-three neighbor patterns retain their initial colors, two WL rounds determine whether an endpoint’s own block is monochromatic. In the first round, the same information about its unique input-endpoint neighbor. Thus the complete observation determines the existence of an erased input and hence the event E E E .
It remains to recover the graph identity on D D D . The color partition on the disjoint union of two colored ℓ \ell ℓ -vertex blocks stabilizes within 2 ℓ 2\ell 2 ℓ rounds. By Lemma 37, the 2 ℓ 2\ell 2 ℓ -round observation therefore identifies the type of any nonmonochromatic block. By Lemma 38, an endpoint’s full structure after 2 ℓ + 2 2\ell+2 2 ℓ + 2 rounds determines this observation. On D D D , every input has at least one nonmonochromatic block. Its type determines the endpoint’s superscript. That is, if the other block is monochromatic, the pair edge gives its endpoint the complementary superscript. Thus, after 2 ℓ + 3 2\ell+3 2 ℓ + 3 rounds, every input endpoint’s pattern determines its superscript, without recovering the input index.
After one further round, g a g_a g a determines the number of its input neighbors with superscript one and hence par ( a ) \operatorname{par}(a) par ( a ) . All internal neighbors of r b r^b r b have parity b b b . Since degree identifies the marked root, its pattern after 2 ℓ + 5 2\ell+5 2 ℓ + 5 rounds determines b b b . The two conditional supports on D D D are therefore disjoint. Since E E E is observable, they are also disjoint from the common conditional support on E E E . This gives the decomposition. When q = 1 q=1 q = 1 , every input is erased, and the same coupling proves equality of the deterministic observations. □
Optimal failure probability
The decomposition makes the optimal error depend only on the probability that both batches reveal their graph identities.
Proposition 42. Suppose that, for b ∈ { 0 , 1 } b \in\{0,1\} b ∈ { 0 , 1 } ,
P b = ( 1 − η ) Q + η Q b , η ∈ [ 0 , 1 ] , (94) P_b=(1-\eta)Q+\eta Q_b,\qquad\eta\in[0,1], \tag*{(94)} P b = ( 1 − η ) Q + η Q b , η ∈ [ 0 , 1 ] , (94) where Q , Q 0 , Q 1 Q,Q_0,Q_1 Q , Q 0 , Q 1 are mutually singular probability laws. Among randomized tests using two independent batches of s s s i.i.d. observations, the smallest worst-case failure probability for deciding whether their generating graph identities agree is
α s ∗ ( η ) = 1 2 [ 1 − ( 1 − ( 1 − η ) s ) 2 ] . (95) \alpha_s^*(\eta)=\frac{1}{2}\left[1-\left(1-(1-\eta)^s\right)^2\right]. \tag*{(95)} α s ∗ ( η ) = 2 1 [ 1 − ( 1 − ( 1 − η ) s ) 2 ] . (95) The worst case ranges over all four ordered choices from { P 0 , P 1 } \{P_0,P_1\} { P 0 , P 1 } , indexed by their graph identities.
Proof. Mutual singularity makes the three alternatives Q , Q 0 , Q 1 Q,Q_0,Q_1 Q , Q 0 , Q 1 observable. A batch reveals its identity if it contains an observation from Q 0 Q_0 Q 0 or Q 1 Q_1 Q 1 , an event of probability a s = 1 − ( 1 − η ) s a_s=1-(1-\eta)^s a s = 1 − ( 1 − η ) s . If both batches reveal their identities, compare them and answer correctly. Otherwise, flip an independent fair coin. This test has failure probability ( 1 − a s 2 ) / 2 (1-a_s^2)/2 ( 1 − a s 2 ) /2 in each of the four input cases.
For the lower bound, put the uniform prior on the four ordered pairs of graph identities. If a batch contains only observations from Q Q Q , its identity remains an independent uniform bit conditional on both observed batches. Unless both identities are revealed, their equality therefore has conditional probability 1 / 2 1/2 1/2 . Every test has average failure probability at least ( 1 − a s 2 ) / 2 (1-a_s^2)/2 ( 1 − a s 2 ) /2 under this prior, and its worst-case failure probability is at least its average. This proves optimality.
Set δ : = 1 − 1 / 3 \delta:=1-1/\sqrt{3} δ := 1 − 1/ 3 . The proposition gives
α s ∗ ( η ) ≤ 1 3 ⟺ ( 1 − η ) s ≤ δ ⟺ η ≥ 1 − δ 1 / s . (96) \alpha_s^*(\eta)\le\frac{1}{3}
\quad\Longleftrightarrow\quad
(1-\eta)^s\le\delta
\quad\Longleftrightarrow\quad
\eta\ge1-\delta^{1/s}. \tag*{(96)} α s ∗ ( η ) ≤ 3 1 ⟺ ( 1 − η ) s ≤ δ ⟺ η ≥ 1 − δ 1/ s . (96)
For the constructed pair, use η = η ℓ , k , q \eta=\eta_{\ell,k,q} η = η ℓ , k , q when q ≥ 2 q\ge2 q ≥ 2 . For q = 1 q=1 q = 1 , the trial laws agree, so the optimal failure probability is 1 / 2 1/2 1/2 , also given by the formula at η = 0 \eta=0 η = 0 .
Strict hierarchies
We are now ready to prove the two hierarchy results. We begin by proving the hierarchy results on the number of trials.
Proof of Theorem 35. Fix s ≥ 2 s\ge2 s ≥ 2 , and set
L s : = 1 − δ 1 / s , U s : = 1 − δ 1 / ( s − 1 ) . L_s:=1-\delta^{1/s},\qquad U_s:=1-\delta^{1/(s-1)}. L s := 1 − δ 1/ s , U s := 1 − δ 1/ ( s − 1 ) .
Then 0 < L s < U s < 1 0<L_s<U_s<1 0 < L s < U s < 1 . Choose a prime ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 sufficiently large that, with p = p ℓ , 2 = 2 2 − 2 ℓ p=p_{\ell,2}=2^{2-2\ell} p = p ℓ , 2 = 2 2 − 2 ℓ ,
p ≤ 1 − L s U s , ( 1 − p ) 2 ≥ U s . p\le1-\frac{L_s}{U_s},\qquad(1-p)^2\ge U_s. p ≤ 1 − U s L s , ( 1 − p ) 2 ≥ U s .
Let k k k be the smallest positive integer such that ( 1 − p ) k < U s (1-p)^k<U_s ( 1 − p ) k < U s . The second inequality ensures k ≥ 3 k\ge3 k ≥ 3 . Minimality gives
L s ≤ ( 1 − p ) U s ≤ ( 1 − p ) k < U s . L_s\le(1-p)U_s\le(1-p)^k<U_s. L s ≤ ( 1 − p ) U s ≤ ( 1 − p ) k < U s .
Thus L s ≤ η ℓ , k , 2 < U s L_s\le\eta_{\ell,k,2}<U_s L s ≤ η ℓ , k , 2 < U s . By Equation (96) , s s s trials per graph achieve failure probability at most 1 / 3 1/3 1/3 , whereas every test with s − 1 s-1 s − 1 trials has worst-case failure probability greater than 1 / 3 1/3 1/3 . Take G s = H 0 , ℓ , k G_s=H_{0,\ell,k} G s = H 0 , ℓ , k and H s = H 1 , ℓ , k H_s=H_{1,\ell,k} H s = H 1 , ℓ , k . By Lemma 40 , they are non-isomorphic, which gives the claim.
We now give the hierarchy results for the number of colors.
Proof of Theorem 36. Fix q , s ≥ 1 q,s\ge1 q , s ≥ 1 , and set
τ : = 1 − δ 1 / s , c : = − log τ > 0. (97) \tau:=1-\delta^{1/s},\qquad c:=-\log\tau>0. \tag*{(97)} τ := 1 − δ 1/ s , c := − log τ > 0. (97)
For a prime ℓ ≥ 7 \ell\ge7 ℓ ≥ 7 , put a = 2 ℓ − 2 a = 2\ell- 2 a = 2 ℓ − 2 and choose
k : = max { 3 , ⌊ c q a ⌋ + 1 } . (98) k := \max\{3, \lfloor cq^{a} \rfloor+ 1\}. \tag*{(98)} k := max { 3 , ⌊ c q a ⌋ + 1 } . (98)
When q ≥ 2 q \ge2 q ≥ 2 , we have k q − a > c kq^{-a} > c k q − a > c , so
η ℓ , k , q = ( 1 − q − a ) k ≤ exp ( − k q − a ) < exp ( − c ) = τ . (99) \begin{aligned}
\eta_{\ell,k,q} = (1-q^{-a})^k \\
&\le\exp(-kq^{-a}) < \exp(-c) = \tau. \tag*{(99)}
\end{aligned} η ℓ , k , q = ( 1 − q − a ) k ≤ exp ( − k q − a ) < exp ( − c ) = τ . (99)
For q = 1 q = 1 q = 1 , the same strict inequality holds because η ℓ , k , 1 = 0 \eta_{\ell,k,1} = 0 η ℓ , k , 1 = 0 . Since η ℓ , k , r \eta_{\ell,k,r} η ℓ , k , r is nondecreasing in r r r , every palette size r ≤ q r \le q r ≤ q gives optimal failure probability greater than 1 / 3 1/3 1/3 with s s s trials per graph.
On the other hand, k ≤ c q a + 3 k \le cq^a + 3 k ≤ c q a + 3 , and Bernoulli’s inequality gives
η ℓ , k , q + 1 ≥ 1 − k ( q + 1 ) − a \eta_{\ell,k,q+1} \ge1-k(q+1)^{-a} η ℓ , k , q + 1 ≥ 1 − k ( q + 1 ) − a
≥ 1 − c ( q q + 1 ) a − 3 ( q + 1 ) − a . (100) \ge1-c\left(\frac{q}{q+1}\right)^a-3(q+1)^{-a}. \tag*{(100)} ≥ 1 − c ( q + 1 q ) a − 3 ( q + 1 ) − a . (100)
As ℓ \ell ℓ tends to infinity through the primes, the last expression tends to one. Choose ℓ \ell ℓ sufficiently large that it exceeds τ \tau τ . By Equation (96) , q + 1 q+1 q + 1 colors and s s s trials per graph then give failure probability at most 1 / 3 1/3 1/3 . Taking G q , s = H 0 , ℓ , k G_{q,s}=H_{0,\ell,k} G q , s = H 0 , ℓ , k and H q , s = H 1 , ℓ , k H_{q,s}=H_{1,\ell,k} H q , s = H 1 , ℓ , k proves the claim.
Representation Spaces for Message-Passing Networks
We fix an aggregation scheme α ∈ { s u m ‾ , m e a n , m a x , m i n } \alpha\in\{\overline{\mathrm{sum}},\mathrm{mean},\mathrm{max},\mathrm{min}\} α ∈ { sum , mean , max , min } . All measures below are finite Borel measures. Graphs are finite and nonempty; for mean, max, and min aggregation, we assume that every vertex has a nonempty neighborhood.
Metrics on measures and compact sets
Let ( X , d ) (X,d) ( X , d ) be a compact metric space. Write M ≤ 1 ( X ) \mathcal{M}_{\le1}(X) M ≤ 1 ( X ) for the nonnegative measures on X X X with total mass at most one, and P ( X ) \mathcal{P}(X) P ( X ) for the probability measures on X X X . For μ , ν ∈ M ≤ 1 ( X ) \mu,\nu\in\mathcal{M}_{\le1}(X) μ , ν ∈ M ≤ 1 ( X ) , define the bounded-Lipschitz metric
β d ( μ , ν ) : = sup ∥ f ∥ ∞ ≤ 1 Lip d ( f ) ≤ 1 ∣ ∫ X f d μ − ∫ X f d ν ∣ . (101) \beta_d(\mu,\nu) := \sup_{\substack{\lVert f\rVert_\infty\le1\\ \operatorname{Lip}_d(f)\le1}} \left\lvert\int_X f\,\mathrm{d}\mu-\int_X f\,\mathrm{d}\nu\right\rvert. \tag*{(101)} β d ( μ , ν ) := ∥ f ∥ ∞ ≤ 1 Lip d ( f ) ≤ 1 sup ∫ X f d μ − ∫ X f d ν . (101)
The bound on ∥ f ∥ ∞ \lVert f\rVert_\infty ∥ f ∥ ∞ makes this expression finite even when the measures have different total masses.
Let K ( X ) \mathcal{K}(X) K ( X ) denote the collection of nonempty compact subsets of X X X . Its Hausdorff metric is
H d ( A , B ) : = max { sup a ∈ A inf b ∈ B d ( a , b ) , sup b ∈ B inf a ∈ A d ( a , b ) } . (102) H_d(A,B) := \max\left\{\sup_{a\in A}\inf_{b\in B}d(a,b),\sup_{b\in B}\inf_{a\in A}d(a,b)\right\}. \tag*{(102)} H d ( A , B ) := max { a ∈ A sup b ∈ B inf d ( a , b ) , b ∈ B sup a ∈ A inf d ( a , b ) } . (102)
Iterated representation spaces
Set X 0 = K X_0 = K X 0 = K and d 0 ( x , y ) = ∥ x − y ∥ 2 d_0(x,y)=\lVert x-y\rVert_2 d 0 ( x , y ) = ∥ x − y ∥ 2 . Given ( X ℓ , d ℓ ) (X_\ell,d_\ell) ( X ℓ , d ℓ ) , define the neighborhood space
Y ℓ = { M ≤ 1 ( X ℓ ) , α = s u m ‾ , P ( X ℓ ) , α = m e a n , K ( X ℓ ) , α ∈ { m a x , m i n } , Y_\ell=
\begin{cases}
\mathcal{M}_{\le1}(X_\ell), & \alpha=\overline{\mathrm{sum}},\\
\mathcal{P}(X_\ell), & \alpha=\mathrm{mean},\\
\mathcal{K}(X_\ell), & \alpha\in\{\mathrm{max},\mathrm{min}\},
\end{cases} Y ℓ = ⎩ ⎨ ⎧ M ≤ 1 ( X ℓ ) , P ( X ℓ ) , K ( X ℓ ) , α = sum , α = mean , α ∈ { max , min } ,
equipped with
e ℓ = { β d ℓ , α ∈ { s u m ‾ , m e a n } , H d ℓ , α ∈ { m a x , m i n } . e_\ell=
\begin{cases}
\beta_{d_\ell}, & \alpha\in\{\overline{\mathrm{sum}},\mathrm{mean}\},\\
H_{d_\ell}, & \alpha\in\{\mathrm{max},\mathrm{min}\}.
\end{cases} e ℓ = { β d ℓ , H d ℓ , α ∈ { sum , mean } , α ∈ { max , min } .
Define
X ℓ + 1 = X ℓ × Y ℓ , d ℓ + 1 ( ( z , ν ) , ( z ′ , ν ′ ) ) = d ℓ ( z , z ′ ) + e ℓ ( ν , ν ′ ) . (103) X_{\ell+1}=X_\ell\times Y_\ell,\qquad d_{\ell+1}\bigl((z,\nu),(z',\nu')\bigr)=d_\ell(z,z')+e_\ell(\nu,\nu'). \tag*{(103)} X ℓ + 1 = X ℓ × Y ℓ , d ℓ + 1 ( ( z , ν ) , ( z ′ , ν ′ ) ) = d ℓ ( z , z ′ ) + e ℓ ( ν , ν ′ ) . (103)
For normalized-sum and mean aggregation, these are spaces of iterated degree measures: each representation records the initial feature together with measures on lower-depth representations. For max and min aggregation, we replace measures with compact neighborhood sets.
Induced representations and pseudometrics
For a graph G G G with initialization x ∈ K V ( G ) x \in K^{V(G)} x ∈ K V ( G ) , set η G , v ( 0 ) ( x ) = x v \eta^{(0)}_{G,v}(x)=x_v η G , v ( 0 ) ( x ) = x v and recursively define
η G , v ( ℓ + 1 ) ( x ) = ( η G , v ( ℓ ) ( x ) , ν G , v ( ℓ ) ( x ) ) , \eta^{(\ell+1)}_{G,v}(x)=\left(\eta^{(\ell)}_{G,v}(x),\nu^{(\ell)}_{G,v}(x)\right), η G , v ( ℓ + 1 ) ( x ) = ( η G , v ( ℓ ) ( x ) , ν G , v ( ℓ ) ( x ) ) ,
where
ν G , v ( ℓ ) ( x ) = { 1 ∣ V ( G ) ∣ ∑ u ∈ N G ( v ) δ η G , u ( ℓ ) ( x ) , α = sum , 1 ∣ N G ( v ) ∣ ∑ u ∈ N G ( v ) δ η G , u ( ℓ ) ( x ) , α = mean , { η G , u ( ℓ ) ( x ) : u ∈ N G ( v ) } , α ∈ { max , min } . \nu^{(\ell)}_{G,v}(x)=
\begin{cases}
\frac{1}{|V(G)|}\sum_{u\in N_G(v)}\delta_{\eta^{(\ell)}_{G,u}(x)}, & \alpha=\text{sum},\\
\frac{1}{|N_G(v)|}\sum_{u\in N_G(v)}\delta_{\eta^{(\ell)}_{G,u}(x)}, & \alpha=\text{mean},\\
\{\eta^{(\ell)}_{G,u}(x):u\in N_G(v)\}, & \alpha\in\{\text{max},\text{min}\}.
\end{cases} ν G , v ( ℓ ) ( x ) = ⎩ ⎨ ⎧ ∣ V ( G ) ∣ 1 ∑ u ∈ N G ( v ) δ η G , u ( ℓ ) ( x ) , ∣ N G ( v ) ∣ 1 ∑ u ∈ N G ( v ) δ η G , u ( ℓ ) ( x ) , { η G , u ( ℓ ) ( x ) : u ∈ N G ( v )} , α = sum , α = mean , α ∈ { max , min } .
Here δ z \delta_z δ z is the Dirac probability measure at z z z . The normalized-sum measure has mass ∣ N G ( v ) ∣ / ∣ V ( G ) ∣ ≤ 1 |N_G(v)|/|V(G)|\le1 ∣ N G ( v ) ∣/∣ V ( G ) ∣ ≤ 1 , the mean measure has mass one, and the neighborhood sets are finite and nonempty. Thus η G , v ( ℓ ) ( x ) ∈ X ℓ \eta^{(\ell)}_{G,v}(x)\in X_\ell η G , v ( ℓ ) ( x ) ∈ X ℓ .
The induced pseudometric on rooted attributed graphs is
d D n o d e ( ( G , x , v ) , ( G ′ , x ′ , v ′ ) ) : = d D ( η G , v ( D ) ( x ) , η G ′ , v ′ ( D ) ( x ′ ) ) . d_D^{\mathrm{node}}\left((G,x,v),(G',x',v')\right):=d_D\left(\eta^{(D)}_{G,v}(x),\eta^{(D)}_{G',v'}(x')\right). d D node ( ( G , x , v ) , ( G ′ , x ′ , v ′ ) ) := d D ( η G , v ( D ) ( x ) , η G ′ , v ′ ( D ) ( x ′ ) ) .
It is a pseudometric because distinct rooted attributed graphs may have identical representations.
For graph-level representations, define
R G , x ( D ) : = 1 ∣ V ( G ) ∣ ∑ v ∈ V ( G ) δ η G , v ( D ) ( x ) ∈ P ( X D ) . R^{(D)}_{G,x}:=\frac{1}{|V(G)|}\sum_{v\in V(G)}\delta_{\eta^{(D)}_{G,v}(x)}\in\mathcal{P}(X_D). R G , x ( D ) := ∣ V ( G ) ∣ 1 v ∈ V ( G ) ∑ δ η G , v ( D ) ( x ) ∈ P ( X D ) .
The induced graph-level pseudometric is
d D g r a p h ( ( G , x ) , ( G ′ , x ′ ) ) : = W 1 ( R G , x ( D ) , R G ′ , x ′ ( D ) ) , d_D^{\mathrm{graph}}\left((G,x),(G',x')\right):=W_1\left(R^{(D)}_{G,x},R^{(D)}_{G',x'}\right), d D graph ( ( G , x ) , ( G ′ , x ′ ) ) := W 1 ( R G , x ( D ) , R G ′ , x ′ ( D ) ) ,
where the Wasserstein distance W 1 W_1 W 1 uses the ground metric d D d_D d D .
The induced representation maps are continuous, hence Borel measurable, by induction on depth using the continuity of the finite measure and neighborhood-set constructions. So their laws under random initialization are well defined.
Compactness of the Representation Spaces and Lipschitz Property
This section collects the compactness and Lipschitz properties of the deterministic representation framework used in our analysis. We recall the relevant results and refer to Wittig et al. [30 ] for the underlying arguments. We develop the extension to random initialization in the next appendix.
Compactness of Representation Spaces
Compactness of the representation spaces follows inductively from compactness of the initial feature space K K K ; each successive space is a product of the preceding space and a space of neighborhood measures or compact sets. The following lemma provides the compactness properties needed for this construction.
Lemma 43. If ( X , d ) (X,d) ( X , d ) is a compact metric space, then M ≤ 1 ( X ) \mathcal{M}_{\le1}(X) M ≤ 1 ( X ) and P ( X ) \mathcal{P}(X) P ( X ) are compact under β d \beta_d β d , and K ( X ) \mathcal{K}(X) K ( X ) is compact under H d H_d H d .
Proof. For complete proofs, see [30 Theorems 96 and 98] . For the spaces of measures, compactness follows from the compactness and metrizability of the weak∗ ^* ∗ topology together with the fact that the Kantorovich metric β d \beta_d β d metrizes this topology; see [14 ] , Theorem 17.22, and [3 ] , Theorem 8.3.2. For K ( X ) \mathcal{K}(X) K ( X ) , compactness with respect to the Hausdorff metric H d H_d H d follows from the Blaschke selection theorem; see [26 Theorem 1.8.4] .
Corollary 44. For every ℓ ≥ 0 \ell\ge0 ℓ ≥ 0 , ( X ℓ , d ℓ ) (X_\ell,d_\ell) ( X ℓ , d ℓ ) is a compact metric space.
Lipschitzness of MPNNs
Set ϕ θ ( 0 ) ( z ) = z \phi_{\theta}^{(0)}(z)=z ϕ θ ( 0 ) ( z ) = z . For ( z , ν ) ∈ X ℓ + 1 (z,\nu)\in\mathcal{X}_{\ell+1} ( z , ν ) ∈ X ℓ + 1 , define
ϕ θ ( ℓ + 1 ) ( z , ν ) = σ ( W s e l f ( ℓ ) ϕ θ ( ℓ ) ( z ) + W a g g ( ℓ ) A θ ( ℓ ) ( ν ) + b ( ℓ ) ) . \phi_{\theta}^{(\ell+1)}(z,\nu)=\sigma\left(W_{\mathrm{self}}^{(\ell)}\phi_{\theta}^{(\ell)}(z)+W_{\mathrm{agg}}^{(\ell)}\mathcal{A}_{\theta}^{(\ell)}(\nu)+b^{(\ell)}\right). ϕ θ ( ℓ + 1 ) ( z , ν ) = σ ( W self ( ℓ ) ϕ θ ( ℓ ) ( z ) + W agg ( ℓ ) A θ ( ℓ ) ( ν ) + b ( ℓ ) ) .
where
A θ ( ℓ ) ( ν ) = { ∫ ϕ θ ( ℓ ) ( y ) d ν ( y ) , α ∈ { s u m , m e a n } , max y ∈ V ϕ θ ( ℓ ) ( y ) , α = max , min y ∈ V ϕ θ ( ℓ ) ( y ) , α = min . \mathcal{A}_{\theta}^{(\ell)}(\nu)=
\begin{cases}
\int\phi_{\theta}^{(\ell)}(y)\,d\nu(y), & \alpha\in\{\mathrm{sum},\mathrm{mean}\},\\
\max_{y\in V}\phi_{\theta}^{(\ell)}(y), & \alpha=\max,\\
\min_{y\in V}\phi_{\theta}^{(\ell)}(y), & \alpha=\min.
\end{cases} A θ ( ℓ ) ( ν ) = ⎩ ⎨ ⎧ ∫ ϕ θ ( ℓ ) ( y ) d ν ( y ) , max y ∈ V ϕ θ ( ℓ ) ( y ) , min y ∈ V ϕ θ ( ℓ ) ( y ) , α ∈ { sum , mean } , α = max , α = min .
The maximum and minimum are taken coordinate-wise.
The map ϕ θ ( ℓ ) \phi_{\theta}^{(\ell)} ϕ θ ( ℓ ) realizes the MPNN on the structural representation space. The following identity, obtained by induction on ℓ \ell ℓ , shows that the structural representation contains all information required to compute the node output. Consequently, Lipschitz bounds for ϕ θ ( ℓ ) \phi_{\theta}^{(\ell)} ϕ θ ( ℓ ) transfer directly to the MPNN under the induced pseudometric.
Lemma 45. For every initialization x x x , vertex v v v , and depth ℓ \ell ℓ ,
ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( v ; x ) . \phi_{\theta}^{(\ell)}\left(\eta_{G,v}^{(\ell)}(\mathbf{x})\right)=h_{\theta,G}^{(\ell)}(v;\mathbf{x}). ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( v ; x ) .
Proof. We prove the result by induction on ℓ \ell ℓ . For ℓ = 0 \ell=0 ℓ = 0 , we have
ϕ θ ( 0 ) ( η G , v ( 0 ) ( x ) ) = ϕ θ ( 0 ) ( x v ) = x v = h θ , G ( 0 ) ( v ; x ) . \phi_{\theta}^{(0)}\left(\eta_{G,v}^{(0)}(\mathbf{x})\right)=\phi_{\theta}^{(0)}(x_v)=x_v=h_{\theta,G}^{(0)}(v;\mathbf{x}). ϕ θ ( 0 ) ( η G , v ( 0 ) ( x ) ) = ϕ θ ( 0 ) ( x v ) = x v = h θ , G ( 0 ) ( v ; x ) .
Now suppose that ϕ θ ( ℓ ) ( η G , u ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( u ; x ) \phi_{\theta}^{(\ell)}\left(\eta_{G,u}^{(\ell)}(\mathbf{x})\right)=h_{\theta,G}^{(\ell)}(u;\mathbf{x}) ϕ θ ( ℓ ) ( η G , u ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( u ; x ) , for every vertex u ∈ V ( G ) u\in V(G) u ∈ V ( G ) . For ℓ + 1 \ell+1 ℓ + 1 , we write η G , v ( ℓ + 1 ) ( x ) = ( η G , v ( ℓ ) ( x ) , ν G , v ( ℓ ) ( x ) ) \eta_{G,v}^{(\ell+1)}(\mathbf{x})=\left(\eta_{G,v}^{(\ell)}(\mathbf{x}),\nu_{G,v}^{(\ell)}(\mathbf{x})\right) η G , v ( ℓ + 1 ) ( x ) = ( η G , v ( ℓ ) ( x ) , ν G , v ( ℓ ) ( x ) ) . Then, by definition of ϕ θ ( ℓ + 1 ) \phi_{\theta}^{(\ell+1)} ϕ θ ( ℓ + 1 ) ,
ϕ θ ( ℓ + 1 ) ( η G , v ( ℓ + 1 ) ( x ) ) = σ ( W s e l f ( ℓ ) ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) + W a g g ( ℓ ) A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) ) . \phi_{\theta}^{(\ell+1)}\left(\eta_{G,v}^{(\ell+1)}(\mathbf{x})\right)=\sigma\left(W_{\mathrm{self}}^{(\ell)}\phi_{\theta}^{(\ell)}\left(\eta_{G,v}^{(\ell)}(\mathbf{x})\right)+W_{\mathrm{agg}}^{(\ell)}\mathcal{A}_{\theta}^{(\ell)}\left(\nu_{G,v}^{(\ell)}(\mathbf{x})\right)\right). ϕ θ ( ℓ + 1 ) ( η G , v ( ℓ + 1 ) ( x ) ) = σ ( W self ( ℓ ) ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) + W agg ( ℓ ) A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) ) .
By the induction hypothesis, the first term inside the activation is
ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( v ; x ) . \phi_{\theta}^{(\ell)}\left(\eta_{G,v}^{(\ell)}(\mathbf{x})\right)=h_{\theta,G}^{(\ell)}(v;\mathbf{x}). ϕ θ ( ℓ ) ( η G , v ( ℓ ) ( x ) ) = h θ , G ( ℓ ) ( v ; x ) .
It remains to identify the aggregation term. By construction of ν G , v ( ℓ ) ( x ) \nu_{G,v}^{(\ell)}(\mathbf{x}) ν G , v ( ℓ ) ( x ) , applying A θ ( ℓ ) \mathcal{A}_{\theta}^{(\ell)} A θ ( ℓ ) to this neighborhood representation recovers the corresponding aggregation of the depth-ℓ \ell ℓ hidden states. Indeed, for the sum and mean cases, integration against the induced atomic measure gives the required weighted sum of
ϕ θ ( ℓ ) ( η G , u ( ℓ ) ( x ) ) , u ∈ N G ( v ) , \phi_{\theta}^{(\ell)}\left(\eta_{G,u}^{(\ell)}(\mathbf{x})\right),\qquad u\in N_G(v), ϕ θ ( ℓ ) ( η G , u ( ℓ ) ( x ) ) , u ∈ N G ( v ) ,
which, by the induction hypothesis, equals the corresponding sum or mean of h θ , G ( ℓ ) ( u ; x ) h_{\theta,G}^{(\ell)}(u;\mathbf{x}) h θ , G ( ℓ ) ( u ; x ) . For α = max \alpha=\max α = max ,
A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) = max y ∈ V G , v ( ℓ ) ( x ) ϕ θ ( ℓ ) ( y ) = max u ∈ N G ( v ) h θ , G ( ℓ ) ( u ; x ) , \mathcal{A}_{\theta}^{(\ell)}\left(\nu_{G,v}^{(\ell)}(\mathbf{x})\right)=\max_{y\in V_{G,v}^{(\ell)}(\mathbf{x})}\phi_{\theta}^{(\ell)}(y)=\max_{u\in N_G(v)}h_{\theta,G}^{(\ell)}(u;\mathbf{x}), A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) = y ∈ V G , v ( ℓ ) ( x ) max ϕ θ ( ℓ ) ( y ) = u ∈ N G ( v ) max h θ , G ( ℓ ) ( u ; x ) ,
and the same argument gives, for α = min \alpha=\min α = min ,
A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) = min u ∈ N G ( v ) h θ , G ( ℓ ) ( u ; x ) , \mathcal{A}_{\theta}^{(\ell)}\left(\nu_{G,v}^{(\ell)}(\mathbf{x})\right)=\min_{u\in N_G(v)}h_{\theta,G}^{(\ell)}(u;\mathbf{x}), A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) = u ∈ N G ( v ) min h θ , G ( ℓ ) ( u ; x ) ,
with maxima and minima taken coordinate-wise. Thus, in every case, A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) \mathcal{A}_{\theta}^{(\ell)}\left(\nu_{G,v}^{(\ell)}(\mathbf{x})\right) A θ ( ℓ ) ( ν G , v ( ℓ ) ( x ) ) is exactly the neighborhood aggregate appearing in the definition of the message-passing update. Hence
ϕ θ ( ℓ + 1 ) ( η G , v ( ℓ + 1 ) ( x ) ) = h θ , G ( ℓ + 1 ) ( v ; x ) . \phi_{\theta}^{(\ell+1)}\left(\eta_{G,v}^{(\ell+1)}(\mathbf{x})\right)=h_{\theta,G}^{(\ell+1)}(v;\mathbf{x}). ϕ θ ( ℓ + 1 ) ( η G , v ( ℓ + 1 ) ( x ) ) = h θ , G ( ℓ + 1 ) ( v ; x ) .
This completes the induction.
Lemma 46. Let g : X → R p g:X\to\mathbb{R}^{p} g : X → R p satisfy sup x ∥ g ( x ) ∥ 2 ≤ M \sup_{x}\lVert g(x)\rVert_{2}\le M sup x ∥ g ( x ) ∥ 2 ≤ M and ∥ g ( x ) − g ( y ) ∥ 2 ≤ C d ( x , y ) \lVert g(x)-g(y)\rVert_{2}\le Cd(x,y) ∥ g ( x ) − g ( y ) ∥ 2 ≤ C d ( x , y ) . For μ , ν ∈ M ≤ 1 ( X ) \mu,\nu\in\mathcal{M}_{\leq1}(X) μ , ν ∈ M ≤ 1 ( X ) ,
∥ ∫ g d μ − ∫ g d ν ∥ 2 ≤ max { M , C } β d ( μ , ν ) , ∥ ∫ g d μ ∥ 2 ≤ M . \left\lVert\int g\,\mathrm{d}\mu-\int g\,\mathrm{d}\nu\right\rVert_{2}\leq\max\{M,C\}\beta_{d}(\mu,\nu),\qquad\left\lVert\int g\,\mathrm{d}\mu\right\rVert_{2}\leq M. ∫ g d μ − ∫ g d ν 2 ≤ max { M , C } β d ( μ , ν ) , ∫ g d μ 2 ≤ M . For A , B ∈ K ( X ) A,B\in\mathcal{K}(X) A , B ∈ K ( X ) ,
∥ max A g − max B g ∥ 2 ≤ p C H d ( A , B ) , ∥ max A g ∥ 2 ≤ p M . \left\lVert\max_{A}g-\max_{B}g\right\rVert_{2}\leq\sqrt{p}\,C H_{d}(A,B),\qquad\left\lVert\max_{A}g\right\rVert_{2}\leq\sqrt{p}M. A max g − B max g 2 ≤ p C H d ( A , B ) , A max g 2 ≤ p M . The same bounds hold for minimum aggregation.
Proof. For each unit vector a ∈ R p a\in\mathbb{R}^{p} a ∈ R p , the scalar function ⟨ a , g ⟩ \langle a,g\rangle ⟨ a , g ⟩ has uniform norm at most M M M and Lipschitz constant at most C C C . After scaling by max { M , C } \max\{M,C\} max { M , C } , it is an admissible test function in Equation (101) ; the zero case is immediate. Taking the supremum over unit vectors proves the first bound. The second follows from μ ( X ) ≤ 1 \mu(X)\leq1 μ ( X ) ≤ 1 .
For each coordinate j j j , Hausdorff proximity gives
∣ max A g j − max B g j ∣ ≤ C H d ( A , B ) . \left|\max_{A}g_j-\max_{B}g_j\right|\leq C H_d(A,B). A max g j − B max g j ≤ C H d ( A , B ) . Summing the squared coordinate bounds yields the factor p \sqrt{p} p . Since ∣ g j ∣ ≤ M |g_j|\leq M ∣ g j ∣ ≤ M , each coordinate of max A g \max_A g max A g has absolute value at most M M M , proving its norm bound. Replacing g g g by − g -g − g proves the claims for minimum aggregation.
Combining these aggregation bounds with the 1-Lipschitz property of ReLU yields recursive bounds on the magnitude and Lipschitz constant of each layer. We denote these bounds by M θ , ℓ M_{\theta,\ell} M θ , ℓ and C θ , ℓ C_{\theta,\ell} C θ , ℓ , respectively; the resulting recursions provide an explicit Lipschitz certificate for the final readout. Write
a ℓ = ∥ W s e l f ( ℓ ) ∥ 2 , b ℓ = ∥ W a g g ( ℓ ) ∥ 2 , R K = max x ∈ K ∥ x ∥ 2 . a_\ell=\lVert W_{\mathrm{self}}^{(\ell)}\rVert_{2},\qquad b_\ell=\lVert W_{\mathrm{agg}}^{(\ell)}\rVert_{2},\qquad R_K=\max_{x\in K}\lVert x\rVert_{2}. a ℓ = ∥ W self ( ℓ ) ∥ 2 , b ℓ = ∥ W agg ( ℓ ) ∥ 2 , R K = x ∈ K max ∥ x ∥ 2 .
Initialize M θ , 0 = R K M_{\theta,0}=R_K M θ , 0 = R K and C θ , 0 = 1 C_{\theta,0}=1 C θ , 0 = 1 . The bias contributes to the magnitude bound but cancels in differences of updates. For normalized-sum and mean aggregation, define
M θ , ℓ + 1 = ( a ℓ + b ℓ ) M θ , ℓ + ∥ b ( ℓ ) ∥ 2 , M_{\theta,\ell+1}=(a_\ell+b_\ell)M_{\theta,\ell}+\lVert b^{(\ell)}\rVert_{2}, M θ , ℓ + 1 = ( a ℓ + b ℓ ) M θ , ℓ + ∥ b ( ℓ ) ∥ 2 ,
C θ , ℓ + 1 = max { a ℓ C θ , ℓ , b ℓ max { M θ , ℓ , C θ , ℓ } } . C_{\theta,\ell+1}=\max\{a_\ell C_{\theta,\ell},b_\ell\max\{M_{\theta,\ell},C_{\theta,\ell}\}\}. C θ , ℓ + 1 = max { a ℓ C θ , ℓ , b ℓ max { M θ , ℓ , C θ , ℓ }} .
For max and min aggregation, define
M θ , ℓ + 1 = ( a ℓ + b ℓ d ℓ ) M θ , ℓ + ∥ b ( ℓ ) ∥ 2 , M_{\theta,\ell+1}=(a_\ell+b_\ell\sqrt{d_\ell})M_{\theta,\ell}+\lVert b^{(\ell)}\rVert_{2}, M θ , ℓ + 1 = ( a ℓ + b ℓ d ℓ ) M θ , ℓ + ∥ b ( ℓ ) ∥ 2 ,
C θ , ℓ + 1 = max { a ℓ , b ℓ d ℓ } C θ , ℓ . C_{\theta,\ell+1}=\max\{a_\ell,b_\ell\sqrt{d_\ell}\}C_{\theta,\ell}. C θ , ℓ + 1 = max { a ℓ , b ℓ d ℓ } C θ , ℓ .
Proposition 47 (Boundedness and Lipschitz continuity). For every ℓ \ell ℓ ,
sup z ∈ X ℓ ∥ ϕ θ ( ℓ ) ( z ) ∥ 2 ≤ M θ , ℓ , ∥ ϕ θ ( ℓ ) ( z ) − ϕ θ ( ℓ ) ( z ′ ) ∥ 2 ≤ C θ , ℓ d ℓ ( z , z ′ ) . \sup_{z\in\mathcal{X}^{\ell}}\lVert\phi_{\theta}^{(\ell)}(z)\rVert_{2}\leq M_{\theta,\ell},\qquad\lVert\phi_{\theta}^{(\ell)}(z)-\phi_{\theta}^{(\ell)}(z')\rVert_{2}\leq C_{\theta,\ell}d_{\ell}(z,z'). z ∈ X ℓ sup ∥ ϕ θ ( ℓ ) ( z ) ∥ 2 ≤ M θ , ℓ , ∥ ϕ θ ( ℓ ) ( z ) − ϕ θ ( ℓ ) ( z ′ ) ∥ 2 ≤ C θ , ℓ d ℓ ( z , z ′ ) . Consequently, ψ θ = W o u t ϕ θ ( D ) \psi_{\theta}=W_{\mathrm{out}}\phi_{\theta}^{(D)} ψ θ = W out ϕ θ ( D ) has Lipschitz certificate B θ : = ∥ W o u t ∥ 2 C θ , D B_{\theta}:=\lVert W_{\mathrm{out}}\rVert_{2}C_{\theta,D} B θ := ∥ W out ∥ 2 C θ , D .
Proof. The statement trivially holds at depth zero. Suppose it holds at depth ℓ \ell ℓ . ReLU is 1-Lipschitz and satisfies ∥ σ ( y ) ∥ 2 ≤ ∥ y ∥ 2 \lVert\sigma(y)\rVert_{2}\leq\lVert y\rVert_{2} ∥ σ ( y ) ∥ 2 ≤ ∥ y ∥ 2 . For s = ( z , ν ) s=(z,\nu) s = ( z , ν ) and s ′ = ( z ′ , ν ′ ) s'=(z',\nu') s ′ = ( z ′ , ν ′ ) ,
∥ ϕ θ ( ℓ + 1 ) ( s ) − ϕ θ ( ℓ + 1 ) ( s ′ ) ∥ 2 ≤ a ℓ C θ , ℓ d ℓ ( z , z ′ ) + b ℓ ∥ A θ ( ℓ ) ( ν ) − A θ ( ℓ ) ( ν ′ ) ∥ 2 . \left\lVert\phi_{\theta}^{(\ell+1)}(s)-\phi_{\theta}^{(\ell+1)}(s')\right\rVert_{2}\leq a_\ell C_{\theta,\ell}d_\ell(z,z')+b_\ell\left\lVert A_{\theta}^{(\ell)}(\nu)-A_{\theta}^{(\ell)}(\nu')\right\rVert_{2}. ϕ θ ( ℓ + 1 ) ( s ) − ϕ θ ( ℓ + 1 ) ( s ′ ) 2 ≤ a ℓ C θ , ℓ d ℓ ( z , z ′ ) + b ℓ A θ ( ℓ ) ( ν ) − A θ ( ℓ ) ( ν ′ ) 2 . Apply Lemma 46 to the second term. The resulting coefficients of d ℓ ( z , z ′ ) d_\ell(z,z') d ℓ ( z , z ′ ) and e ℓ ( ν , ν ′ ) e_\ell(\nu,\nu') e ℓ ( ν , ν ′ ) are bounded by C θ , ℓ + 1 C_{\theta,\ell+1} C θ , ℓ + 1 . Their sum is therefore at most C θ , ℓ + 1 d ℓ + 1 ( s , s ′ ) C_{\theta,\ell+1}d_{\ell+1}(s,s') C θ , ℓ + 1 d ℓ + 1 ( s , s ′ ) . The norm estimates in the same lemma give M θ , ℓ + 1 M_{\theta,\ell+1} M θ , ℓ + 1 . This completes the induction. Composition with the linear readout gives the final assertions.
Since a ℓ , b ℓ ≤ B W a_\ell,b_\ell\leq B_W a ℓ , b ℓ ≤ B W , ∥ b ( ℓ ) ∥ 2 ≤ B b \lVert b^{(\ell)}\rVert_{2}\leq B_b ∥ b ( ℓ ) ∥ 2 ≤ B b , ∥ W o u t ∥ 2 ≤ B o u t \lVert W_{\mathrm{out}}\rVert_{2}\leq B_{\mathrm{out}} ∥ W out ∥ 2 ≤ B out , and the architecture is fixed, these recursions yield uniform finite bounds
sup θ ∈ Θ B θ ≤ B , sup θ ∈ Θ ∥ ψ θ ∥ ∞ ≤ M , (104) \sup_{\theta\in\Theta}B_\theta\leq B,\qquad\sup_{\theta\in\Theta}\lVert\psi_\theta\rVert_{\infty}\leq M, \tag*{(104)} θ ∈ Θ sup B θ ≤ B , θ ∈ Θ sup ∥ ψ θ ∥ ∞ ≤ M , (104)
where we may choose M ≥ 1 M\geq1 M ≥ 1 . The constants do not depend on graph order.
Randomly Initialized Representations
We now extend the compactness and Lipschitz properties to representation laws induced by random node initialization. The resulting domain is totally bounded under the Wasserstein distance and therefore admits finite covers at every positive scale. Taking expectations of the MPNN outputs yields predictors on this domain that retain the deterministic Lipschitz certificates established above.
Compactness of the probability-measure domain
Lemma 48. If ( X , d ) (X,d) ( X , d ) is compact, then ( P ( X ) , W 1 ) (\mathcal{P}(X),W_1) ( P ( X ) , W 1 ) is compact.
Proof. We assume X ≠ ∅ X \ne\varnothing X = ∅ , since otherwise the claim is immediate. By Lemma 43 , every sequence in P ( X ) \mathcal{P}(X) P ( X ) has a weakly convergent subsequence. It remains to show that weak convergence implies convergence in W 1 W_1 W 1 . Fix x 0 ∈ X x_0 \in X x 0 ∈ X and let
T 0 = { f : X → R : Lip d ( f ) ≤ 1 , f ( x 0 ) = 0 } . \mathcal{T}_0 = \{f:X \to\mathbb{R}:\operatorname{Lip}_d(f) \le1,\ f(x_0)=0\}. T 0 = { f : X → R : Lip d ( f ) ≤ 1 , f ( x 0 ) = 0 } .
The functions in T 0 \mathcal{T}_0 T 0 are uniformly bounded by diam ( X ) \operatorname{diam}(X) diam ( X ) and equicontinuous. Since T 0 \mathcal{T}_0 T 0 is also closed under uniform convergence, it is compact in the uniform norm by Arzelà–Ascoli [23 Theorem 7.25] . Now suppose μ n \mu_n μ n converges weakly to μ \mu μ . Given a > 0 a>0 a > 0 , choose a finite a a a -net { f 1 , … , f N } \{f_1,\ldots,f_N\} { f 1 , … , f N } of T 0 \mathcal{T}_0 T 0 . Kantorovich–Rubinstein duality then gives
W 1 ( μ n , μ ) = sup f ∈ T 0 ∣ ∫ X f d μ n − ∫ X f d μ ∣ ≤ max 1 ≤ j ≤ N ∣ ∫ X f j d μ n − ∫ X f j d μ ∣ + 2 a . W_1(\mu_n,\mu)=\sup_{f\in\mathcal{T}_0}\left|\int_X f\,\mathrm{d}\mu_n-\int_X f\,\mathrm{d}\mu\right|
\le\max_{1\le j\le N}\left|\int_X f_j\,\mathrm{d}\mu_n-\int_X f_j\,\mathrm{d}\mu\right|+2a. W 1 ( μ n , μ ) = f ∈ T 0 sup ∫ X f d μ n − ∫ X f d μ ≤ 1 ≤ j ≤ N max ∫ X f j d μ n − ∫ X f j d μ + 2 a .
The maximum tends to zero by weak convergence, and a a a can be chosen arbitrarily small. Hence W 1 ( μ n , μ ) → 0 W_1(\mu_n,\mu)\to0 W 1 ( μ n , μ ) → 0 . Every sequence therefore has a W 1 W_1 W 1 -convergent subsequence, which proves compactness.
Applying this lemma to X D \mathcal{X}_D X D shows that P ( X D ) \mathcal{P}(\mathcal{X}_D) P ( X D ) is compact. Its subset Q D \mathcal{Q}_D Q D need not be compact, but it is totally bounded (i.e., admits a finite ε \varepsilon ε -cover for every ε > 0 \varepsilon>0 ε > 0 ).
Expected outputs and Lipschitzness
For ξ G ∼ ρ K ⊗ V ( G ) \xi^G\sim\rho_K^{\otimes V(G)} ξ G ∼ ρ K ⊗ V ( G ) , define
Q G , v ( D ) = Law ( η G , v ( D ) ( ξ G ) ) , Q G ( D ) = 1 ∣ V ( G ) ∣ ∑ v Q G , v ( D ) . Q_{G,v}^{(D)}=\operatorname{Law}(\eta_{G,v}^{(D)}(\xi^G)),\qquad Q_G^{(D)}=\frac{1}{|V(G)|}\sum_v Q_{G,v}^{(D)}. Q G , v ( D ) = Law ( η G , v ( D ) ( ξ G )) , Q G ( D ) = ∣ V ( G ) ∣ 1 v ∑ Q G , v ( D ) .
These laws are well defined by the measurability established in § 18 .§ 3 . Moreover, Q G ( D ) Q_G^{(D)} Q G ( D ) is the mean of the random measure R G , ξ G ( D ) R_{G,\xi^G}^{(D)} R G , ξ G ( D ) , in the sense that
∫ f d Q G ( D ) = E [ ∫ f d R G , ξ G ( D ) ] \int f\,\mathrm{d}Q_G^{(D)}=\mathbb{E}\left[\int f\,\mathrm{d}R_{G,\xi^G}^{(D)}\right] ∫ f d Q G ( D ) = E [ ∫ f d R G , ξ G ( D ) ]
for every bounded measurable f f f .
By Lemma 45 ,
F θ ( G , x ) = ∫ ψ θ d R G , x ( D ) . F_\theta(G,x)=\int\psi_\theta\,\mathrm{d}R_{G,x}^{(D)}. F θ ( G , x ) = ∫ ψ θ d R G , x ( D ) .
The boundedness of ψ θ \psi_\theta ψ θ permits exchanging expectation and the finite vertex sum, giving
F ‾ θ ( G ) = E [ F θ ( G , ξ G ) ] = ∫ ψ θ d Q G ( D ) = F θ ( Q G ( D ) ) . \overline{F}_\theta(G)=\mathbb{E}[F_\theta(G,\xi^G)]=\int\psi_\theta\,\mathrm{d}Q_G^{(D)}=F_\theta(Q_G^{(D)}). F θ ( G ) = E [ F θ ( G , ξ G )] = ∫ ψ θ d Q G ( D ) = F θ ( Q G ( D ) ) .
For Q , Q ′ ∈ P ( X D ) Q,Q'\in\mathcal{P}(\mathcal{X}_D) Q , Q ′ ∈ P ( X D ) and any coupling π ∈ Π ( Q , Q ′ ) \pi\in\Pi(Q,Q') π ∈ Π ( Q , Q ′ ) ,
∣ F θ ( Q ) − F θ ( Q ′ ) ∣ = ∣ ∫ ( ψ θ ( z ) − ψ θ ( z ′ ) ) d π ( z , z ′ ) ∣ ≤ B θ ∫ d D ( z , z ′ ) d π ( z , z ′ ) . \left|F_\theta(Q)-F_\theta(Q')\right|
=\left|\int(\psi_\theta(z)-\psi_\theta(z'))\,\mathrm{d}\pi(z,z')\right|
\le B_\theta\int d_D(z,z')\,\mathrm{d}\pi(z,z'). ∣ F θ ( Q ) − F θ ( Q ′ ) ∣ = ∫ ( ψ θ ( z ) − ψ θ ( z ′ )) d π ( z , z ′ ) ≤ B θ ∫ d D ( z , z ′ ) d π ( z , z ′ ) .
Thus, averaging preserves the certificate B θ B_\theta B θ , with Lipschitz continuity now measured with respect to W 1 W_1 W 1 on probability measures and absolute value on scalar outputs. The same argument gives
∣ F θ ( G , x ) − F θ ( G ′ , x ′ ) ∣ ≤ B θ d D g r a p h ( ( G , x ) , ( G ′ , x ′ ) ) . \left|F_\theta(G,x)-F_\theta(G',x')\right| \le B_\theta d_D^{\mathrm{graph}}\left((G,x),(G',x')\right). ∣ F θ ( G , x ) − F θ ( G ′ , x ′ ) ∣ ≤ B θ d D graph ( ( G , x ) , ( G ′ , x ′ ) ) .
On graphs without specified initializations, define
d D r a n d ( G , G ′ ) : = W 1 ( Q G ( D ) , Q G ′ ( D ) ) . d_D^{\mathrm{rand}}(G,G') := W_1\left(Q_G^{(D)},Q_{G'}^{(D)}\right). d D rand ( G , G ′ ) := W 1 ( Q G ( D ) , Q G ′ ( D ) ) .
This is a pseudometric, and
∣ F θ ‾ ( G ) − F θ ‾ ( G ′ ) ∣ ≤ B θ d D r a n d ( G , G ′ ) . \left|\overline{F_\theta}(G)-\overline{F_\theta}(G')\right| \le B_\theta d_D^{\mathrm{rand}}(G,G'). F θ ( G ) − F θ ( G ′ ) ≤ B θ d D rand ( G , G ′ ) .
Relabeling a graph permutes its node representations and preserves the i.i.d. initialization law. Hence Q G ( D ) Q_G^{(D)} Q G ( D ) and F θ ‾ ( G ) \overline{F_\theta}(G) F θ ( G ) are invariant under vertex relabeling.
Uniform Monte Carlo Approximation
Fix training graphs G 1 , … , G n G_1,\ldots,G_n G 1 , … , G n and write Q i = Q G i ( D ) Q_i=Q_{G_i}^{(D)} Q i = Q G i ( D ) . For each graph, the S S S initializations are independent and have law ρ K ⊗ V ( G i ) \rho_K^{\otimes V(G_i)} ρ K ⊗ V ( G i ) . The following argument is conditional on the training graphs and does not require them to form a cover. Dependence between node representations within an initialization is allowed.
Let Ψ = { ψ θ : θ ∈ Θ } \Psi=\{\psi_\theta:\theta\in\Theta\} Ψ = { ψ θ : θ ∈ Θ } . By Equation (104) ,
sup θ ∈ Θ ∥ ψ θ ∥ ∞ ≤ M , sup θ ∈ Θ Lip d D ( ψ θ ) ≤ B , \sup_{\theta\in\Theta}\|\psi_\theta\|_\infty\le M,\qquad\sup_{\theta\in\Theta}\operatorname{Lip}_{d_D}(\psi_\theta)\le B, θ ∈ Θ sup ∥ ψ θ ∥ ∞ ≤ M , θ ∈ Θ sup Lip d D ( ψ θ ) ≤ B ,
where M ≥ 1 M\ge1 M ≥ 1 and B < ∞ B<\infty B < ∞ depend only on the fixed architecture, feature space, and weight and bias bounds. Thus, Ψ \Psi Ψ is uniformly bounded and equicontinuous on the compact space X D \mathcal{X}_D X D . Arzelà–Ascoli ([23 Theorem 7.25] ) implies total boundedness in the uniform norm. For a > 0 a>0 a > 0 , let
N Ψ ( a ) : = N ( Ψ , ∥ ⋅ ∥ ∞ , a ) , N_\Psi(a):=N(\Psi,\|\cdot\|_\infty,a), N Ψ ( a ) := N ( Ψ , ∥ ⋅ ∥ ∞ , a ) ,
with covering centers chosen in Ψ \Psi Ψ . The class Ψ \Psi Ψ is separable in the uniform norm, and the sampling deviation is continuous in this norm, so its supremum over Ψ \Psi Ψ is measurable.
Proposition 49 (Uniform sampling bound). For every a , t > 0 a,t>0 a , t > 0 ,
P ( sup θ ∈ Θ max 1 ≤ i ≤ n ∣ F ^ θ , S ( G i ) − F θ ‾ ( G i ) ∣ > 2 a + t ) ≤ 2 n N Ψ ( a ) exp ( − S t 2 2 M 2 ) . \mathbb{P}\left(\sup_{\theta\in\Theta}\max_{1\le i\le n}\left|\widehat{F}_{\theta,S}(G_i)-\overline{F_\theta}(G_i)\right|>2a+t\right)\le2nN_\Psi(a)\exp\left(-\frac{St^2}{2M^2}\right). P ( θ ∈ Θ sup 1 ≤ i ≤ n max F θ , S ( G i ) − F θ ( G i ) > 2 a + t ) ≤ 2 n N Ψ ( a ) exp ( − 2 M 2 S t 2 ) .
Proof. Choose an a a a -net ψ 1 , … , ψ N \psi_1,\ldots,\psi_N ψ 1 , … , ψ N of Ψ \Psi Ψ , with N = N Ψ ( a ) N=N_\Psi(a) N = N Ψ ( a ) , and define
Y i , s , j = 1 ∣ V ( G i ) ∣ ∑ v ∈ V ( G i ) ψ j ( η N G i , v ( D ) ( ξ i , s G i ) ) . Y_{i,s,j}=\frac{1}{|V(G_i)|}\sum_{v\in V(G_i)}\psi_j\left(\eta_{N_{G_i,v}^{(D)}}\left(\xi_{i,s}^{G_i}\right)\right). Y i , s , j = ∣ V ( G i ) ∣ 1 v ∈ V ( G i ) ∑ ψ j ( η N G i , v ( D ) ( ξ i , s G i ) ) .
For fixed i , j i,j i , j , these variables are independent over s s s , belong to [ − M , M ] [-M,M] [ − M , M ] , and satisfy
E [ Y i , s , j ] = ∫ ψ j d Q i . \mathbb{E}[Y_{i,s,j}]=\int\psi_j\,dQ_i. E [ Y i , s , j ] = ∫ ψ j d Q i .
Hoeffding’s inequality gives
P ( ∣ 1 S ∑ s = 1 S Y i , s , j − ∫ ψ j d Q i ∣ > t ) ≤ 2 exp ( − S t 2 2 M 2 ) . \mathbb{P}\left(\left|\frac{1}{S}\sum_{s=1}^{S}Y_{i,s,j}-\int\psi_j\,dQ_i\right|>t\right)\le2\exp\left(-\frac{St^2}{2M^2}\right). P ( S 1 s = 1 ∑ S Y i , s , j − ∫ ψ j d Q i > t ) ≤ 2 exp ( − 2 M 2 S t 2 ) .
A union bound makes this estimate simultaneous over all i , j i,j i , j , with failure probability at most 2 n N Ψ ( a ) exp ( − S t 2 / ( 2 M 2 ) ) 2nN_\Psi(a)\exp(-St^2/(2M^2)) 2 n N Ψ ( a ) exp ( − S t 2 / ( 2 M 2 )) .
For any θ \theta θ , choose j j j such that ∥ ψ θ − ψ j ∥ ∞ ≤ a \|\psi_\theta-\psi_j\|_\infty\le a ∥ ψ θ − ψ j ∥ ∞ ≤ a . Replacing ψ θ \psi_\theta ψ θ by ψ j \psi_j ψ j changes its sampled graph-level average by at most a a a and its expectation by at most a a a . Hence, on the simultaneous event,
∣ F ^ θ , S ( G i ) − F θ ‾ ( G i ) ∣ ≤ 2 a + t \left|\widehat{F}_{\theta,S}(G_i)-\overline{F_\theta}(G_i)\right|\le2a+t F θ , S ( G i ) − F θ ( G i ) ≤ 2 a + t
for every θ \theta θ and i i i .
Taking a = ε M C / 4 a=\varepsilon_{\mathrm{MC}}/4 a = ε MC /4 and t = ε M C / 2 t=\varepsilon_{\mathrm{MC}}/2 t = ε MC /2 , a sufficient sample size is
S ≥ 8 M 2 ε M C 2 log ( 2 n N Ψ ( ε M C / 4 ) δ ) . (105) S \geq\frac{8M^2}{\varepsilon_{\mathrm{MC}}^2}\log\left(\frac{2nN_{\Psi}(\varepsilon_{\mathrm{MC}}/4)}{\delta}\right). \tag*{(105)} S ≥ ε MC 2 8 M 2 log ( δ 2 n N Ψ ( ε MC /4 ) ) . (105)
With probability at least 1 − δ 1-\delta 1 − δ , this ensures
sup θ ∈ Θ max 1 ≤ i ≤ n ∣ F ^ θ , S ( G i ) − F ‾ θ ( G i ) ∣ ≤ ε M C . \sup_{\theta\in\Theta}\max_{1\leq i\leq n}\left|\widehat{F}_{\theta,S}(G_i)-\overline{F}_{\theta}(G_i)\right|\leq\varepsilon_{\mathrm{MC}}. θ ∈ Θ sup 1 ≤ i ≤ n max F θ , S ( G i ) − F θ ( G i ) ≤ ε MC .
Since ∣ ∣ a − y ∣ − ∣ b − y ∣ ∣ ≤ ∣ a − b ∣ \left||a-y|-|b-y|\right|\leq|a-b| ∣ ∣ a − y ∣ − ∣ b − y ∣ ∣ ≤ ∣ a − b ∣ , averaging over the training graphs yields
P ( sup θ ∈ Θ ∣ L ^ e m p ( θ ) − L ‾ e m p ( θ ) ∣ ≤ ε M C ) ≥ 1 − δ . (106) \mathbb{P}\left(\sup_{\theta\in\Theta}\left|\widehat{\mathcal{L}}_{\mathrm{emp}}(\theta)-\overline{\mathcal{L}}_{\mathrm{emp}}(\theta)\right|\leq\varepsilon_{\mathrm{MC}}\right)\geq1-\delta. \tag*{(106)} P ( θ ∈ Θ sup L emp ( θ ) − L emp ( θ ) ≤ ε MC ) ≥ 1 − δ . (106)
The same bound holds for the regularized losses because their regularizers coincide.
Proof of Learnability Guarantee
Below we prove Theorem 11 from the main paper. For fixed training graphs G 1 , … , G n G_1,\ldots,G_n G 1 , … , G n , we recall the definitions
L e m p ( θ ) : = 1 n ∑ i = 1 n ∣ F ‾ θ ( G i ) − f ∗ ( G i ) ∣ , L r e g ( θ ) : = L e m p ( θ ) + λ ( B θ − B ∗ ) + . \mathcal{L}_{\mathrm{emp}}(\theta):=\frac{1}{n}\sum_{i=1}^{n}\left|\overline{F}_{\theta}(G_i)-f^*(G_i)\right|,\qquad\mathcal{L}_{\mathrm{reg}}(\theta):=\mathcal{L}_{\mathrm{emp}}(\theta)+\lambda(B_{\theta}-B_*)_+. L emp ( θ ) := n 1 i = 1 ∑ n F θ ( G i ) − f ∗ ( G i ) , L reg ( θ ) := L emp ( θ ) + λ ( B θ − B ∗ ) + .
We also write
L ^ e m p ( θ ) : = 1 n ∑ i = 1 n ∣ F ^ θ , S ( G i ) − f ∗ ( G i ) ∣ . \widehat{\mathcal{L}}_{\mathrm{emp}}(\theta):=\frac{1}{n}\sum_{i=1}^{n}\left|\widehat{F}_{\theta,S}(G_i)-f^*(G_i)\right|. L emp ( θ ) := n 1 i = 1 ∑ n F θ , S ( G i ) − f ∗ ( G i ) .
Note that L ^ r e g \widehat{\mathcal{L}}_{\mathrm{reg}} L reg and L r e g \mathcal{L}_{\mathrm{reg}} L reg use the same regularizer since the Lipschitz certificate only depends on the parameters of the MPNN and not on the initialization of node features.
Proof. Fix ε > 0 \varepsilon>0 ε > 0 and δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) , and set
r = ε 2 ( 2 B ∗ + 1 ) . r=\frac{\varepsilon}{2(2B_*+1)}. r = 2 ( 2 B ∗ + 1 ) ε .
By total boundedness of ( G , d D r a n d ) (\mathcal{G},d_D^{\mathrm{rand}}) ( G , d D rand ) , choose a finite r r r -net { G 1 , … , G n } ⊆ G \{G_1,\ldots,G_n\}\subseteq\mathcal{G} { G 1 , … , G n } ⊆ G . For every G ∈ G G\in\mathcal{G} G ∈ G , there is an index i i i such that d D r a n d ( G , G i ) ≤ r d_D^{\mathrm{rand}}(G,G_i)\leq r d D rand ( G , G i ) ≤ r . The triangle inequality and the Lipschitz bounds give
∣ F ‾ θ ( G ) − f ∗ ( G ) ∣ ≤ ∣ F ‾ θ ( G ) − F ‾ θ ( G i ) ∣ + ∣ F ‾ θ ( G i ) − f ∗ ( G i ) ∣ + ∣ f ∗ ( G i ) − f ∗ ( G ) ∣ ≤ ( B θ + B ∗ ) r + n L e m p ( θ ) . \begin{aligned}
\left|\overline{F}_{\theta}(G)-f^*(G)\right|
\leq\left|\overline{F}_{\theta}(G)-\overline{F}_{\theta}(G_i)\right|+\left|\overline{F}_{\theta}(G_i)-f^*(G_i)\right|+\left|f^*(G_i)-f^*(G)\right| \\
&\leq(B_{\theta}+B_*)r+n\mathcal{L}_{\mathrm{emp}}(\theta).
\end{aligned} F θ ( G ) − f ∗ ( G ) ≤ F θ ( G ) − F θ ( G i ) + F θ ( G i ) − f ∗ ( G i ) + ∣ f ∗ ( G i ) − f ∗ ( G ) ∣ ≤ ( B θ + B ∗ ) r + n L emp ( θ ) .
Choose
η = min { λ , ε 4 n } , ε M C = η 2 . \eta=\min\left\{\lambda,\frac{\varepsilon}{4n}\right\},\qquad\varepsilon_{\mathrm{MC}}=\frac{\eta}{2}. η = min { λ , 4 n ε } , ε MC = 2 η .
By the uniform Monte Carlo bound proved in § 21 , every S S S satisfying Equation (105) gives an event of probability at least 1 − δ 1-\delta 1 − δ on which
sup θ ∈ Θ ∣ L ^ e m p ( θ ) − L e m p ( θ ) ∣ ≤ η 2 . \sup_{\theta\in\Theta}\left|\widehat{\mathcal{L}}_{\mathrm{emp}}(\theta)-\mathcal{L}_{\mathrm{emp}}(\theta)\right|\leq\frac{\eta}{2}. θ ∈ Θ sup L emp ( θ ) − L emp ( θ ) ≤ 2 η .
On this event, any θ \theta θ with L ^ r e g ( θ ) < η \widehat{\mathcal{L}}_{\mathrm{reg}}(\theta)<\eta L reg ( θ ) < η satisfies
L e m p ( θ ) ≤ L ^ e m p ( θ ) + η 2 < 3 η 2 , B θ ≤ B ∗ + η λ . \mathcal{L}_{\mathrm{emp}}(\theta)\leq\widehat{\mathcal{L}}_{\mathrm{emp}}(\theta)+\frac{\eta}{2}<\frac{3\eta}{2},\qquad B_{\theta}\leq B_*+\frac{\eta}{\lambda}. L emp ( θ ) ≤ L emp ( θ ) + 2 η < 2 3 η , B θ ≤ B ∗ + λ η .
Consequently,
sup G ∈ G ∣ F ‾ θ ( G ) − f ∗ ( G ) ∣ ≤ 3 n η 2 + ( 2 B ∗ + η λ ) r ≤ 3 ε 8 + ε 2 < ε . \sup_{G\in\mathcal{G}}\left|\overline{F}_{\theta}(G)-f^*(G)\right|
\leq\frac{3n\eta}{2}+\left(2B_*+\frac{\eta}{\lambda}\right)r
\leq\frac{3\varepsilon}{8}+\frac{\varepsilon}{2}<\varepsilon. G ∈ G sup F θ ( G ) − f ∗ ( G ) ≤ 2 3 n η + ( 2 B ∗ + λ η ) r ≤ 8 3 ε + 2 ε < ε .
Experimental details
Computing infrastructure. Experiments ran on a shared server using three NVIDIA RTX A6000 GPUs (48 GB each) and two AMD EPYC 7452 32-core CPUs. We used PyTorch 2.9.1 with CUDA 12.8, running each training fit on a single GPU and independent fits in parallel.
Asset licenses. The GNN-RNI repository providing EXP includes a GNU GPLv3 license, with no separate dataset license stated. The pinned k-gnn and random-features (TRIANGLE) releases contain no explicit license statement. Our reproduction scripts fetch third-party code and data directly from these repositories.
Bridge prediction
Data and targets. We sample graphs from G ( n , 1.5 / ( n − 1 ) ) G(n, 1.5/(n-1)) G ( n , 1.5/ ( n − 1 )) , allowing disconnected graphs. Training and validation each contain equal numbers of graphs at n = 16 , 32 n=16,32 n = 16 , 32 ; independent test splits use n ∈ { 32 , 128 , 512 } n \in\{32, 128, 512\} n ∈ { 32 , 128 , 512 } . For each target b ∈ { 4 , 5 , 6 } b \in\{4,5,6\} b ∈ { 4 , 5 , 6 } , an edge is positive exactly when it is a bridge whose removal leaves a smaller endpoint component of size b b b ; every other edge is negative, including bridges of other sizes. We retain every sampled graph and extend splits to obtain at least 1,000 training positives and 200 per evaluation split (Table 2 ). All palettes and training seeds share the data for their target.
Table 2. Bridge datasets: graph count / positive-edge count.
Model and training. Each trial assigns independent uniform colors from q ∈ { 2 , 4 , 16 , 32 } q \in\{2,4,16,32\} q ∈ { 2 , 4 , 16 , 32 } , encoded as one-hot vectors padded to 32 coordinates for every palette. The six-layer, width-32 ReLU MPNN uses max aggregation and a symmetric two-layer edge head, with 22,305 trainable parameters in every condition. Training averages 16 sigmoid-probability trials before class-balanced binary cross-entropy over pooled edges. We sample graphs uniformly with replacement in batches of eight and use Adam at 10 − 3 10^{-3} 1 0 − 3 without weight decay for 100,000 updates, without early stopping. We select checkpoints by lowest validation balanced error. Each target and palette uses five training seeds, varying initialization, minibatches, and training colors.
Evaluation and reporting. Test inference averages 16 fresh trials and thresholds at 1 / 2 1/2 1/2 ; validation and test color streams are fixed and shared across fits. FNR pools positive edges across test graphs, while FPR pools all negative edges, including wrong-size bridges. Figure 2 reports balanced accuracy, 100 [ 1 − ( F N R + F P R ) / 2 ] 100[1-(\mathrm{FNR}+\mathrm{FPR})/2] 100 [ 1 − ( FNR + FPR ) /2 ] , and Table 3 reports its complementary error. Standard errors (SEs) equal the sample standard deviation across five training seeds divided by 5 \sqrt{5} 5 , conditional on the fixed dataset. Table 4 exposes confusion hidden by pooled balanced error: at b = 6 , q = 32 , n = 512 b=6,q=32,n=512 b = 6 , q = 32 , n = 512 , FPRs on side-5 and side-7 bridges are 70.5% and 92.8%, and precision is 13.5%, despite 6.41% balanced error. The learned detectors are motivated by the local MST construction but do not implement its algorithm.
Table 3. Exact-side bridge detection: balanced test error (%), mean ± \pm ± SE across five training seeds.
Table 4. Neighboring-side false-positive rates and overall precision (%) at n = 512 n = 512 n = 512 , averaged over five training seeds. Bridges of sizes b − 1 b - 1 b − 1 and b + 1 b + 1 b + 1 are negatives for target b b b ; precision is the fraction of predicted positives with the correct label.
Tree substructure detection
Data and exact labels. The fixed ten-vertex pattern has a root with three children and two leaves per child. In a simple 3-regular graph, it embeds as a non-induced subgraph rooted at v v v exactly when the closed two-hop ball around v v v has ten vertices; edges between the six leaves are allowed. We sample connected random 3-regular graphs on 24 vertices, rejecting isomorphic duplicates within and across splits. We use 256 training, 64 validation, and 1,000 test graphs, with 4,096, 1,024, and 16,000 selected root vertices, respectively, balanced exactly by label within each split. Graphs are split before roots are selected; models receive full graphs, and all fits share the splits. Evaluation tests unseen graphs of the same size.
Model and training. We use two width-32 residual ReLU message-passing layers with max aggregation and a vertex MLP, without graph pooling. Independent uniform one-hot colors are projected to the hidden space; hidden widths are fixed, but the input projection grows with the palette. We train all combinations of q ∈ { 2 , 8 , 64 } q \in\{2, 8, 64\} q ∈ { 2 , 8 , 64 } colors and s ∈ { 1 , 16 , 64 } s \in\{1, 16, 64\} s ∈ { 1 , 16 , 64 } trials with five training seeds. The models have 5,345, 5,537, and 7,329 trainable parameters for q = 2 , 8 , 64 q = 2, 8, 64 q = 2 , 8 , 64 , respectively, independent of trial count. Training uses binary cross-entropy on each root’s maximum trial logit, fresh colors, and Adam at 10 − 3 10^{-3} 1 0 − 3 without weight decay. Each update samples 32 roots per class with replacement. We allow up to 200,000 updates, stopping after 25,000 updates without improved validation max-trial cross-entropy, assessed every 250 updates. We select the checkpoint minimizing this loss.
Inference and reporting. Let z v ( r ) z_v^{(r)} z v ( r ) be the logit at vertex v v v in trial r r r , and let σ \sigma σ denote the sigmoid function. At inference, we sum trial probabilities and predict
a v = ∑ r = 1 s σ ( z v ( r ) ) , y ^ v = 1 { a v > τ } . a_v = \sum_{r=1}^{s} \sigma(z_v^{(r)}), \qquad\hat{y}_v = \mathbf{1}\{a_v > \tau\}. a v = r = 1 ∑ s σ ( z v ( r ) ) , y ^ v = 1 { a v > τ } .
Thus, a vertex is predicted to have the maximum two-hop neighborhood size of ten exactly when its summed score exceeds the threshold τ \tau τ ; otherwise it is predicted negative. We choose τ \tau τ separately for each trained model to minimize validation classification error and hold it fixed on the test set. Evaluation color streams are fixed across training seeds. Figure 3 reports mean node accuracy ± \pm ± SE across five seeds on the fixed, balanced test set; Table 5 retains individual errors, including the variation at ( q , s ) = ( 8 , 64 ) (q, s) = (8, 64) ( q , s ) = ( 8 , 64 ) . These learned detectors do not implement the exact color-coding dynamic program or require colorful witnesses.
Table 5. Tree detection test error (%) for each training seed, with q q q colors and s s s trials. All models use the same 16,000 labeled roots on 1,000 unseen graphs.
Inference-time quantization
EXP data and model. We use the released EXP dataset [1 ] : 1,200 graphs on 32–64 vertices, in 600 oppositely labeled, 1-WL-indistinguishable pairs. The released ten-fold splits contain 972 training, 108 validation, and 120 test graphs per fold, with balanced labels and pairs kept together. This is held-out classification, not size extrapolation. Our GCN-RNI reimplementation uses eight width-64 mean-neighbor layers, separate root transforms, ELU, max graph pooling, and an MLP classifier. Inputs are 64 independent Unif[−1, 1) coordinates, or one followed by 63 zeros, keeping the architecture fixed at 72,354 trainable parameters. Original vertex labels are not inputs.
EXP training. We use Adam at 5 ⋅ 10 − 4 5 \cdot10^{-4} 5 ⋅ 1 0 − 4 , batches of 20, negative log-likelihood, and 500 epochs, with one fresh feature draw per prediction and final checkpoints. We follow the paper’s ELU rather than the released script’s tanh default, and use its Gaussian-input learning rate because no separate uniform-input rate is reported.
TRIANGLE data and model. The released TRIANGLE data [24 ] contain 1,000 20-vertex 3-regular training graphs and 1,000 test graphs at each of 20 and 100 vertices. Labels indicate triangle membership, with original class frequencies retained. Following rGIN, we use four width-64 layers with sum aggregation including the root, MLP updates, batch normalization, ReLU, and a vertex classifier, totaling 30,930 trainable parameters. We replace its 100-value random scalar with a fresh independent Unif[0, 1) scalar per vertex; no other vertex features are supplied.
TRIANGLE training. We train one model for 17,500 Adam updates (350 epochs), with batches of 32 graphs and learning rate 0.01, halved every 50 epochs. We retain the upstream cross-entropy on softmax outputs, weighted inversely by class frequency. Training uses one trial per prediction; evaluation uses the final checkpoint without test-based selection.
Frozen-model evaluation. Continuous and quantized conditions share feature draws and test graphs, with weights and batch-normalization statistics fixed. We average metrics from single-trial predictions, not predictions across trials. EXP quantizes each active coordinate to − 1 / 2 -1/2 − 1/2 or 1 / 2 1/2 1/2 according to its sign; each fold averages argmax classification accuracy over 50 draws. We report mean accuracy and descriptive SE across ten fold means, whose training sets overlap. TRIANGLE uses Q q ( u ) = ( ⌊ q u ⌋ + 1 / 2 ) / q Q_q(u)=(\lfloor qu \rfloor+1/2)/q Q q ( u ) = (⌊ q u ⌋ + 1/2 ) / q and reports mean one-versus-rest ROC-AUC over both classes. Its mean and SE use ten paired feature draws of one trained model, not multiple training seeds. Both SEs are sample SD divided by 10 \sqrt{10} 10 . The exploratory palette sweep in Figure 7 shows close agreement with continuous inputs for q ≥ 4 q \ge4 q ≥ 4 , with nonmonotonic behavior at smaller palettes.
(a) 20 vertices
(b) 100 vertices
Figure 7. TRIANGLE inference-time quantization of one frozen rGIN trained with continuous features on 20-vertex cubic graphs. Test sets contain 1,000 graphs at each size. Points and error bars show mean ROC-AUC ± \pm ± SE across ten paired single-trial feature draws; squares and dashed lines mark the continuous baseline. The axis break omits 51–86% ROC-AUC. These error bars do not measure training-seed variability.