H OW P OWERFUL ARE G RAPH N EURAL N ETWORKS ?
Anonymous authors
Paper under double-blind review
A BSTRACT
Graph Neural Networks (GNNs) for representation learning of graphs broadly follow a neighborhood aggregation framework, where the representation vector of a node is computed by recursively aggregating and transforming feature vectors of its neighboring nodes.
Many GNN variants have been proposed and have achieved state-of-the-art results on both node and graph classiﬁcation tasks.
However, despite
GNNs revolutionizing graph representation learning, there is limited understanding of their representational properties and limitations.
Here, we present a theoretical framework for analyzing the expressive power of GNNs in capturing different graph structures.
Our results characterize the discriminative power of popular
GNN variants, such as Graph Convolutional Networks and GraphSAGE, and show that they cannot learn to distinguish certain simple graph structures.
We then develop a simple architecture that is provably the most expressive among the class of GNNs and is as powerful as the Weisfeiler-Lehman graph isomorphism test.
We empirically validate our theoretical ﬁndings on a number of graph classiﬁcation benchmarks, and demonstrate that our model achieves state-of-the-art performance.
I NTRODUCTION
Learning with graph structured data, such as molecules, social, biological, and ﬁnancial networks, requires effective representation of their graph structure (Hamilton et al., 2017b).
Recently, there has been a surge of interest in Graph Neural Network (GNN) approaches for representation learning of graphs (Li et al., 2016; Hamilton et al., 2017a; Kipf & Welling, 2017; Velickovic et al., 2018;
Xu et al., 2018).
GNNs broadly follow a recursive neighborhood aggregation (or message passing) scheme, where each node aggregates feature vectors of its neighbors to compute its new feature vector (Gilmer et al., 2017; Xu et al., 2018).
After k iterations of aggregation, a node is represented by its transformed feature vector, which captures the structural information within the node’s k -hop network neighborhood.
The representation of an entire graph can then be obtained through pooling, for example, by summing the representation vectors of all nodes in the graph.
Many GNN variants with different neighborhood aggregation and graph-level pooling schemes have been proposed (Scarselli et al., 2009b; Battaglia et al., 2016; Defferrard et al., 2016; Duvenaud et al., 2015; Hamilton et al., 2017a;
Kearnes et al., 2016; Kipf & Welling, 2017;
Lei et al., 2017; Li et al., 2016; Velickovic et al., 2018; Verma & Zhang, 2018;
Ying et al., 2018; Zhang et al., 2018).
Empirically, these GNNs have achieved state-of-the-art performance in many tasks such as node classiﬁcation, link prediction, and graph classiﬁcation.
However, the design of new GNNs is mostly based on empirical intuition, heuristics, and experimental trial-and-error.
There is little theoretical understanding of the properties and limitations of GNNs, and formal analysis of GNNs’ representational capacity is limited.
Here, we present a theoretical framework for analyzing the representational power of GNNs.
We formally characterize how expressive different GNN variants are in learning to represent and distinguish between different graph structures.
Our framework is inspired by the close connection between
GNNs and the Weisfeiler-Lehman (WL) graph isomorphism test (Weisfeiler & Lehman, 1968), a powerful test known to distinguish a broad class of graphs (Babai & Kucera, 1979).
Similar to GNNs, the WL test iteratively updates a given node’s feature vector by aggregating feature vectors of its network neighbors.
What makes the WL test so powerful is its injective aggregation update that maps different node neighborhoods to different feature vectors.
Our key insight is that a GNN can have as large discriminative power as the WL test if the GNN’s aggregation scheme is highly expressive and can model injective functions.
To mathematically formalize the above insight, our framework ﬁrst abstracts the feature vectors of a node’s neighbors as a multiset , i.e. , a set with possibly repeating elements.
Then, the neighbor aggregation in GNNs can be abstracted as a function over the multiset .
We rigorously study different variants of multiset functions and theoretically characterize their discriminative power, i.e. , how well different aggregation functions can distinguish different multisets.
The more discriminative the multiset function is, the more powerful the representational power of the underlying GNN.
Our main results are summarized as follows:
1) We show that GNNs are at most as powerful as the WL test in distinguishing graph structures.
We establish conditions on the neighbor aggregation and graph pooling functions under which the resulting GNN is as powerful as the WL test.
We identify graph structures that cannot be distinguished by popular GNN variants, such as GCN (Kipf & Welling, 2017) and GraphSAGE (Hamilton et al., 2017a), and we precisely characterize the kinds of graph structures such GNN-based models can capture.
We develop a simple neural architecture, Graph Isomorphism Network (GIN) , and show that its discriminative/representational power is equal to the power of the WL test.
We validate our theory via experiments on graph classiﬁcation datasets, where the expressive power of GNNs is crucial to capture graph structures.
In particular, we compare the performance of GNNs with various aggregation functions.
Our results conﬁrm that the most powerful GNN (our Graph
Isomorphism Network (GIN)) has high representational power as it almost perfectly ﬁts the training data, whereas the less powerful GNN variants often severely underﬁt the training data.
In addition, the representationally more powerful GNNs outperform the others by test set accuracy and achieve state-of-the-art performance on many graph classiﬁcation benchmarks.
P RELIMINARIES
We begin by summarizing some of the most common GNN models and, along the way, introduce our notation.
Let G =
( V, E ) denote a graph with node feature vectors X v for v ∈ V .
There are two tasks of interest: (1) Node classiﬁcation , where each node v ∈ V has an associated label y v and the goal is to learn a representation vector h v of v such that v ’s label can be predicted as y v =
f ( h v ) ; (2) Graph classiﬁcation , where, given a set of graphs { G 1 , ..., G N } ⊆ G and their labels { y 1 , ..., y N } ⊆ Y , we aim to learn a representation vector h G that helps predict the label of an entire graph, y G
= g ( h G ) .
Graph Neural Networks.
GNNs use the graph structure and node features X v to learn a representation vector of a node, h v , or the entire graph, h G .
Modern GNNs follow a neighborhood aggregation strategy, where we iteratively update the representation of a node by aggregating representations of its neighbors.
After k iterations of aggregation, a node’s representation captures the structural information within its k -hop network neighborhood.
Formally, the k -th layer of a GNN is
[Equation]
where h ( k ) v is the feature vector of node v at the k -th iteration/layer.
We initialize h (0) v = X v , and
N ( v ) is a set of nodes adjacent to v .
The choice of AGGREGATE ( k ) ( · ) and COMBINE ( k ) ( · ) in
GNNs is crucial.
A number of architectures for AGGREGATE have been proposed.
In the pooling variant of GraphSAGE (Hamilton et al., 2017a), AGGREGATE has been formulated as
[Equation]
where W is a learnable matrix, and MAX represents an element-wise max-pooling.
The COMBINE step could be a concatenation followed by a linear mapping W ·
(cid:104) h ( k − 1) v (cid:12) (cid:12)
a ( k ) v (cid:105) as in GraphSAGE.
In
Graph Convolutional Networks (GCN) (Kipf & Welling, 2017), the element-wise mean pooling is used instead, and the AGGREGATE and COMBINE steps are integrated as follows:
[Equation]
Many other GNNs can be similarly represented as Eq.
2.1 (Xu et al., 2018; Gilmer et al., 2017).
For node classiﬁcation, the node representation h ( K ) v of the ﬁnal iteration is used for prediction.
For graph classiﬁcation, the READOUT function aggregates node features from the ﬁnal iteration to obtain the entire graph’s representation h G :
[Equation]
READOUT can be a simple permutation invariant function such as summation or a more sophisticated graph-level pooling function (Ying et al., 2018; Zhang et al., 2018).
Weisfeiler-Lehman test.
The graph isomorphism problem asks whether two graphs are topologically identical.
This is a challenging problem: no polynomial-time algorithm is known for it yet (Garey, 1979; Garey & Johnson, 2002; Babai, 2016).
Despite some corner cases (Cai et al., 1992), the
Weisfeiler-Lehman (WL) test of graph isomorphism (Weisfeiler & Lehman, 1968) is an effective and computationally efﬁcient test that distinguishes a broad class of graphs (Babai & Kucera, 1979).
Its 1-dimensional form, “naive vertex reﬁnement”, is analogous to neighborhood aggregation in GNNs.
Assuming each node has a categorical label, the WL test iteratively (1) aggregates the labels of nodes and their neighborhoods, and (2) hashes the aggregated labels into unique new labels.
The algorithm decides that two graphs are different if at some iteration their node labels are different.
Based on the WL test, Shervashidze et al.
(2011) proposed the WL subtree kernel that measures the similarity between graphs.
The kernel uses the counts of node labels at different iterations of the
WL test as the feature vector of a graph.
Intuitively, a node’s label at the k -th iteration of WL test represents a subtree structure of height k rooted at the node (Figure 1).
Thus, the graph features considered by the WL subtree kernel are essentially counts of different rooted subtrees in the graph.
T HEORETICAL FRAMEWORK : OVERVIEW
We start with an overview of our framework for analyzing the expressive power of GNNs.
A GNN recursively updates each node’s feature vector to capture the network structure and features of other nodes around it, i.e. , its rooted subtree structures (Figure 1).
Throughout the paper, we assume node input features are from a countable universe.
For ﬁnite graphs, we can recursively show that node feature vectors at deeper layers of any ﬁxed model are also from a countable universe.
For notational simplicity, we can assign each feature vector a unique label ∈ { a, b, c . . . } .
Then, feature vectors of a set of neighboring nodes form a multiset : the same element can appear multiple times since different nodes can have identical feature vectors.
Deﬁnition 1 (Multiset) .
A multiset is a generalized concept of a set that allows multiple instances for its elements.
More formally, a multiset is a 2-tuple X =
( S, m ) where S is the underlying set of
X that is formed from its distinct elements , and m : S → N ≥ 1 gives the multiplicity of the elements.
In order to analyze the representational power of a GNN, we analyze when a GNN maps two nodes into the same location in the embedding space.
Intuitively, the most powerful GNN maps two nodes to the same location only if they have identical subtree structures with identical features on the corresponding nodes.
Since subtree structures are deﬁned recursively via node neighborhoods (Figure 1), we can reduce our analysis recursively to the question when a GNN maps two neighborhoods to the same embedding.
The most powerful GNN would never map two different neighborhoods, i.e. , multisets of feature vectors, to the same location.
This means its aggregation scheme is injective .
Thus, we abstract a GNN’s aggregation scheme as a class of functions over multisets that its neural networks can represent, and analyze whether they are able to represent injective multiset functions.
Next, we use this reasoning to develop a maximally powerful GNN.
In Section 5, we study popular GNN variants and see that their aggregation schemes are inherently not injective and thus less powerful, but that they can capture other interesting properties of graphs.
G ENERALIZING THE WL TEST WITH GRAPH NEURAL NETWORKS
Ideally, a GNN is able to (1) distinguish different graph structures by mapping them to different locations in the embedding space, and (2) capture their structural similarity in the embedding space.
In this paper, we are mainly concerned with the ﬁrst part, and we will brieﬂy discuss the second part.
The ability to map different graphs to different embeddings, however, implies solving graph isomorphism.
In our analysis, we characterize the representational capacity of GNNs via a slightly weaker criterion: the Weisfeiler-Lehman (WL) graph isomorphism test that is known to work well in general, with some few exceptions, in particular, regular graphs (Cai et al., 1992; Douglas, 2011; Evdokimov & Ponomarenko, 1999).
Proofs of all lemmas and theorems can be found in the appendix.
Lemma 2.
Let G 1 and G 2 be any non-isomorphic graphs.
If a graph neural network A : G → R d following the neighborhood aggregation scheme maps G 1 and G 2 to different embeddings, the
Weisfeiler-Lehman graph isomorphism test also decides G 1 and G 2 are not isomorphic.
Hence, any aggregation-based GNN is at most as powerful as the WL test in distinguishing different graphs.
A natural follow-up question is whether there exist GNNs that are, in principle, as powerful as the WL test?
Our answer, in Theorem 3, is yes: if the neighbor aggregation and graph pooling functions are injective, then the resulting GNN is as powerful as the WL test.
Theorem 3.
Let A : G → R d be a GNN following the neighborhood aggregation scheme.
With sufﬁcient iterations, A maps any graphs G 1 and G 2 that the Weisfeiler-Lehman test of isomorphism decides as non-isomorphic, to different embeddings if the following conditions hold:
a) A aggregates and updates node features iteratively with
[Equation]
f (cid:16)(cid:110)
[Equation]
k
[Equation] [Equation]
where the functions f , which operates on multisets, and φ are injective.
b) A ’s graph-level readout, which operates on the multiset of node features (cid:110) h ( k ) v (cid:111) , is injective.
We prove Theorem 3 in the appendix.
On countable sets, injectiveness well characterizes whether a function preserves the distinctness of inputs.
On uncountable sets, where node features are continuous, the notions of injectiveness and discriminative power are "weakened".
It would be useful to characterize how closely packed the learned features are in a function’s image.
In this paper, we assume that input node features are from a countable set (that can be a subset of an uncountable set such as R n ). Given the countability assumption on the input node features, one may ask whether countability still holds for the node features at deeper layers of a GNN? Lemma 4 says yes, i.e. , countability can propagate across layers. Lemma 4.
Assume input feature space X is countable.
Let g ( k ) be the function parameterized by a GNN’s k -th layer for k = 1 , ..., L , where g (1) is deﬁned on ﬁnite multisets X ⊂ X .
The range of g ( k ) , i.e., the space of node hidden features h ( k ) v , is also countable for all k = 1 , ..., L .
Here, it is also worth discussing an important beneﬁt of GNNs beyond distinguishing different graphs, that is, capturing similarity of graph structures.
Note that node feature vectors in the WL test are essentially one-hot encodings and thus cannot capture the similarity between subtrees.
In contrast, a GNN satisfying the criteria in Theorem 3 generalizes the WL test by learning to embed the subtrees to low-dimensional space.
This enables GNNs to not only discriminate different structures, but also to learn to map similar graph structures to similar embeddings and capture dependencies between graph structures.
Capturing structural similarity of the node labels is shown to be helpful for generalization particularly when the co-occurrence of subtrees is sparse across different graphs or there are noisy edges and node features (Yanardag & Vishwanathan, 2015).
4. G RAPH I SOMORPHISM N ETWORK (GIN)
Next we develop a model that provably satisﬁes the conditions in Theorem 3 and thus generalizes the
WL test.
We name the resulting architecture Graph Isomorphism Network (GIN) .
To model injective multiset functions for the neighbor aggregation, we develop a theory of “deep multisets”, i.e. , parameterizing universal multiset functions with neural networks.
Our next lemma states that sum aggregators can represent injective, in fact, universal functions over multisets.
Lemma 5.
Assume X is countable.
There exists a function f : X → R n so that h ( X )
= (cid:80) x ∈ X f
( x ) is unique for each ﬁnite multiset X ⊂ X .
Moreover, any multiset function g can be decomposed as g ( X ) =
φ (cid:0)(cid:80) x ∈ X f ( x ) (cid:1) for some function φ .
We prove Lemma 5 in the appendix.
The proof extends the setting in (Zaheer et al., 2017) from sets to multisets.
An important distinction between deep multisets and sets is that certain popular injective set functions, such as the mean aggregator, are not injective multiset functions.
With the mechanism for modeling universal multiset functions in Lemma 5 as a building block, we can now come up with an aggregation scheme that can represent universal functions over the pairs of a node and the multiset of its neighors, and thus will satisfy the injectiveness condition in Theorem 3a. Our next corollary provides a simple and concrete formulation among many such aggregation schemes. Corollary 6. Assume X is countable.
There exists a function f : X → R n so that for inﬁnitely many choices of (cid:15) , including all irrational numbers, h ( c, X ) =
(1 + (cid:15) ) · f ( c ) + (cid:80) x ∈ X f ( x ) is unique for each pair ( c, X ) , where c ∈ X and X ⊂ X is a ﬁnite multiset.
Moreover, any function g over such pairs can be decomposed as g ( c, X ) =
φ (cid:0) (1 + (cid:15) ) · f ( c ) + (cid:80) x ∈ X f ( x ) (cid:1) for some function φ .
We can use multi-layer perceptrons (MLPs) to model and learn f and φ in Corollary 6, thanks to the universal approximation theorem (Hornik et al., 1989; Hornik, 1991).
In practice, we model f ( k +1) ◦ φ ( k ) with one MLP, because MLPs can represent the composition of functions.
In the ﬁrst iteration, we do not need MLPs before summation if input features are one-hot encodings as their summation alone is injective.
We can make (cid:15) a learnable parameter or a ﬁxed scalar.
Then, GIN updates node representations as
[Equation]
Generally, there may exist many other powerful GNNs.
GIN is one example among the maximally powerful GNNs, while being simple.
4. R EADOUT SUBTREE STRUCTURES OF DIFFERENT DEPTHS
An important aspect of the graph-level readout is that node representations, corresponding to subtree structures, get more reﬁned and global as the number of iterations increases.
A sufﬁcient number of iterations is key to achieving good discriminative power.
Yet, features from earlier iterations may sometimes generalize better.
To consider all structural information, GIN uses information from all depths/iterations of the model.
We achieve this by an architecture similar to Jumping
Knowledge Networks (JK-Nets) (Xu et al., 2018), where we replace Eq.
2.4 with graph representations concatenated across all iterations :
[Equation]
By Theorem 3 and Corollary 6, if GIN replaces READOUT in Eq.
4.2 with summing all node features from the same iterations (we do not need an extra MLP before summation for the same reason as in Eq. 4.1), it provably generalizes the WL test and the WL subtree kernel.
L ESS POWERFUL BUT STILL INTERESTING GNN S
Next we study GNNs that do not satisfy the conditions in Theorem 3, including GCN (Kipf & Welling, 2017) and GraphSAGE (Hamilton et al., 2017a).
We conduct ablation studies on two aspects of the aggregator in Eq.
4.1: (1) 1-layer perceptrons instead of MLPs and (2) mean or max-pooling instead of the sum.
We will see that these GNN variants get confused by surprisingly simple graphs and are less powerful than the WL test.
Nonetheless, models with mean aggregators like GCN perform well for node classiﬁcation tasks.
To better understand this, we precisely characterize what different GNN variants can and cannot capture about a graph and discuss the implications for learning with graphs.
5. A RE 1- LAYER PERCEPTRONS SUFFICIENT ?
The function f in Lemma 5 helps map distinct multisets to unique embeddings.
It can be parameterized by an MLP by the universal approximation theorem (Hornik, 1991).
Nonetheless, many [Figure] [Figure] existing GNNs instead use a 1-layer perceptron σ ◦ W (Duvenaud et al., 2015; Kipf & Welling, 2017;
Zhang et al., 2018), a linear mapping followed by a non-linear activation function such as a ReLU.
Such 1-layer mappings are examples of Generalized Linear Models (Nelder & Wedderburn, 1972).
Therefore, we are interested in understanding whether 1-layer perceptrons are enough for graph learning.
Lemma 7 suggests that there are indeed network neighborhoods (multisets) that models with 1-layer perceptrons can never distinguish.
Lemma 7.
There exist ﬁnite multisets X(cid:54) =
X 2 so that for any linear mapping W ,
[Equation]
The main idea of the proof for Lemma 7 is that 1-layer perceptrons can behave much like linear mappings, so the GNN layers degenerate into simply summing over neighborhood features.
Our proof builds on the fact that the bias term is lacking in the linear mapping.
With the bias term and sufﬁciently large output dimensionality, 1-layer perceptrons might be able to distinguish different multisets. Nonetheless, unlike models using MLPs, the 1-layer perceptron (even with the bias term) is not a universal approximator of multiset functions.
Consequently, even if GNNs with 1-layer perceptrons can embed different graphs to different locations to some degree, such embeddings may not adequately capture structural similarity, and can be difﬁcult for simple classiﬁers, e.g. , linear classiﬁers, to ﬁt.
In Section 7, we will empirically see that GNNs with 1 -layer perceptrons, when applied to graph classiﬁcation, sometimes severely underﬁt training data and often underperform GNNs with MLPs in terms of test accuracy.
5. S TRUCTURES THAT CONFUSE MEAN AND MAX - POOLING
What happens if we replace the sum in h ( X )
= (cid:80) x ∈ X f
( x ) with mean or max-pooling as in GCN and GraphSAGE?
Mean and max-pooling aggregators are still well-deﬁned multiset functions because they are permutation invariant.
But, they are not injective.
Figure 2 ranks the three aggregators by their representational power, and Figure 3 illustrates pairs of structures that the mean and max-pooling aggregators fail to distinguish.
Here, node colors denote different node features, and we assume the
GNNs aggregate neighbors ﬁrst before combining them with the central node.
In Figure 3a, every node has the same feature a and f ( a ) is the same across all nodes (for any function f ).
When performing neighborhood aggregation, the mean or maximum over f ( a ) remains f ( a ) and, by induction, we always obtain the same node representation everywhere.
Thus, mean and max-pooling aggregators fail to capture any structural information.
In contrast, a sum aggregator distinguishes the structures because 2 · f ( a ) and 3 · f ( a ) give different values.
The same argument can be applied to any unlabeled graph.
If node degrees instead of a constant value is used as node input features, in principle, mean can recover sum, but max-pooling cannot.
Fig.
3a suggests that mean and max have trouble distinguishing graphs with nodes that have repeating features.
Let h color ( r for red, g for green) denote node features transformed by f .
Fig.
3b shows that maximum over the neighborhood of the blue nodes yields max ( h g , h r ) and max ( h g , h r , h r ) , which collapse to the same representation.
Thus, max-pooling fails to distinguish them.
In contrast, the sum aggregator still works because 12 ( h g + h r ) and 13 ( h g + h r + h r ) are in general not equivalent.
Similarly, in Fig.
3c, both mean and max fail as 12 ( h g + h r ) =
( h g + h g
+ h r + h r ) .
5. M EAN LEARNS DISTRIBUTIONS
To characterize the class of multisets that the mean aggregator can distinguish, consider the example
X 1 = ( S, m ) and X 2 = ( S, k · m ) , where X 1 and X 2 have the same set of distinct elements, but
X 2 contains k copies of each element of X 1 .
Any mean aggregator maps X
and X 2 to the same embedding, because it simply takes averages over individual element features.
Thus, the mean captures the distribution (proportions) of elements in a multiset, but not the exact multiset.
Corollary 8.
Assume X is countable.
There exists a function f : X → R n so that for h ( X ) =|
X | (cid:80) x
∈ X f ( x ) , h ( X 1 )
=
h ( X 2 ) if and only if ﬁnite multisets X 1 and X 2 have the same distribution.
That is, assuming | X 2 | ≥ | X 1 | , we have X 1 =
( S, m ) and X 2 = ( S, k · m ) for some k ∈ N ≥ 1 .
The mean aggregator may perform well if, for the task, the statistical and distributional information in the graph is more important than the exact structure.
Moreover, when node features are diverse and rarely repeat, the mean aggregator is as powerful as the sum aggregator.
This may explain why, despite the limitations identiﬁed in Section 5.2, GNNs with mean aggregators are effective for node classiﬁcation tasks, such as classifying article subjects and community detection, where node features are rich and the distribution of the neighborhood features provides a strong signal for the task.
5. M AX - POOLING LEARNS SETS WITH DISTINCT ELEMENTS
The examples in Figure 3 illustrate that max-pooling considers multiple nodes with the same feature as only one node ( i.e. , treats a multiset as a set).
Max-pooling captures neither the exact structure nor the distribution.
However, it may be suitable for tasks where it is important to identify representative elements or the “skeleton”, rather than to distinguish the exact structure or distribution.
Qi et al.
(2017) empirically show that the max-pooling aggregator learns to identify the skeleton of a 3D point cloud and that it is robust to noise and outliers.
For completeness, the next corollary shows that the max-pooling aggregator captures the underlying set of a multiset.
Corollary 9.
Assume X is countable.
Then there exists a function f : X → R ∞ so that for h ( X ) = max x ∈ X f ( x ) , h ( X 1 )
=
h ( X 2 ) if and only if X 1 and X 2 have the same underlying set.
5. R EMARKS ON OTHER AGGREGATORS
There are other non-standard and complicated neighbor aggregation schemes that we do not cover in this paper, e.g. , Graph Attention Networks (Velickovic et al., 2018) and LSTM pooling (Hamilton et al., 2017a; Murphy et al., 2018).
We emphasize that our theoretical framework is general enough to characterize the representaional power of any message-passing-based GNNs with different aggregation schemes.
In the future, it would be interesting to apply our framework to analyze these aggregation schemes as well as others to gain theoretical understanding.  O THER R ELATED W ORK Despite the empirical success of GNNs, there have been few theoretical studies on them. Scarselli et al.
(2009a) shows the earliest GNN (Scarselli et al., 2009b) can approximate measurable functions in probability.
Lei et al.
(2017) shows their proposed architecture lies in the RKHS of graph kernels, but it does not tell which graphs can actually be distinguished.
These works focus on their speciﬁc
GNNs.
In contrast, our paper provides a general framework for analyzing and characterizing the expressive power of a broad class of GNNs.
Recently, a large number of GNN architectures have been proposed and applied.
Not surprisingly, some building blocks of GIN, e.g. sum aggregation and MLP encoding, also appeared in other models (Battaglia et al., 2016; Scarselli et al., 2009b;
Duvenaud et al., 2015).
While the previous architectures are often adhoc and complicated, our GIN architecture is simple and theoretically motivated.
E XPERIMENTS
We evaluate and compare the training and test performance of GIN and less powerful GNN variants.
Datasets.
We use 9 graph classiﬁcation benchmarks: 4 bioinformatics datasets (MUTAG, PTC,
NCI1, PROTEINS) and 5 social network datasets (COLLAB, IMDB-BINARY, IMDB-MULTI,
REDDIT-BINARY and REDDIT-MULTI5K) (Yanardag & Vishwanathan, 2015).
In the bioinformatic graphs, the nodes have categorical input features; in the social networks, they have no features.
For the REDDIT datasets, we set all node feature vectors to be the same (thus, features here are uninformative); for the other social graphs, we use one-hot encodings of node degrees.
Dataset statistics are summarized in Table 1, and more details of the data can be found in Appendix I.
Models and conﬁgurations.
We evaluate GINs (Eqs.
4.1 and 4.2) and the less powerful GNN variants. Under the GIN framework, we consider two variants: (1) GIN that learns (cid:15) in Eq. 4. by gradient descent, which we call GIN- (cid:15) , and (2) simpler (slightly less powerful) 1 GIN, where (cid:15) in Eq. 4.1 is ﬁxed to 0, which we call GIN-0.
As we will see, GIN-0 shows strong empirical performance: not only does GIN-0 ﬁt training data equally well as GIN- (cid:15) , it also demonstrates good generalization, slightly but consistently outperforming GIN- (cid:15) in terms of test accuracy.
For the less powerful GNN variants, we consider architectures that replace the sum in GIN-0 aggregation with mean or max-pooling 2 , or replace MLPs with 1-layer perceptrons, i.e. , a linear mapping followed by ReLU.
In Figure 4 and Table 1, a model is named by the aggregator/perceptron it uses.
We apply the same graph-level readout (READOUT in Eq. 4.2) for GINs and all GNN variants, speciﬁcally, sum readout on bioinformatics datasets and mean readout on social datasets due to better test performance.
Following (Yanardag & Vishwanathan, 2015; Niepert et al., 2016), we perform 10-fold crossvalidation with LIB-SVM (Chang & Lin, 2011). We report the average and standard deviation of validation accuracies across the 10 folds within the cross-validation.
For all conﬁgurations, 5 GNN layers (including the input layer) are applied, and all MLPs have 2 layers.
Batch normalization (Ioffe & Szegedy, 2015) is applied on every hidden layer.
We use the Adam optimizer (Kingma & Ba, 2015) with initial learning rate 0 . 01 and decay the learning rate by 0 . 5 every 50 epochs.
The hyper-parameters we tune for each dataset are: (1) The number of hidden units ∈ { 16 , 32 } for bioinformatics graphs and 64 for social graphs; (2) batch size ∈ { 32 , 128 } ; (3) dropout ratio ∈ { 0 , 0 . 5 } after the dense layer (Srivastava et al., 2014); (4) the number of epochs.
Baselines.
We compare the GNNs above with a number of state-of-the-art baselines for graph classiﬁcation: (1) The WL subtree kernel (Shervashidze et al., 2011), where C -SVM (Chang & Lin, 2011) was used as a classiﬁer.
The hyper-parameters we tune are C in SVM and the number of WL iterations ∈ { 1 , 2 , . .
. , 6 } ; (2) state-of-the-art deep learning architectures Diffusion-convolutional neural networks (DCNN)
(Atwood & Towsley, 2016), PATCHY-SAN (Niepert et al., 2016) and Deep
Graph CNN (DGCNN) (Zhang et al., 2018); (3) Anonymous Walk Embeddings (AWL) (Ivanov &
Burnaev, 2018).
For the deep learning methods and AWL, we report the accuracies reported in the original papers.
7. R ESULTS
Training set performance.
We validate our theoretical analysis of the representational power of
GNNs by comparing their training accuracies.
Figure 4 shows training curves of GINs and less powerful GNN variants with the same hyper-parameter settings.
First, both the theoretically most powerful GNN, i.e. GIN- (cid:15) (Sum–MLP), and GIN-0 are able to almost perfectly ﬁt all the training sets. In our experiments, explicit learning of (cid:15) in GIN- (cid:15) brings no gain in ﬁtting training data compared to ﬁxing (cid:15) to 0 as in GIN-0.
In comparison, the GNN variants using mean/max pooling or 1-layer [Figure] [Figure]
[Table] perceptrons severely underﬁt on many datasets.
In particular, the training accuracy patterns align with our ranking by the models’ representational power: GNN variants with MLPs tend to have higher training accuracies than those with 1-layer perceptrons, and GNNs with sum aggregators tend to ﬁt the training sets better than those with mean and max-pooling aggregators.
On our datasets training accuracies of the GNNs, however, never exceed those of the WL subtree kernel, which has the same discriminative power as the WL test.
For example, on IMDBBINARY, none of the models can perfectly ﬁt the training set, and the GNNs achieve at most the same training accuracy as the WL kernel.
This pattern aligns with our result that the WL test provides an upper bound for the representational capacity of the aggregation-based GNNs.
Our theoretical results focus on representational power and do not yet take into account optimization ( e.g. , local minima).
Nonetheless, the empirical results align very well with our theory.
Test set performance.
Next, we compare test accuracies.
Although our theoretical results do not directly speak about generalization ability of GNNs, it is reasonable to expect that GNNs with strong expressive power can accurately capture graph structures of interest and thus generalize well.
Tablecompares test accuracies of GINs (Sum–MLP), other GNN variants, as well as the state-of-the-art baselines.
First, GINs, especially GIN-0, outperform (or achieve comparable performance as) the less powerful GNN variants on all the 9 datasets, achieving state-of-the-art performance.
In particular, GINs shine on the social network datasets, which contain a relatively large number of training graphs. On the
Reddit datasets, the same one-dimensional vector was used as node features.
Here GINs and sumaggregation GNNs accurately capture the graph structure (as predicted in Section 5.2) and signiﬁcantly outperform other models.
Mean-aggregation GNNs, however, fail to capture structural information and do not perform better than random guessing.
Even if node degrees are provided as input features, mean-based GNNs perform much worse than sum-based GNNs, especially GINs.
Comparing among
GINs (GIN- (cid:15) and GIN-0), we observe that GIN-0 slightly but consistently outperforms GIN- (cid:15) .
Since both models ﬁt training data equally well, the better generalization of GIN-0 may be explained by its simplicity compared to GIN- (cid:15) .
C ONCLUSION
In this paper, we developed theoretical foundations for reasoning about expressive power of GNNs and proved tight bounds on the representational capacity of popular GNN variants.
Along the way, we also designed a provably most powerful GNN under the neighborhood aggregation framework.
An interesting direction for future work is to go beyond the neighborhood aggregation (or message passing) framework in order to pursue even more powerful architectures for learning with graphs.
It would also be interesting to understand and improve the generalization properties of GNNs.
A P ROOF FOR L EMMA
Proof.
Suppose after k iterations, a graph neural network
A has A ( G 1 ) (cid:54) =
A ( G 2 ) but the WL test cannot decide G 1 and G 2 are non-isomorphic.
It follows that from iteration 0 to k in the WL test,
G 1 and G 2 always have the same collection of node labels.
In particular, because G 1 and G 2 have the same WL node labels for iteration
i and i + 1 for any i = 0 , ..., k − 1 , G 1 and G 2 have the same collection, i.e. multiset, of WL node labels (cid:110) l ( i ) v (cid:111) as well as the same collection of node neighborhoods (cid:110)(cid:16) l ( i ) v , (cid:110) l ( i ) u : u ∈ N ( v ) (cid:111)(cid:17)(cid:111) .
Otherwise, the WL test would have obtained different collections of node labels at iteration i + 1 for G 1 and G 2 as different multisets get unique new labels.
The WL test always relabels different multisets of neighboring nodes into different new labels.
We show that on the same graph G =
G 1 or G 2 , if WL node labels l ( i ) v = l ( i ) u , we always have GNN node features h ( i ) v =
h ( i ) u for any iteration i .
This apparently holds for i = 0 because WL and GNN starts with the same node features.
Suppose this holds for iteration j , if for any u, v , l ( j +1) v =
l ( j +1) u , then it must be the case that
[Equation]
By our assumption on iteration j , we must have
[Equation]
In the aggregation process of the GNN, the same AGGREGATE and COMBINE are applied.
The same input, i.e. neighborhood features, generates the same output.
Thus, h ( j +1) v = h
( j +1) u .
By induction, if WL node labels l ( i ) v = l ( i ) u , we always have GNN node features h ( i ) v =
h ( i ) u for any iteration i .
This creates a valid mapping φ such that h ( i ) v = φ
( l ( i ) v ) for any v ∈ G .
It follows from
G 1 and G 2 have the same multiset of WL neighborhood labels that G 1 and G 2 also have the same collection of GNN neighborhood features
[Equation]
Thus, (cid:110) h ( i +1) v (cid:111) are the same.
In particular, we have the same collection of GNN node features (cid:110) h ( k ) v (cid:111) for G 1 and G 2 .
Because the graph level readout function is permutation invariant with respect to the collection of node features, A ( G 1 ) =
A ( G 2 ) .
Hence we have reached a contradiction.
B P ROOF FOR T HEOREM
Proof.
Let A be a graph neural network where the condition holds.
Let G 1 , G 2 be any graphs which the WL test decides as non-isomorphic at iteration K .
Because the graph-level readout function is injective, i.e. it maps distinct multiset of node features into unique embeddings, it sufﬁcies to show that A ’s neighborhood aggregation process, with sufﬁcient iterations, embeds G 1 and G 2 into different multisets of node features.
Let us assume A updates node representations as
[Equation]
with injective funtions f and φ .
The WL test applies a predetermined injective hash function g to update the WL node labels l ( k ) v .
[Equation]
We will show, by induction, that for any iteration k , there always exists an injective function ϕ such that h ( k ) v = ϕ (cid:16) l ( k ) v (cid:17) .
This apparently holds for k = 0 because the initial node features are the same for WL and GNN l (0) v = h (0) v for all v ∈ G 1 , G 2 .
So ϕ could be the identity function for k = 0 .
Suppose this holds for iteration k − 1 , we show that it also holds for k .
Substituting h ( k − 1) v with ϕ (cid:16) l ( k − 1) v (cid:17) gives us
[Equation]
It follows from the fact composition of injective functions is injective that there exists some injective function ψ so
that
[Equation]
Then we have
[Equation]
ϕ = ψ ◦ g − 1 is injective because the composition of injective functions is injective.
Hence for any iteration k , there always exists an injective function ϕ such that h ( k ) v [Equation] ϕ
[Equation] l ( k ) v (cid:17) . At the K -th iteration, the WL test decides that G 1 and G 2 are non-isomorphic, that is the multisets (cid:110) l ( K ) v (cid:111) are different for G 1 and G 2 .
The graph neural network A ’s node embeddings (cid:110) h ( K ) v (cid:111) =
(cid:110) ϕ (cid:16) l ( K ) v (cid:17)(cid:111) must also be different for G 1 and G 2 because of the injectivity of ϕ .
C P ROOF FOR L EMMA
Proof.
Before proving our lemma, we ﬁrst show a well-known result that we will later reduce our problem to: N k is countable for every k ∈ N , i.e. ﬁnite Cartesian product of countable sets is countable.
We observe that it sufﬁces to show N × N is countable, because the proof then follows clearly from induction.
To show N × N is countable, we construct a bijection φ from N × N to N as
[Equation]
Now we go back to proving our lemma.
If we can show that the range of any function g deﬁned on ﬁnite multisets of a countable set is also countable, then the lemma holds for any g ( k ) by induction.
Thus, our goal is to show that the range of such g is countable.
First, it is clear that the mapping from g ( X ) to X is injective because g is a well-deﬁned function.
It follows that it sufﬁces to show the set of all ﬁnite multisets X ⊂ X is countable.
By the union of two countable sets is countable, the following set X (cid:48) is also countable. [Equation] where e is a dummy element that is not in X .
It follows from the result we showed above, i.e. , N k is countable for every k ∈ N , that X (cid:48) k is countable for every k ∈ N . It remains to show there exists an injective mapping from the set of ﬁnite multisets in X to X (cid:48) k for some k ∈ N .
We construct an injective mapping h from the set of ﬁnite multisets X ⊂ X to X (cid:48) k for some k ∈ N as follows.
Because X is countable, there exists a mapping Z : X → N from x ∈ X to natural numbers.
We can sort the elements x ∈ X by z ( x ) as x 1 , x 2 , ..., x n , where n = | X | .
Because the multisets X are ﬁnite, there exists k ∈ N so that | X | < k for all X .
We can then deﬁne h as follows.
[Equation]
where the k − n coordinates are ﬁlled with the dummy element e . It is clear that h is injective because for any ﬁnite multisets X and Y , h ( X )
= h ( Y ) only if X is equivalent to Y . Hence it follows that the range of g is countable as desired.
D P ROOF FOR L EMMA
Proof.
We ﬁrst prove that there exists a mapping f
so that (cid:80) x ∈ X f ( x ) is unique for each ﬁnite multiset
X .
Because X is countable, there exists a mapping Z : X → N from x ∈ X to natural numbers.
Because the multisets X are ﬁnite, there exists a number N ∈ N so that | X | < N for all X .
Then an example of such f is f ( x ) =
N − Z ( x ) .
This f can be viewed as a more compressed form of an one-hot vector or N -digit presentation.
Thus, h ( X ) =
(cid:80) x ∈ X f
( x ) is an injective function of multisets.
φ (cid:0)(cid:80) x ∈ X f ( x ) (cid:1) is permutation invariant so it is a well-deﬁned multiset function.
For any multiset function g , we can construct such φ by letting φ (cid:0)(cid:80) x ∈ X f ( x ) (cid:1) =
g ( X ) .
Note that such φ is well-deﬁned because h ( X ) =
(cid:80) x ∈ X f
( x ) is injective.
E P ROOF OF C OROLLARY
Proof.
Following the proof of Lemma 5, we consider f ( x ) =
N − Z ( x ) , where N and Z : X → N are the same as deﬁned in Appendix D. Let h ( c, X ) ≡ (1 + (cid:15) ) · f ( c ) + (cid:80) x ∈ X f ( x ) .
Our goal is show that for any ( c (cid:48) , X (cid:48) )
(cid:54) =
( c, X ) with c, c (cid:48)
∈ X and ﬁnite multisets X, X (cid:48)
⊂ X , h ( c, X ) (cid:54) =
h ( c (cid:48) , X (cid:48) ) holds, if (cid:15) is an irrational number.
We prove by contradiction.
For any ( c, X ) , suppose there exists ( c (cid:48) , X (cid:48) )
such that ( c (cid:48) , X (cid:48) )
(cid:54) =
( c, X ) but h ( c, X )
= h ( c (cid:48) , X (cid:48) ) holds.
Let us consider the following two cases: (1) c (cid:48)
=
c but X (cid:48) (cid:54) =
X , and (2) c (cid:48) (cid:54) =
c .
For the ﬁrst case, h ( c, X )
=
h ( c, X (cid:48) ) implies (cid:80) x ∈ X f ( x )
= (cid:80) x ∈ X (cid:48)
f ( x ) .
It follows from Lemma 5 that the equality will not hold, because with f ( x ) =
N − Z ( x ) , X (cid:48) (cid:54) =
X implies (cid:80) x ∈ X f ( x ) (cid:54) =
(cid:80) x ∈ X (cid:48)
f ( x ) .
Thus, we reach a contradiction.
For the second case, we can similarly rewrite h ( c, X )
=
h ( c (cid:48) , X (cid:48) ) as (cid:15) · ( f ( c )
[Equation]
f ( c (cid:48)
[Equation]
= (cid:32) f
( c (cid:48)
[Equation]
+ (cid:88) x ∈ X (cid:48)
f ( x ) (cid:33) − (cid:32) f
( c
[Equation]
+ (cid:88) x ∈ X f ( x ) (cid:33) .
(E.1)
Because (cid:15) is an irrational number and f ( c ) − f ( c (cid:48) ) is a non-zero rational number, L.H.S. of Eq.
E. is irrational.
On the other hand, R.H.S. of Eq.
E.1, the sum of a ﬁnite number of rational numbers, is rational.
Hence the equality in Eq.
E.1 cannot hold, and we have reached a contradiction.
For any function g over the pairs ( c, X ) , we can construct such φ for the desired decomposition by letting φ (cid:0) (1 + (cid:15) ) · f ( c ) + (cid:80) x ∈ X f ( x ) (cid:1) =
g ( c, X ) .
Note that such φ is well-deﬁned because h ( c, X ) =
(1 + (cid:15) ) · f ( c ) + (cid:80) x ∈ X f ( x ) is injective.
F P ROOF FOR L EMMA
Proof.
Let us consider the example X
= { 1 , 1 , 1 , 1 , 1 } and X 2 = { 2 , 3 } , i.e. two different multisets of positive numbers that sum up to the same value.
We will be using the homogeneity of ReLU.
Let W be an arbitrary linear transform that maps x ∈ X 1 , X 2 into R n .
It is clear that, at the same coordinates, Wx are either positive or negative for all x because all x in X 1 and X 2 are positive.
It follows that ReLU ( Wx ) are either positive or 0 at the same coordinate for all x in X 1 , X 2 .
For the coordinates where ReLU ( Wx ) are 0 , we have (cid:80) x ∈ X 1 ReLU ( Wx ) =
(cid:80) x ∈ X 2 ReLU ( Wx ) .
For the coordinates where Wx are positive, linearity still holds.
It follows from linearity that
[Equation]
where X could be X 1 or X 2 .
Because (cid:80) x ∈ X 1 x = (cid:80) x ∈ X 2 x , we have the following as desired.
[Equation]
G P ROOF FOR C OROLLARY
Proof.
Suppose multisets X 1 and X 2 have the same distribution, without loss of generality, let us assume X
= ( S, m ) and X 2 = ( S, k · m ) for some k ∈ N ≥ 1 , i.e. X 1 and X 2 have the same underlying set and the multiplicity of each element in X 2 is k times of that in X 1 .
Then we have | X 2 | =
k | X 1 | and (cid:80) x ∈
X 2 f ( x )
= k · (cid:80) x ∈ X 1 f ( x ) .
Thus,
[Equation]
[Equation] X
[Equation]
Now we show that there exists a function f so that 1 | X | (cid:80) x ∈ X f ( x ) is unique for distributionally equivalent X .
Because X is countable, there exists a mapping Z : X → N from x ∈ X to natural numbers.
Because the multisets X are ﬁnite, there exists a number N ∈ N so that | X | < N for all X .
Then an example of such f is f ( x ) =
N − 2 Z ( x ) .
H P ROOF FOR C OROLLARY
Proof.
Suppose multisets X 1 and X 2 have the same underlying set S , then we have
[Equation]
Now we show that there exists a mapping f
so that max x ∈ X f ( x ) is unique for X s with the same underlying set.
Because X is countable, there exists a mapping Z : X → N from x ∈ X to natural numbers.
Then an example of such f : X → R ∞ is deﬁned as f i ( x )
= 1 for i
= Z ( x ) and f i ( x ) =otherwise, where f i ( x ) is the i -th coordinate of f ( x ) .
Such an f essentially maps a multiset to its one-hot embedding.
I D ETAILS OF DATASETS
We give detailed descriptions of datasets used in our experiments.
Furthre details can be found in (Yanardag & Vishwanathan, 2015).
Social networks datasets.
IMDB-BINARY and IMDB-MULTI are movie collaboration datasets.
Each graph corresponds to an ego-network for each actor/actress, where nodes correspond to actors/actresses and an edge is drawn betwen two actors/actresses if they appear in the same movie.
Each graph is derived from a pre-speciﬁed genre of movies, and the task is to classify the genre graph it is derived from.
REDDIT-BINARY and REDDIT-MULTI5K are balanced datasets where each graph corresponds to an online discussion thread and nodes correspond to users.
An edge was drawn between two nodes if at least one of them responded to another’s comment.
The task is to classify each graph to a community or a subreddit it belongs to.
COLLAB is a scientiﬁc collaboration dataset, derived from 3 public collaboration datasets, namely, High Energy Physics, Condensed
Matter Physics and Astro Physics.
Each graph corresponds to an ego-network of different researchers from each ﬁeld.
The task is to classify each graph to a ﬁeld the corresponding researcher belongs to.
Bioinformatics datasets.
MUTAG is a dataset of 188 mutagenic aromatic and heteroaromatic nitro compounds with 7 discrete labels.
PROTEINS is a dataset where nodes are secondary structure elements (SSEs) and there is an edge between two nodes if they are neighbors in the amino-acid sequence or in 3D space.
It has 3 discrete labels, representing helix, sheet or turn.
PTC is a dataset of 344 chemical compounds that reports the carcinogenicity for male and female rats and it hasdiscrete labels.
NCI1 is a dataset made publicly available by the National Cancer Institute (NCI) and is a subset of balanced datasets of chemical compounds screened for ability to suppress or inhibit the growth of a panel of human tumor cell lines, having 37 discrete labels.