On the Computational Capability of Graph Neural Networks: A Circuit Complexity Bound Perspective
Graph Neural Networks (GNNs) have become the standard approach for learning and reasoning over relational data, leveraging the message-passing mechanism that iteratively propagates node embeddings through graph structures. While GNNs have achieved significant empirical success, their theoretical limitations remain an active area of research. Existing studies primarily focus on characterizing GNN expressiveness through Weisfeiler-Lehman (WL) graph isomorphism tests. In this paper, we take a fundamentally different approach by exploring the computational limitations of GNNs through the lens of circuit complexity. Specifically, we analyze the circuit complexity of common GNN architectures and prove that under constraints of constant-depth layers, linear or sublinear embedding sizes, and polynomial precision, GNNs cannot solve key problems such as graph connectivity and graph isomorphism unless . These results reveal the intrinsic expressivity limitations of GNNs behind their empirical success and introduce a novel framework for analyzing GNN expressiveness that can be extended to a broader range of GNN models and graph decision problems.
1 Introduction
Graphs are ubiquitous representations for relational data, describing interconnected elements with interactions in domains such as molecules [21, 51], social networks [17, 41], and user-item interactions in recommendation systems [46, 23]. Graph Neural Networks (GNNs) [25, 24, 44] have emerged as a dominant tool for learning expressive representations from graphs, enabling tasks like node property prediction [49, 3], link prediction [54, 58], and graph classification [55, 52]. The key to GNNs’ success lies in the message-passing mechanism [21], which aggregates information from local neighborhoods through a graph convolution matrix, followed by nonlinear transformations to update node representations.
Despite their empirical success, concerns regarding the computational limitations of GNNs are emerging [19, 50]. A fundamental research question arises from the concern:
What computational capabilities do GNNs and their variants possess, and what classes of problems can they provably solve?
Addressing these questions is crucial for understanding GNNs from a principled and theoretically robust perspective, identifying their limitations, and building trust in their deployment for real-world applications.
Previous work has made significant strides in addressing these questions. A notable line of research connects GNN expressiveness to the Weisfeiler-Leman (WL) graph isomorphism test [52, 31, 32, 57], which iteratively refines color labels on -tuples of nodes (known as -WL) and distinguishes graphs by the resulting color histograms. For example, the Graph Isomorphism Network (GIN) [52] equipped with summation aggregator and injective readout function is as expressive as -WL, while -GNNs [31] achieve expressiveness equivalent to -WL by encoding -node subgraphs as hypernodes in message passing. However, these results focus on graph isomorphism tasks and do not address a broader range of graph query problems. Moreover, the WL framework only provides a specific level of expressiveness without establishing the theoretical upper bounds, and it often ignores the interplay between node features and graph topology, which is central to GNNs.
In this paper, we take a fundamentally different approach to analyzing the computational limitations of GNNs by examining the circuit complexity bounds. Circuit complexity [22, 38, 45] is a foundational topic in theoretical computer science, characterizing computational models based on the types of Boolean gates they use and the depth and size of their circuits. Importantly, circuit complexity bounds provably reflect the set of problems solvable within a given model. For instance, models (e.g., Transformers) bounded by the complexity class can only solve problems (e.g., Dyck language recognition) but cannot solve -complete problems like arithmetic formula evaluation unless [8, 33, 34]. Analogously, if we demonstrate that GNN computations lie within a particular circuit complexity class, we can formally identify problems that GNNs can solve and cannot solve.
Our approach evaluates the circuit complexity of GNN components, from basic activation functions to the entire graph convolution process. We show that GNNs with a constant number of layers, precision, and embedding sizes can be approximated by uniform circuits. Consequently, unless , such GNNs cannot solve problems like graph connectivity problems or graph isomorphism problems. These findings illuminate the fundamental expressivity limitations of GNNs despite their empirical success and also establish a novel framework for analyzing their expressiveness, which can be seamlessly generalized to more GNN models and decision problems on graphs.
Our contributions are summarized as follows:
-
•
We prove that a uniform circuit family can approximate GNNs with a constant number of layers, precision, and embedding size (Theorem 4.14).
- •
-
•
We establish that unless , graph neural networks with a constant number of layers, precision and embedding size cannot solve the graph isomorphism problems (Theorem 5.13).
2 Related Work
We present related works on the computational limitation of GNNs and existing circuit complexity bounds for neural networks.
2.1 Limitations of Graph Neural Networks
Graph Neural Networks (GNNs) have demonstrated impressive performance on graph learning and mining tasks. However, their inherent limitations in solving decision problems on graphs remain an open question. The predominant framework for analyzing GNN limitations is the Weisfeiler-Lehman (WL) hierarchy [29, 40, 57], a well-established tool for assessing GNNs’ ability to address the graph isomorphism problem—an NP-intermediate problem not solvable in polynomial time [2, 20]. The WL hierarchy leverages the computationally efficient heuristic of color refinement to bound the capability of differentiating non-isomorphic graphs.
The expressiveness of message-passing GNNs is bounded by the -WL test [52]. Standard GNN models such as GCN [25], GAT [44], and GIN [52] are either equivalent to or strictly limited by the expressiveness of -WL. To go beyond -WL, high-order GNNs extend message-passing mechanisms to -node subgraphs [31, 32, 30], mimicking the -WL or -FWL (Folklore WL) tests. Models like -GNN and -FGNN match the expressiveness of these higher-order tests, offering stronger guarantees than standard message-passing GNNs. However, the parameter cannot be scaled to sufficiently large values due to inherent computational and memory constraints.
Another promising line of research involves subgraph GNNs, which aim to address the inherent symmetry of graphs that cannot be distinguished by WL tests. These models transform the original graph into a set of slightly perturbed subgraphs, which are then processed by GNNs [12, 36, 37]. Recent work has shown that for an -node graph, subgraph GNNs operating on subgraphs with nodes are strictly bounded by -FWL [37]. Besides, distance-aware GNNs inject distance information—overlooked by both message-passing GNNs and -WL—into their architectures. For instance, -hop MPNNs aggregate information from -hop neighbors in each layer and have been shown to be strictly bounded by -FWL [16]. Additionally, the subgraph WL hierarchy demonstrates that distance encoding can be represented by local -WL tests [56].
Despite the widespread use of the WL framework in analyzing GNNs’ computational limitations, it often overlooks the role of node features [7] and focuses exclusively on the graph isomorphism problem, making it insufficiently comprehensive and unsuitable for generalizing to other graph decision problems. A detailed comparison of our work with WL-based GNN expressiveness is provided in Section 5.4.
2.2 Circuit Complexity and Neural Networks
Circuit complexity, a foundational area in theoretical computer science, studies the computational power of Boolean circuit families. Various circuit complexity classes play a significant role in analyzing machine learning models. For instance, the class represents problems solvable in parallel using standard Boolean gates, while extends this by incorporating threshold or modulo gates. The stronger class corresponds to problems solvable by circuits with depth and bounded fan-in [35]. A key result relevant to machine learning is the complexity inclusion , though whether remains an open question [45, 1].
Circuit complexity bounds have been effectively used to analyze the computational power of various neural network architectures. For example, Transformers, including two canonical variants—Average-Head Attention Transformers (AHATs) and SoftMax-Attention Transformers (SMATs)—have been studied in this context. Specifically, [35] shows that AHATs can be simulated by non-uniform constant-depth threshold circuits in , while [26] demonstrates that SMATs can also be simulated in a -uniform manner within . A follow-up study [34] unifies these results, concluding that both AHATs and SMATs are approximable by -uniform circuits. Beyond standard Transformers, RoPE-based Transformers [39], a widely adopted variant in large language models, have also been analyzed using circuit complexity frameworks [28, 9]. Similarly, the emerging Mamba architecture [18] falls within the -uniform family [10]. Additionally, Hopfield networks, initially introduced as associative memory systems, have also been shown to exhibit circuit complexity bounds [27].
Despite the success of circuit complexity in analyzing other neural networks, its application to GNNs is underexplored. While some prior works have attempted to characterize the computational power of GNNs within circuit computation models [5, 14], these efforts are orthogonal to our contributions. A detailed discussion is provided in Section 5.4.
3 Preliminary
This section provides fundamental definitions for this paper. We first introduce some notations. In Section 3.1, we present an in-depth overview of the computation of floating point numbers. In Section 3.2, we review several basic definitions of the Graph Neural Networks (GNNs). In Section 3.3, we present some basic concepts of circuit families and their complexity.
Notations.
For any positive integer , we let denote the set of first natural numbers. For a vector , denotes the diagonal matrix with entries from . The concatenation operator represents combining two vectors or matrices along their last dimension. For example, given and , the result has shape . We use to represent the -dimensional all-ones vector. Let be an undirected graph with vertex set and edge set , where and are the numbers of vertices and edges, respectively. The adjacency matrix encodes , with if , and otherwise. The Kleene closure of a set , denoted , is the set of all finite sequences whose elements belong to . Specifically, implies is a sequence of arbitrary length with elements from . For convenience, we denote the floating point number as .
3.1 Floating Point Numbers
In this subsection, we introduce fundamental definitions of floating-point numbers and their operations. These concepts establish a critical computational framework for implementing GNNs on real-world machines.
Definition 3.1 (Floating Point Numbers (s), Definition 9 in [8]).
A -bit floating-point number is represented as a -tuple of binary integers , in which the significand and the exponent . The value of the is given by . Specifically, when , the floating-point number represents positive or negative infinity, depending on the sign of the significand . We denote the set of all the -bit s as .
Definition 3.2 (Rounding, Definition 9 in [8]).
Let the real number be of infinite precision. The closest- bit precision for is denoted by . If two such numbers exist, we denote as the with even significand.
Building upon the fundamental concepts introduced above, we present the critical floating-point operations used to compute the outputs of graph neural networks.
Definition 3.3 ( operations, page 5 on [8]).
Let be two integers. We first denote the integer division operation as:
Given two -bits s , we define the following basic operations:
The basic operations described above can be efficiently computed in parallel using simple hardware implementations in circuits, as formalized in the following lemma:
Lemma 3.4 (Computing operations with circuits, Lemma 10 and Lemma 11 in [8]).
We denote the number of digits as a positive integer . If , then:
-
•
Basic Operations: The “”, “”, “”, and comparison () of two -bit s, as defined in Definition 3.1, can be computed with -depth uniform threshold circuits with size. Let the maximum circuit depth required for these basic operations be .
-
•
Iterated Operations: The product of -bit s and the sum of -bit s (with rounding applied after summation) can be both computed with -depth uniform threshold circuits with size. Let the maximum circuit depth required for multiplication be and for addition be .
Beyond these basic floating-point operations, certain specialized floating-point operations are also known to be computable within circuits, as demonstrated in the following lemmas:
Lemma 3.5 (Computing with circuits, Lemma 12 in [8]).
Let be a -bit . If , there exists an -depth uniform threshold circuit of size that can compute with relative error less than . Let the maximum circuit depth required for approximating be .
Lemma 3.6 (Computing square root with circuits, Lemma 12 in [8]).
Let be a -bit . If , there exists an -depth uniform threshold circuit of size that can compute with relative error less than . Let the maximum circuit depth required for approximating square roots be .
Lemma 3.7 (Computing matrix multiplication with circuits, Lemma 4.2 in [9]).
Let two matrix operands be . If and , then there exists an -depth uniform threshold circuit of size and depth that can compute the matrix product .
3.2 Graph Neural Networks
With the foundational framework of operations, we now formalize the components of Graph Neural Networks (GNNs) in floating-point representations. This subsection commences by introducing activation functions and the softmax operation, which are fundamental building tools for GNN layers.
Definition 3.8 (ReLU).
For an embedding matrix , the output of the activation function is a matrix , where each element is defined as for all and .
Definition 3.9 (Leaky ReLU).
For an embedding matrix and a predefined negative slope , the output of the function is a matrix , where each element is defined as for all and .
Definition 3.10 (Softmax).
Let be an embedding matrix. The row-wise softmax function is defined element-wise as:
or equivalently in matrix form as:
where is a -dimensional column vector of ones.
These activation functions and softmax operations form the basis of GNN computation. We now introduce the convolution matrices central to the message-passing scheme of GNNs, focusing on three widely used GNN models: GCN [25], GIN [52], and GAT [44].
Definition 3.11 (GCN convolution matrix).
Let be the adjacency matrix of a graph with nodes, and let be the diagonal degree matrix, where . Let denote the identity matrix. The GCN convolution matrix is defined as:
Definition 3.12 (GIN convolution matrix).
Let be the adjacency matrix, and let be a constant. The GIN convolution matrix is defined as:
Definition 3.13 (GAT convolution matrix).
Let be the embedding matrix, and let and denote model weights. The attention weight matrix is defined as:
The GAT convolution matrix is then given by:
Therefore, we unify the three commonly used graph convolution matrices with basic components to define a general GNN layer.
Definition 3.14 (One GNN layer).
Let be the embedding matrix, be the model weights, and an arbitrary convolution matrix (e.g., ). A single GNN layer is defined as:
By stacking multiple GNN layers, we obtain a multi-layer GNN capable of learning expressive node embeddings. Different prediction tasks, such as node-level, link-level, or graph-level tasks, require graph pooling operations to aggregate information from specific node subsets. We introduce two commonly used functions [6] for graph pooling:
Definition 3.15 (Graph average readout layer).
Let be a node embedding matrix. A graph average readout layer selects a subset and computes:
Definition 3.16 (Graph maximum readout layer).
Let be a node embedding matrix. A graph maximum readout layer selects a subset and computes each dimension as:
Remark 3.17.
Finally, we introduce the MLP prediction head, essential for converting the aggregated embedding into specific predictions:
Definition 3.18 (MLP prediction head).
Let be a single output embedding. With model weights , , and bias , the MLP prediction head is defined as:
Finally, we integrate all the previously defined GNN components to present the complete formulation of a multi-layer GNN.
Definition 3.19 (Multi-layer GNN).
3.3 Circuit Complexity Classes
In this subsection, we introduce the fundamental concepts of circuit complexity, a key concept of theoretical computer science and computational complexity.
Definition 3.20 (Boolean circuit, Definition 6.1 in [1]).
A Boolean circuit with binary inputs and one binary output is a mapping between and , represented as a directed acyclic graph (DAG). The graph consists of:
-
•
input nodes, each with in-degree zero, corresponding to the input variables.
-
•
One output node, each with out-degree zero, representing the output variable.
-
•
Intermediate nodes, called gates, perform logical operations (e.g., , , ) on the inputs. Each gate has one out-edge, representing the result of the computation. The in-degree of gate nodes is also referred to as their fan-in.
The structure of the graph allows the Boolean circuit to evaluate logical functions based on the input values, producing a corresponding output.
Definition 3.21 (Complexity measures of Boolean circuits).
The size of a Boolean circuit is defined as the number of nodes in its computation graph. The depth of is the length of the longest path in its computation graph.
To analyze the expressiveness of specific Boolean circuits, we first formally define the concept of languages recognized by a circuit family.
Definition 3.22 (Language recognition with circuit families, Definition 2 in [33]).
A circuit family denotes a set of Boolean circuits. The circuit family can recognize a language if, for every string , there exists a Boolean circuit with input size such that if and only if .
We now define complexity classes of languages based on the circuit families capable of recognizing them, with a focus on the resources (e.g., depth, size) these circuits require:
Definition 3.23 (, Definition 6.21 in [1]).
A language belongs to the class (Nick’s Class) if there is a family of Boolean circuits that can recognize , where the circuits have size, depth, and , , logical gates with bounded fan-in.
Definition 3.24 (, Definition 6.22 in [1]).
A language belongs to the class if there is a family of Boolean circuits that can recognize , where the circuits have size, depth, and , , logical gates with unbounded fan-in.
Definition 3.25 (, Definition 4.34 in [45]).
A language belongs to the class if there is a family of Boolean circuits that can recognize , where the circuits have size, depth, and unbounded fan-in gates for , , , and operations, where a gate outputs one if more than of its inputs are ones.
Remark 3.26.
The gates in Definition 3.25 can be substituted with prime-modulus gates or gates. Any Boolean circuit utilizing one of these gates is called a threshold circuit.
Next, we define the complexity class , which plays a critical role in certain hardness results.
Definition 3.27 (, on page 12 of [13]).
A Boolean circuit belongs to the family if it computes a problem that is -reducible to the computation of the determinant of an matrix with -bit integers.
Fact 3.28 (Inclusion of circuit complexity classes, page 110 on [1], Corollary 4.35 of [45], page 19 of [13]).
We have for all . Specifically, for , we have .
Remark 3.29.
We have formulated non-uniform circuit families that allow different structures for different input lengths. While flexible, this lack of uniformity is impractical compared to computational models like Turing machines, where the same device handles all input lengths. To address this, we introduce uniform circuit families, where circuits for all input lengths can be systematically generated by a Turing machine under specific time and space constraints. We begin by introducing -uniformity.
Definition 3.30 (-uniformity, Definition 6.5 in [1]).
Let denote a circuit family, and let denote a language class recognizable by . A language belongs to the -uniform class of if there exists an -space Turing machine that can produce a circuit with variables for any input . The circuit must recognize for inputs of size .
Next, we define -uniformity, which refines -uniformity by introducing a more computationally practical time constraint. Throughout this paper, references to uniform circuit families specifically denote their -uniform versions.
Definition 3.31 (-uniformity, Definition 4.28 in [4]).
Let be an -uniform language class as defined in Definition 3.30. A language belongs to the -uniform class of if there exists a Turing machine that can produce a circuit with variables for any input within time. The circuit must recognize the language for inputs of size .
4 Complexity of Graph Neural Networks
In this section, we establish foundational complexity results for each component of a graph neural network (GNN) and then combine these results to derive a circuit complexity bound for the entire multi-layer GNN. Section 4.1 examines activation functions, which form the basics for graph convolution computations. Section 4.2 explores the computation of graph convolution matrices. Section 4.3 analyzes a single GNN layer, the fundamental building block of a multi-layer GNN. In Section 4.4, we investigate graph readout functions and the MLP prediction head, essential for making predictions with a multi-layer GNN. Finally, in Section 4.5, we integrate all components and analyze the complete multi-layer GNN structure, culminating in Section 4.6, where we present the key result: the circuit complexity bound of graph neural networks.
4.1 Computing Activation Functions
In this subsection, we first establish a useful fact about computing pairwise and functions with circuits. We then demonstrate that the and activation functions on embedding matrices can be efficiently computed by uniform threshold circuits.
Fact 4.1 (Computing pairwise and with circuits).
Let be two s. If , there is an -depth uniform threshold circuit of size and depth that can compute and .
Proof.
For two s and , we first compute the comparison result f , and otherwise, leveraging an -depth uniform threshold circuit with depth , as stated in Lemma 3.3. Once is computed, each bit of and can be determined as and respectively, which can be computed with a -depth Boolean circuit in parallel. Combining the depths for comparison and logical operations, the overall circuit depth is . Since and each operation is computable with a polynomial-size circuit, we conclude that is the size of the entire circuit. This completes the proof. ∎
Lemma 4.2 (Computing with circuits).
Let be a matrix. If , there is aa constant-depth uniform threshold circuit of size and depth that can compute .
Proof.
For each pair of subscript , the entry is formulated as following Definition 3.8. By Fact 4.1, the computation of function can be finished with a uniform threshold circuit with depth ) and size. If we compute all the entries in parallel, we can also compute with depth and size . Hence, we finish the proof. ∎
Lemma 4.3 (Computing with circuits).
Let be a matrix and is the negative slope. If , there is an -depth uniform threshold circuit of size and depth that can compute .
Proof.
Considering , the entry is formulated as following Definition 3.8. By Fact 4.1, both and function can be computed with a uniform threshold circuit with depth and size. After that, we can multiply with slope and further add it with , which can be computed with a -depth polynomial size circuit by applying Lemma 3.4 twice. Combining the above computation steps, we have Since there are entries in and all the computations are finished with polynomial-size circuits, the size of the entire circuit is also . Thus, we complete the proof. ∎
4.2 Computing Graph Convolution Matrices
In this subsection, we present results on the computation of representative graph convolution matrices using uniform threshold circuits.
Lemma 4.4 (Computing GCN convolution matrix with circuits).
If , then there is a size uniform threshold circuit with depth , which can compute the graph convolution matrix in Definition 3.11.
Proof.
Considering all the rows in the adjacency matrix , the corresponding element of the degree matrix is written as by definition. Following Lemma 3.4, each iterated summation is computable with a size uniform threshold circuit with depth. After that, we can compute all the elements of and in parallel, which can be finished with a uniform threshold circuit having size and depth by Lemma 3.3. Then we can compute all the elements in with a -depth circuit following Lemma 3.6. Finally, we compute the matrix multiplication with uniform threshold circuit of size and depth by applying Lemma 3.7 twice. Combining all the aforementioned circuits, we have
Since each step utilizes a circuit of size , the size of the entire circuit is also . Therefore, we can conclude that a size and depth uniform threshold circuit can compute the GCN convolution matrix . ∎
Lemma 4.5 (Computing GIN convolution matrix with circuits).
If , then there is a size uniform threshold circuit with depth , which can compute the graph convolution matrix in Definition 3.12.
Proof.
By Lemma 3.4, we can first simply compute the constant with a -depth uniform threshold circuit with size . Then we can consider each element of the adjacency matrix , computing in parallel. Applying Lemma 3.4 twice, we can conclude that all the matrix elements can be produced with a size uniform threshold circuit with depth . Thus, by combining all the aforementioned circuits, we have Therefore, we can conclude that a size and depth uniform threshold circuit can compute the GIN convolution matrix . ∎
Before discussing the implementation of the GAT convolution matrix, we introduce a key fact on the softmax mechanism, which is crucial for attention computation in GAT.
Lemma 4.6 (Computing with circuits).
Let be a matrix. If , there is a size uniform threshold circuit with depth that can compute in Definition 3.10.
Proof.
By Lemma 3.5, all the entries of can be produced in parallel through a polynomial-size uniform threshold circuit with depth . Next, we compute using a circuit of depth as per Lemma 3.7, and extract the diagonal matrix using a depth-1 circuit. Subsequently, we compute the inverse of the diagonal matrix with a depth- circuit by inverting all diagonal elements in parallel, as guaranteed by Lemma 3.4. We then multiply and using a polynomial-size circuit with depth , again following Lemma 3.7.
Combining these circuits, the total depth is:
Since the number of parallel operations is , can be computed with a size uniform threshold circuit with depth . This completes the proof. ∎
Building on the softmax computation fact, we show that the GAT convolution matrix can indeed be computed with circuits, as formalized in the following lemma.
Lemma 4.7 (Computing GAT convolution matrix with circuits).
If , then there is a size uniform threshold circuit with depth , which can compute the graph convolution matrix in Definition 3.13.
Proof.
Let denote a with a negative infinity value, and let the model weight . We define and , such that . For all , each entry of the attention weight matrix is given by:
following Definition 3.13. We examine the three terms separately:
For the first term , there is a size and uniform threshold circuit to compute following Lemma 3.7. Then we can compute with a depth circuit by Lemma 3.9. After that, we can combine Lemma 3.7 and Lemma 3.4 to multiply , and with a polynomial size and depth threshold circuit. Combining all the circuits above, we can get the total depth for the first term as follows:
For the second term , since its computation is equivalent to the first term, we can conclude that the depth of the second term equals .
For the third term , we can simply apply Lemma 3.4 twice and conclude that can be produced with a uniform threshold circuit, in which the size is and the depth is .
Integrating the computation of all the three terms for , we can compute these three terms in parallel, and then obtain a polynomial-size uniform threshold circuit with depth . Since we have obtained a uniform threshold circuit to compute each element in and the elements to be computed in parallel is of , we can compute all the elements in in parallel without increasing the circuit’s polynomial size and depth. At last, we can compute to obtain the final convolution matrix, and this can be finished with a uniform threshold circuit with depth following Lemma 4.6. Therefore, the final depth of the circuit is the summation of the circuit for computing the matrix and applying the operation, which is:
Therefore, we can conclude that the GAT convolution matrix is computable with a uniform threshold circuit within polynomial size and depth, which finishes the proof. ∎
4.3 Computing Single Graph Neural Network Layer
In this subsection, we combine the results on graph convolution matrices and basic activation functions to determine the circuit depth requirement for a complete GNN layer.
Lemma 4.8 (Computing a single GNN layer with circuits).
If , then the GNN layer in Definition 3.14 can be computed with a uniform threshold circuit of size and depth .
Proof.
By Lemma 4.4, Lemma 4.5 and Lemma 4.7, we can obtain that the graph convolution matrix can be computed with a depth polynomial size threshold circuit. By Lemma 3.7, we can further conclude that can be produced by a circuit with polynomial size and depth. Then we can compute with a -depth and polynomial size circuit following Lemma 4.2. Combining all the circuit depths mentioned above, we have:
Since all the steps use a polynomial step circuit, we can conclude that a single GNN layer can be computed with a uniform threshold circuit having size and depth. Thus, we finish the proof. ∎
4.4 Computing Pooling Layer and Prediction Head
As shown in Definition 3.15, Definition 3.16, and Definition 3.18, we have described basic components for transforming GNN node embeddings into predictions. Here, we present results on computing these components with uniform threshold circuits, starting with two graph readout layers.
Lemma 4.9 (Computing graph average readout with circuits).
If , then the graph average readout layer in Definition 3.15 can be computed with a size uniform threshold circuit with depth .
Proof.
Let be the vectorized form of index set , where for all and otherwise. Therefore, the output in Definition 3.15 is equivalent to the following:
where is a -dimensional one vector. Thus, we can apply Lemma 3.7 twice and obtain a size and depth uniform threshold circuit that can compute matrix product . Thus, we follow Lemma 3.4 to multiply with a depth circuit at size. Combining the two circuits mentioned above, we have the total depth:
Since all the partial circuits are in polynomial size, we can conclude that there is a size and depth uniform threshold circuit which can compute the graph pooling layer. Hence, we finish the proof. ∎
Before delving into the graph maximum readout layer, we establish a useful fact about computing maximum and minimum values in .
Fact 4.10 (Computing and of values with circuits).
Let be s. If precision , there is an -depth uniform threshold circuit of size and depth that can compute the maximum and minimum of these s, i.e., and .
Proof.
For all the pairs , we first compute the comparison results between all pairs of the numbers. Let , where if and otherwise, and , where if and otherwise. Since there are in total comparison operations, we conclude that each can be produced in parallel using a size uniform threshold circuit with depth, following Lemma 3.4.
Once and are computed, we compute the dominance vector in parallel using a 1-depth Boolean circuit, where . Here, indicates that is a maximum value. Similarly, we can compute in parallel, where , to identify the minimum value.
To select the maximum value, we compute each bit of the output in parallel using a 2-depth Boolean circuit:
in which is the -th bit of . Since all maximum values are equal, if a specific bit of all maximum values is 1, the OR operation ensures ; similarly, if all maximum values have 0 in bit , then . Thus, this approach guarantees correctness regardless of the number of maximum values. Similarly, each bit of the minimum output is computed using:
Combining all the steps above, the total circuit depth is therefore . Since and all the steps are computed by a circuit of size, we conclude that the total circuit size is also . This completes the proof. ∎
With this fact, the graph maximum readout layer can be computed seamlessly using circuits, as stated in the following lemma:
Lemma 4.11 (Computing graph maximum readout with circuits).
If , the graph maximum readout layer in Definition 3.16 can be computed using a size uniform threshold circuit with depth .
Proof.
For each entry of the output , since it corresponds to the maximum of numbers, we can compute them in parallel through a size uniform threshold circuit with depth by Fact 4.10. This completes the proof. ∎
Following the computation of graph readout functions, we introduce a simplified notation for their circuit depths. Specifically, we define the depth of the uniform threshold circuit used for computing the graph readout layer as , which follows the results in Lemma 4.9 and Lemma 4.11.
Next, we introduce the circuit depth for computing an MLP prediction head.
Lemma 4.12 (Computing MLP head with circuits).
If , then the MLP prediction head in Definition 3.18 can be computed with a size uniform threshold circuit with depth .
Proof.
By Lemma 3.7, matrix product is computable with a size and depth uniform threshold circuit. After that, for each , we can compute each element in parallel with a size and size uniform threshold circuit by Lemma 3.4. Then, we can further apply the activation function with a polynomial size and uniform threshold circuit by applying Lemma 4.2. Finally, following Lemma 3.7, the inner product between and is computable with a polynomial size and uniform threshold circuit.
Combining all the aforementioned circuits, we have the total circuit depth:
Since the circuits to compute each step are all in polynomial size, we can conclude that the MLP prediction head is computable with a size and depth uniform threshold circuit. Hence, we finish our proof. ∎
4.5 Computing Multi-Layer Graph Neural Network
Since we have presented the circuit depths for all the components of an entire multi-layer GNN, we now derive the overall circuit depth of the entire GNN in this subsection.
Lemma 4.13 (Computing multi-layer GNN with circuits).
If , then the multi-layer graph neural network in Definition 3.19 can be computed with a size uniform threshold circuit with depth .
Proof.
For each layer , can be computed with a size and depth uniform threshold circuit by Lemma 4.8. Hence, the composition of all the layers can be computed with a uniform threshold circuit within a total depth of . Then, we can compute the graph readout layer with size and depth uniform threshold circuit, following Lemma 4.9 and Lemma 4.11. Finally, we can apply Lemma 4.12 to compute the MLP prediction head with a size and uniform threshold circuit.
Combining the circuits to compute each layer of the entire model, we have the following total circuit depth:
Since the circuits for computing each part of the model are all in size, we can conclude that the multi-layer GNN can be computed with a size and depth uniform threshold circuit. Hence, we finish the proof. ∎
4.6 Main Result: Graph Neural Networks Circuit Complexity
Finally, this subsection presents the circuit complexity bound of graph neural networks, which is the main result of this paper.
Theorem 4.14 (Main Result, Circuit complexity bound of graph neural networks).
If precision , embedding size and the number of layers , then the graph neural network in Definition 3.19 can be simulated by the uniform circuit family.
Proof.
The main result in Theorem 4.14 establishes that unless , graph neural networks with precision, constant depth, and embedding size belong to the uniform circuit class. This highlights an inherent expressiveness limitation of GNNs, despite their empirical success, as they cannot solve problems beyond the capability of circuits. In the next section, we illustrate this limitation by analyzing two practical graph query problems.
5 Hardness
We explore two critical decision problems on graphs and their associated hardness results. Section 5.1 introduces two graph connectivity problems. Section 5.2 presents the basic concepts of the graph isomorphism problem. In Section 5.3, we present the main hardness result of this paper, which theoretically demonstrates that graph neural networks cannot solve these problems.
5.1 Graph Connectivity Problem
To formally define the graph connectivity problem, we begin by introducing two basic concepts related to sequences of connected nodes in graphs: walks and paths.
Definition 5.1 (Walk, Definition on page 26 of [48]).
Given a graph , a walk in is a finite sequence of nodes, denoted by
where and any two consecutive nodes are connected (i.e., ).
Definition 5.2 (Path, Definition on page 26 of [48]).
For a walk , if all the nodes and all the edges are distinct, then we call this walk as a path.
Building upon these basic concepts, we now formally define two types of graph connectivity problems: the pairwise s-t connectivity problem, which checks whether two specific nodes are connected, and the global graph connectivity problem, which verifies the connectivity of all nodes.
Definition 5.3 (Undirected graph s-t connectivity problem, Definition on page 2 of [47]).
Let be an arbitrary undirected graph. The undirected s-t graph connectivity problem is: Does there exist a path between two specific nodes ?
Definition 5.4 (Undirected graph connectivity problem, Definition on page 2 of [47]).
Let be an arbitrary undirected graph. The undirected graph connectivity problem is: Does there exist a path between all the nodes in ?
With these problem formulations, we proceed to their computational complexity results.
5.2 Graph Isomorphism Problem
In this subsection, we turn to the graph isomorphism problem, a core challenge in understanding the expressiveness of GNNs [52, 57]. This problem involves determining whether two graphs are structurally identical by examining possible permutations of their nodes.
Definition 5.7 (Graph isomorphism, on page 3 of [43]).
Let and be two graphs. An isomorphism between and is a bijection the between their sets of vertices and which preserves the edges, i.e. and .
We can now define the graph isomorphism problem, which checks the existence of such an isomorphism.
Definition 5.8 (Graph isomorphism problem, on page 3 of [43]).
Let and be two graphs. The graph isomorphism problem is: Does there exist a graph isomorphism between and ?
The computational complexity of the graph isomorphism problem is summarized in the following results:
Lemma 5.9 (Theorem 4.9 in [43]).
The graph isomorphism problem in Definition 5.8 is hard for the class under reductions.
Corollary 5.10.
The graph isomorphism problem in Definition 5.8 is -hard.
Proof.
By Lemma 5.9, it is known that the graph isomorphism problem is hard for the class under reductions. Following Fact 3.28, since , we can conclude that the graph isomorphism problem is -hard ignoring the reduction condition. Thus, we can apply Fact 3.28 for the second time and conclude that the graph isomorphism problem is -hard, which finishes the proof. ∎
5.3 Hardness Results
This subsection presents the main hardness results, which highlight the limitations of GNNs on two practical graph decision problems. We begin by showing that GNNs are unable to solve both types of graph connectivity problems.
Theorem 5.11.
Unless , a graph neural network with precision, constant number of layers, embedding size cannot solve the graph s-t connectivity problem.
Proof.
Theorem 5.12.
Unless , a graph neural network with precision, constant number of layers, embedding size cannot solve the graph connectivity problem.
Proof.
Next, we show the hardness results for the graph isomorphism problem, which demonstrates the expressiveness limitations of GNNs from a non-Weisfeiler-Lehman (WL) perspective.
Theorem 5.13.
Unless , a graph neural network with precision, constant number of layers, embedding size cannot solve the graph isomorphism problem.
Proof.
Remark 5.14.
Our hardness results assume an embedding size of , which is significantly stronger and encompasses the constant embedding sizes typically used in practice, where . This highlights that the computational limitations of GNNs cannot be easily mitigated by simply increasing the embedding size.
5.4 Discussion
After presenting the main hardness results of this paper, we explore the connections and comparisons with a broad range of relevant works, highlighting the contribution of this paper.
Connection and comparison to WL.
The Weisfeiler-Lehman (WL) hierarchy is the most widely used framework for analyzing the expressiveness of GNNs, particularly for their ability to solve graph isomorphism problems [52, 57]. While our Theorem 5.13 similarly shows that GNNs cannot solve the graph isomorphism problem unless , our results differ fundamentally from previous WL-based findings. Unlike the WL framework, which focuses solely on the topological structure of graphs, our analysis considers practical factors such as floating-point precision and node features. This broader perspective allows us to bound the expressiveness of feature-enhanced GNNs, including those with position encodings [53, 15] or random node features [42]. Moreover, while the WL framework is limited to graph isomorphism, we extend the analysis to show that GNNs cannot solve the graph connectivity problem (Theorem 5.11 and Theorem 5.12), a limitation that is difficult to capture using the WL framework.
Comparison to GNN computational models.
Recent studies have explored GNN expressiveness through computational models. For example, [14] investigates the RL-CONGEST model, which examines the communication complexity of GNNs in distributed settings. However, this work focuses on communication cost rather than expressiveness and is less relevant to our study. The most similar work to ours is [5], which shows that aggregate-combine GNNs cannot capture a variant of first-order logic, . Since counting in can be simulated by and , their result implies that is not a complexity lower bound for AC-GNNs. In contrast, our work establishes that GNNs are upper-bounded by the circuit family, providing a clear upper bound rather than refusing a lower bound. This highlights a fundamental difference between our result and previous results in [5].
6 Conclusion
In this work, we show the computational limits of graph neural networks (GNNs). Unlike prior approaches based on the Weisfeiler-Lehman (WL) test, we adopt a fundamentally different perspective: circuit complexity. We show that GNNs with precision, constant number of layers, and embedding sizes , regardless of the specific message-passing mechanisms or global readout functions, belong to the uniform circuit complexity class. As a result, we establish critical hardness results for two practical graph decision problems: graph connectivity and graph isomorphism. Our findings demonstrate that GNNs cannot solve these problems beyond , unless . These results are significant as they extend previous GNN expressiveness limitations, which were framed from the WL perspective, by introducing a fundamentally different circuit complexity bound. Our analysis not only incorporates previously overlooked factors, such as floating-point number precision and the interactions between node embeddings and topological structure but also applies to a broader range of graph query problems, such as graph connectivity.
For future works, we believe our theoretical framework offers a trustworthy foundation that can be generalized to assess the expressiveness of other GNN architectures and the hardness of additional graph query problems. Our research may also inspire the development of new architectures that go beyond the complexity of the circuit family.
References
- AB [09] Sanjeev Arora and Boaz Barak. Computational complexity: a modern approach. Cambridge University Press, 2009.
- Bab [16] László Babai. Graph isomorphism in quasipolynomial time. In Proceedings of the forty-eighth annual ACM symposium on Theory of Computing, pages 684–697, 2016.
- BAY [22] Shaked Brody, Uri Alon, and Eran Yahav. How attentive are graph attention networks? In International Conference on Learning Representations, 2022.
- BI [94] D Mix Barrington and Neil Immerman. Time, hardware, and uniformity. In Proceedings of IEEE 9th Annual Conference on Structure in Complexity Theory, pages 176–185. IEEE, 1994.
- BKM+ [20] Pablo Barceló, Egor V. Kostylev, Mikael Monet, Jorge Pérez, Juan Reutter, and Juan Pablo Silva. The logical expressiveness of graph neural networks. In International Conference on Learning Representations, 2020.
- BL [23] Filippo Maria Bianchi and Veronica Lachi. The expressive power of pooling in graph neural networks. Advances in neural information processing systems, 36:71603–71618, 2023.
- BRH+ [21] Muhammet Balcilar, Guillaume Renton, Pierre Héroux, Benoit Gaüzère, Sébastien Adam, and Paul Honeine. Analyzing the expressive power of graph neural networks in a spectral perspective. In International Conference on Learning Representations, 2021.
- Chi [24] David Chiang. Transformers in uniform . arXiv preprint arXiv:2409.13629, 2024.
- [9] Bo Chen, Xiaoyu Li, Yingyu Liang, Jiangxuan Long, Zhenmei Shi, and Zhao Song. Circuit complexity bounds for rope-based transformer architecture. arXiv preprint arXiv:2411.07602, 2024.
- [10] Yifang Chen, Xiaoyu Li, Yingyu Liang, Zhenmei Shi, and Zhao Song. The computational limits of state-space models and mamba via the lens of circuit complexity. arXiv preprint arXiv:2412.06148, 2024.
- CM [87] Stephen A Cook and Pierre McKenzie. Problems complete for deterministic logarithmic space. Journal of Algorithms, 8(3):385–394, 1987.
- CMR [21] Leonardo Cotta, Christopher Morris, and Bruno Ribeiro. Reconstruction for powerful graph representations. Advances in Neural Information Processing Systems, 34:1713–1726, 2021.
- Coo [85] Stephen A Cook. A taxonomy of problems with fast parallel algorithms. Information and control, 64(1-3):2–22, 1985.
- CWS [24] Guanyu Cui, Zhewei Wei, and Hsin-Hao Su. Rethinking the expressiveness of gnns: A computational model perspective. arXiv preprint arXiv:2410.01308, 2024.
- DLL+ [22] Vijay Prakash Dwivedi, Anh Tuan Luu, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Graph neural networks with learnable structural and positional representations. In International Conference on Learning Representations, 2022.
- FCL+ [22] Jiarui Feng, Yixin Chen, Fuhai Li, Anindya Sarkar, and Muhan Zhang. How powerful are k-hop message passing graph neural networks. Advances in Neural Information Processing Systems, 35:4776–4790, 2022.
- FML+ [19] Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In The world wide web conference, pages 417–426, 2019.
- GD [23] Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023.
- GJJ [20] Vikas Garg, Stefanie Jegelka, and Tommi Jaakkola. Generalization and representational limits of graph neural networks. In International Conference on Machine Learning, pages 3419–3430. PMLR, 2020.
- GS [20] Martin Grohe and Pascal Schweitzer. The graph isomorphism problem. Communications of the ACM, 63(11):128–134, 2020.
- GSR+ [17] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, pages 1263–1272. PMLR, 2017.
- HAF [22] Yiding Hao, Dana Angluin, and Robert Frank. Formal language recognition by hard attention transformers: Perspectives from circuit complexity. Transactions of the Association for Computational Linguistics, 10:800–810, 2022.
- HDW+ [20] Xiangnan He, Kuan Deng, Xiang Wang, Yan Li, Yongdong Zhang, and Meng Wang. Lightgcn: Simplifying and powering graph convolution network for recommendation. In Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, pages 639–648, 2020.
- HYL [17] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. Advances in neural information processing systems, 30, 2017.
- KW [17] Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
- LAG+ [23] Bingbin Liu, Jordan T. Ash, Surbhi Goel, Akshay Krishnamurthy, and Cyril Zhang. Transformers learn shortcuts to automata. In The Eleventh International Conference on Learning Representations, 2023.
- LLL+ [24] Xiaoyu Li, Yuanpeng Li, Yingyu Liang, Zhenmei Shi, and Zhao Song. On the expressive power of modern hopfield networks. arXiv preprint arXiv:2412.05562, 2024.
- LLS+ [24] Xiaoyu Li, Yingyu Liang, Zhenmei Shi, Zhao Song, and Mingda Wan. Theoretical constraints on the expressive power of rope-based tensor attention transformers. arXiv preprint arXiv:2412.18040, 2024.
- LW [68] Andrei Leman and Boris Weisfeiler. A reduction of a graph to a canonical form and an algebra arising during this reduction. Nauchno-Technicheskaya Informatsiya, 2(9):12–16, 1968.
- MBHSL [19] Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks. Advances in neural information processing systems, 32, 2019.
- MRF+ [19] Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 4602–4609, 2019.
- MRM [20] Christopher Morris, Gaurav Rattan, and Petra Mutzel. Weisfeiler and leman go sparse: Towards scalable higher-order graph embeddings. Advances in Neural Information Processing Systems, 33:21824–21840, 2020.
- MS [23] William Merrill and Ashish Sabharwal. The parallelism tradeoff: Limitations of log-precision transformers. Transactions of the Association for Computational Linguistics, 11:531–545, 2023.
- MS [24] William Merrill and Ashish Sabharwal. A logic for expressing log-precision transformers. Advances in Neural Information Processing Systems, 36, 2024.
- MSS [22] William Merrill, Ashish Sabharwal, and Noah A Smith. Saturated transformers are constant-depth threshold circuits. Transactions of the Association for Computational Linguistics, 10:843–856, 2022.
- PW [22] Pál András Papp and Roger Wattenhofer. A theoretical comparison of graph neural network extensions. In International Conference on Machine Learning, pages 17323–17345. PMLR, 2022.
- QRG+ [22] Chendi Qian, Gaurav Rattan, Floris Geerts, Mathias Niepert, and Christopher Morris. Ordered subgraph aggregation networks. Advances in Neural Information Processing Systems, 35:21030–21045, 2022.
- Ruz [81] Walter L Ruzzo. On uniform circuit complexity. Journal of Computer and System Sciences, 22(3):365–383, 1981.
- SAL+ [24] Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocomputing, 568:127063, 2024.
- Sat [20] Ryoma Sato. A survey on the expressive power of graph neural networks. arXiv preprint arXiv:2003.04078, 2020.
- SLYS [21] Aravind Sankar, Yozen Liu, Jun Yu, and Neil Shah. Graph neural networks for friend ranking in large-scale social platforms. In Proceedings of the Web Conference 2021, pages 2535–2546, 2021.
- SYK [21] Ryoma Sato, Makoto Yamada, and Hisashi Kashima. Random features strengthen graph neural networks. In Proceedings of the 2021 SIAM international conference on data mining (SDM), pages 333–341. SIAM, 2021.
- Tor [04] Jacobo Torán. On the hardness of graph isomorphism. SIAM Journal on Computing, 33(5):1093–1108, 2004.
- VCC+ [18] Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018.
- Vol [99] Heribert Vollmer. Introduction to circuit complexity: a uniform approach. Springer Science & Business Media, 1999.
- WHW+ [19] Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, and Tat-Seng Chua. Neural graph collaborative filtering. In Proceedings of the 42nd international ACM SIGIR conference on Research and development in Information Retrieval, pages 165–174, 2019.
- Wig [92] Avi Wigderson. The complexity of graph connectivity. In International Symposium on Mathematical Foundations of Computer Science, pages 112–132. Springer, 1992.
- Wil [10] R.J. Wilson. Introduction to Graph Theory. Longman, 2010.
- WSZ+ [19] Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In International conference on machine learning, pages 6861–6871. PMLR, 2019.
- WW [22] Asiri Wijesinghe and Qing Wang. A new perspective on ”how graph neural networks go beyond weisfeiler-lehman?”. In International Conference on Learning Representations, 2022.
- WWCBF [22] Yuyang Wang, Jianren Wang, Zhonglin Cao, and Amir Barati Farimani. Molecular contrastive learning of representations via graph neural networks. Nature Machine Intelligence, 4(3):279–287, 2022.
- XHLJ [18] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2018.
- YYL [19] Jiaxuan You, Rex Ying, and Jure Leskovec. Position-aware graph neural networks. In International conference on machine learning, pages 7134–7143. PMLR, 2019.
- ZC [18] Muhan Zhang and Yixin Chen. Link prediction based on graph neural networks. Advances in neural information processing systems, 31, 2018.
- ZCNC [18] Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 2018.
- ZFD+ [23] Bohang Zhang, Guhao Feng, Yiheng Du, Di He, and Liwei Wang. A complete expressiveness hierarchy for subgraph gnns via subgraph weisfeiler-lehman tests. In International Conference on Machine Learning, pages 41019–41077. PMLR, 2023.
- ZGD+ [24] Bohang Zhang, Jingchu Gai, Yiheng Du, Qiwei Ye, Di He, and Liwei Wang. Beyond weisfeiler-lehman: A quantitative framework for GNN expressiveness. In The Twelfth International Conference on Learning Representations, 2024.
- ZZXT [21] Zhaocheng Zhu, Zuobai Zhang, Louis-Pascal Xhonneux, and Jian Tang. Neural bellman-ford networks: A general graph neural network framework for link prediction. Advances in Neural Information Processing Systems, 34:29476–29490, 2021.