On the approximation capability of GNNs in node classification/regression tasks
Giuseppe Alessio D'Inverno, Monica Bianchini, Maria Lucia Sampoli, Franco Scarselli
TL;DR
This work tackles the limitations of prior universal-approximation results for GNNs by focusing on node-focused tasks and providing a constructive, probability-based universality framework. It shows that GNNs can approximate any measurable function that preserves the $1$-WL equivalence, with a tight depth bound of $2r-1$ iterations (where $r$ is the maximum graph size), and furnishes a method to encode unfolding trees into node features to guide architecture design. A formal equivalence is established between unfolding trees and WL color refinement, enabling a unified view of GNN expressiveness for nodes and graphs, and the results extend to GNNs with universal components, yielding density-type guarantees. Experimental validation using Graph Isomorphism Networks on QM9-derived datasets corroborates the theory, demonstrating high-accuracy approximation of WL-based targets and illustrating the practical relevance for node-level reasoning.
Abstract
Graph Neural Networks (GNNs) are a broad class of connectionist models for graph processing. Recent studies have shown that GNNs can approximate any function on graphs, modulo the equivalence relation on graphs defined by the Weisfeiler--Lehman (WL) test. However, these results suffer from some limitations, both because they were derived using the Stone--Weierstrass theorem -- which is existential in nature, -- and because they assume that the target function to be approximated must be continuous. Furthermore, all current results are dedicated to graph classification/regression tasks, where the GNN must produce a single output for the whole graph, while also node classification/regression problems, in which an output is returned for each node, are very common. In this paper, we propose an alternative way to demonstrate the approximation capability of GNNs that overcomes these limitations. Indeed, we show that GNNs are universal approximators in probability for node classification/regression tasks, as they can approximate any measurable function that satisfies the 1--WL equivalence on nodes. The proposed theoretical framework allows the approximation of generic discontinuous target functions and also suggests the GNN architecture that can reach a desired approximation. In addition, we provide a bound on the number of the GNN layers required to achieve the desired degree of approximation, namely $2r-1$, where $r$ is the maximum number of nodes for the graphs in the domain.
