Weisfeiler and Leman Go Relational
Abstract
Knowledge graphs, modeling multi-relational data, improve numerous applications such as question answering or graph logical reasoning.
Many graph neural networks for such data emerged recently, often outperforming shallow architectures.
However, the design of such multi-relational graph neural networks is ad-hoc, driven mainly by intuition and empirical insights.
Up to now, their expressivity, their relation to each other, and their (practical) learning performance is poorly understood.
Here, we initiate the study of deriving a more principled understanding of multi-relational graph neural networks.
Namely, we investigate the limitations in the expressive power of the well-known Relational GCN and Compositional
GCN architectures and shed some light on their practical learning performance.
By aligning both architectures with a suitable version of the Weisfeiler-Leman test, we establish under which conditions both models have the same expressive power in distinguishing non-isomorphic (multi-relational) graphs or vertices with different structural roles.
Further, by leveraging recent progress in designing expressive graph neural networks, we introduce the k - RN architecture that provably overcomes the expressiveness limitations of the above two architectures.
Empirically, we confirm our theoretical findings in a vertex classification setting over small and large multi-relational graphs.
Introduction
Recently, GNNs (Gilmer et al., 2017; Scarselli et al., 2009) emerged as the most prominent graph representation learning architecture.
Notable instances of this architecture include, e.g., Duvenaud et al.
Hamilton et al.
(2017) and Veliˇckovi´c et al.
(2018), which can be subsumed under the message-passing framework introduced in Gilmer et al.
In parallel, approaches based on spectral information were introduced in, e.g., Defferrard et al.
; Bruna et al.
Kipf and Welling (2017), and Monti et al.
(2017)—all of which descend from early work in Scarselli et al.
; Baskin et al.
; Kireev (1995); Micheli and Sestito (2005); Merkwirth and Lengauer (2005); Micheli (2009) and Sperduti and Starita (1997).
By now, we have a deep understanding of the expressive power of GNNs (Morris et al., 2021).
To start with, connections between GNNs and Weisfeiler–Leman type algorithms have been shown.
Specifically, Morris et al.
(2019) and Xu et al.
(2019) showed that the 1- WL limits the expressive power of any possible GNN architecture in terms of distinguishing non-isomorphic graphs.
In turn, these results have been generalized to the k - WL , see, e.g., Morris et al.
(2019); Azizian and Lelarge (2020);
Geerts et al.
; Geerts (2020); Maron et al.
; Morris et al.
(2020, 2022a), and connected to permutation-equivariant function approximation over graphs, see, e.g., Chen et al.
; Geerts and Reutter (2022); Maehara and NT (2019).
Barceló et al.
(2020) further established an equivalence between the expressiveness of GNNs with readout functions and C 2 , the 2 -variable fragment of first-order logic with counting quantifiers.
Most previous works focus on graphs that admit labels on vertices but not edges.
However, knowledge or multi-relational graphs , that admit labels on both vertices and edges play a crucial role in numerous applications, such as complex question answering in NLP (Fu et al., 2020) or visual question answering (Huang et al., 2022) in the intersection of NLP and vision.
To extract the rich information encoded in the graph’s multi-relational structure and its annotations, the knowledge graph community has proposed a large set of relational GNN architectures, e.g., Schlichtkrull et al.
; Vashishth et al.
; Ye et al.
(2022), tailored towards knowledge or multi-relational graphs, targeting tasks such as vertex and link prediction (Schlichtkrull et al., 2018;
Ye et al., 2022; Zhu et al., 2021).
Notably,
Schlichtkrull et al.
(2018) proposed the first architecture, namely, R-GCN , being able to handle multirelational data.
Further, Vashishth et al.
(2020) proposed an alternative GNN architecture, CompGCN , using less number of parameters and reported improved empirical performance.
In the knowledge graph reasoning area, R-GCN and CompGCN , being strong baselines, spun off numerous improved
GNNs for vertex classification and transductive link prediction tasks (Galkin et al., 2020; Yu et al., 2020; Zhang et al., 2022).
They also inspired architectures for more complex reasoning tasks such as inductive link prediction (Zhu et al., 2021;
Teru et al., 2020; Ali et al., 2021a; Zhang and Yao, 2022) and query answering (Daza and Cochez, 2020; Alivanistos et al., 2022; Zhu et al., 2022).
Although these approaches show meaningful empirical performance, their limitations in extracting relevant structural information, their learning performance, and their relation to each other are not understood well.
For example, there is no understanding of these approaches’ inherent limitations in distinguishing between knowledge graphs with different structural features, explicitly considering the unique properties of multi-relational graphs.
Hence, a thorough theoretical investigation of multi-relational GNNs’ expressive power and learning performance is yet to be established to become meaningful, vital components in today’s knowledge graph reasoning pipeline.
Present Work.
Here, we initiate the study on deriving a principled understanding of the capabilities of GNNs for knowledge or multi-relational graphs.
More concretely:
• We investigate the expressive power of two well-known GNNs for multi-relation data, Relational GCNs ( R-GCN ) (Schlichtkrull et al., 2018) and Compositional GCNs ( CompGCN ) (Vashishth et al., 2020).
We quantify their limitations by relating them to a suitable version of the established Weisfeiler-Leman graph isomorphism test.
In particular, we show under which conditions the above two architectures possess the same expressive power in distinguishing non-isomorphic, multi-relational graphs or vertices with different structural features.
• To overcome both architectures’ expressiveness limitations, we introduce the k - RN architecture, which provably overcomes their limitations and show that increasing k always leads to strictly more expressive architectures.
• Empirically, we confirm our theoretical findings on established small- and large-scale multirelational vertex classification benchmarks.
See Subsection A.1 in the appendix for an expanded
discussion of
related work.
Preliminaries
As usual, let [ n ] = { 1 , . . . , n } ⊂ N for n ≥ 1 , and let {{ . . .
}} denote a multiset.
A (undirected) graph G is a pair ( V ( G ) , E ( G )) with a finite set of vertices V ( G ) and a set of edges
E ( G ) ⊆ {{ u, v } ⊆
V | u ̸ = v } .
For notational convenience, we usually denote an edge { u, v } in
E ( G ) by ( u, v ) or ( v, u ) .
We assume the usual definition of adjacency matrix A of G .
A colored or labeled graph G is a triple ( V ( G ) , E ( G ) , ℓ ) with a coloring or label function ℓ : V ( G ) → N .
Then ℓ ( w ) is a color or label of w , for w in V ( G ) .
The neighborhood of v in V ( G ) is denoted by
N ( v ) = { u ∈ V ( G ) | ( v, u
) ∈ E ( G ) } .
An (undirected) multi-relational graph G is a tuple ( V ( G ) , R 1 ( G ) , . . .
, R r ( G )) with a finite set of vertices
V ( G ) and relations R i ⊆ {{ u, v } ⊆
V ( G ) | u ̸ = v } for i in [ r ] .
The neighborhood of v in
V ( G ) with respect to the relation R i is denoted by N i ( v ) =
{ u ∈ V ( G ) | ( v, u ) ∈
R i } .
We define colored (or labeled ) multi-relational graphs in the expected way.
Two graphs G and H are isomorphic ( G ≃ H ) if there exists a bijection φ : V ( G ) → V ( H ) preserving the adjacency relation, i.e., ( u, v ) in E ( G ) if and only if ( φ ( u ) , φ ( v )) in E ( H ) .
We then call φ an isomorphism from G to H .
If the graphs have vertex labels, the isomorphism is additionally required to match these labels.
In the case of multi-relational graphs G and H , the bijection φ : V ( G ) → V ( H ) needs to preserve all relations, i.e., ( u, v ) is in R
i ( G ) if and only if ( φ ( u ) , φ ( v )) is in R
i ( H ) for each i in [ r ] .
For labeled multi-relational graphs, the bijection needs to preserve the labels.
We define the atomic type atp : V ( G ) k
→ N such that atp ( v ) =
atp ( w ) for v and w in V ( G ) k
if and only if the mapping φ : V ( G ) → V ( G ) where v i (cid:55)→ w i induces a partial isomorphism , i.e., v i = v j ⇐⇒ w i = w j and ( v i , v j ) in E ( G )
⇐⇒ ( φ ( v i ) , φ ( v j )) in E ( G ) .
The Weisfeiler-Leman Algorithm.
The 1 -dimensional Weisfeiler-Leman algorithm ( 1 - WL ), or color refinement , is a simple heuristic for the graph isomorphism problem, originally proposed by Weisfeiler and Leman (1968).
Intuitively, the algorithm determines if two graphs are nonisomorphic by iteratively coloring or labeling vertices.
Given an initial coloring or labeling of the vertices of both graphs, e.g., their degree or application-specific information, in each iteration, two vertices with the same label get different labels if the number of identically labeled neighbors is not equal.
If, after some iteration, the number of vertices annotated with a specific label is different in both graphs, the algorithm terminates and a stable coloring, inducing a vertex partition, is obtained.
We can then conclude that the two graphs are not isomorphic.
It is easy to see that the algorithm cannot distinguish all non-isomorphic graphs (Cai et al., 1992a).
Nonetheless, it is a powerful heuristic that can successfully test isomorphism for a broad class of graphs (Arvind et al., 2015; Babai and Kucera, 1979; Kiefer et al., 2015).
Formally, let G =
( V ( G ) , E ( G ) , ℓ ) be a labeled graph.
In each iteration, t > 0 , the 1- WL computes a vertex coloring C ( t ) : V ( G ) → N , which depends on the coloring of the neighbors.
That is, in iteration t > 0 , we set
[Equation]
where RELABEL injectively maps the above pair to a unique natural number, which has not been used in previous iterations.
In iteration 0 , the coloring C (0) := ℓ .
To test if two graphs G and H are non-isomorphic, we run the above algorithm in “parallel” on both graphs.
If the two graphs have a different number of vertices colored c in N at some iteration, the 1 - WL distinguishes the graphs as non-isomorphic.
Moreover, if the number of colors between two iterations, t and ( t + 1) , does not change, i.e., the cardinalities of the images of C ( t ) and C ( t +1) are equal, or, equivalently,
[Equation]
for all vertices v and w in V ( G ) , the algorithm terminates.
For such t , we define the stable coloring
C ∞ ( v ) =
C ( t ) ( v ) for v in V ( G ) .
The stable coloring is reached after at most max {| V ( G ) | , | V ( H ) |} iterations (Grohe, 2017).
Due to the shortcomings of the 1- WL in distinguishing non-isomorphic graphs, several researchers, e.g., (Babai, 1979; Cai et al., 1992b), devised a more powerful generalization of the former, today known as the k -dimensional Weisfeiler-Leman algorithm ( k - WL ), see Subsection A.2 for details.
Graph Neural Networks.
Intuitively, GNNs learn a vectorial representation, i.e., a d -dimensional vector, representing each vertex in a graph by aggregating information from neighboring vertices.
Formally let G =
( V ( G ) , E ( G ) , ℓ ) be a labeled graph with initial vertex features ( h (0) v ) v ∈ V ( G ) in
R d that are consistent with ℓ , that is, h (0)
u
= h (0) v if and only if ℓ ( u ) =
ℓ ( v ) , e.g., a one-hot encoding of the labelling ℓ .
Alternatively, ( h (0) v ) v ∈ V ( G ) can be arbitrary vertex features annotating the vertices of G .
A GNN architecture consists of a stack of neural network layers, i.e., a composition of permutationinvariant or -equivariant parameterized functions.
Similarly to 1 - WL , each layer aggregates local neighborhood information, i.e., the neighbors’ features, around each vertex and then passes this aggregated information on to the next layer.
GNNs are often realized as follows (Morris et al., 2019).
In each layer, t > 0 , we compute vertex features
[Equation]
for v in V ( G ) , where W ( t ) 0 and W ( t ) 1 are parameter matrices from R d × e and σ denotes an entry-wise non-linear function, e.g., a sigmoid or a ReLU function.
4 Following Gilmer et al.
(2017) and Scarselli et al.
(2009), in each layer, t > 0 , we can generalize the above by computing a vertex feature
[Equation]
where UPD ( t ) and AGG ( t ) may be differentiable parameterized functions, e.g., neural networks.
In the case of graph-level tasks, e.g., graph classification, one uses
[Equation]
, to compute a single vectorial representation based on learned vertex features after iteration T .
Again,
READOUT may be a differentiable parameterized function.
To adapt the parameters of the above three functions, they are optimized end-to-end, usually through a variant of stochastic gradient descent, e.g., (Kingma and Ba, 2015), together with the parameters of a neural network used for classification or regression.
Graph Neural Networks for Multi-relational Graphs.
In the following, we describe GNN layers for multi-relational graphs, namely R-GCN (Schlichtkrull et al., 2018) and CompGCN (Vashishth et al., 2020).
Initial features are computed in the same way as in the previous subsection.
R-GCN .
Let G be a labeled multi-relational graph.
In essence, R-GCN generalizes Equation 1 by using an additional sum iterating over the different relations.
That is, we compute a vertex feature
[Equation]
for v in V ( G ) , where W ( t ) 0 and W ( t ) i for i in [ r ] are parameter matrices from R d × e , and σ denotes a entry-wise non-linear function.
We note here that the original R-GCN layer defined in Schlichtkrull et al.
(2018) uses a mean operation instead of a sum in the most inner sum of Equation 2.
We investigate the empirical advantages of these two variations in Section 5.
CompGCN .
Let G be a labeled multi-relational graph.
A CompGCN layer generalizes Equationby encoding relational information as edge features.
That is, we compute a vertex feature
[Equation]
for v in V ( G ) , where W ( t ) 0 and W ( t ) 1 are parameter matrices from R d × e and R c × e , respectively, and z ( t ) i in R b is the learned edge feature for the i th relation at layer t .
Further, the function ϕ : R d × R b → R c is a composition map , mapping two vectors onto a single vector in a nonparametric way, e.g., summation, point-wise multiplication, or concatenation.
We note here that the original CompGCN layer defined in Vashishth et al.
(2020) uses an additional sum to differentiate between in-going and out-going edges and self loops, see Section E for details.
Strictly speaking, Gilmer et al.
(2017) consider a slightly more general setting in which vertex features are computed by h ( t +1) v :=
UPD
[Equation]
t +
[Equation]
Relational Weisfeiler–Leman Algorithm
In the following, to study the limitations in expressivity of the above two GNN layers, R-GCN and
CompGCN , we define the multi-relational 1 - WL ( 1 - RWL ).
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then the 1 - RWL computes a vertex coloring C ( t ) R : V ( G )
→ N for t > 0 by interpreting the different relations as edge types, i.e.,
[Equation]
for v in V ( G ) .
In iteration 0 , the coloring C (
[Equation]
) R := ℓ .
In particular, two vertices v and w of the same color in iteration ( t − 1) get different colors in iteration t if there is a relation R i such that the number of neighbors in N i ( v ) and N i ( w ) colored with a certain color is different.
We define the stable coloring C ∞ R in the expected way, analogously to the 1 - WL .
Relationship Between 1 - WL and 1 - RWL .
Since 1 - WL does not consider edge labels it is clear that 1 - RWL is strictly stronger than the 1 - WL .
For example, take a pair of isomorphic graphs and label the edges differently in each graphs, making the graph non-isomorphic.
Clearly, 1 - RWL will distinguish them while 1 - WL will not.
Relationship Between 1 - RWL , R-GCN , and CompGCN .
Morris et al.
; Xu et al.
(2019) established the exact relationship between the expressive power of 1 - WL and GNNs.
In particular, 1 - WL upper bounds the capacity of any GNN architecture for distinguishing vertices in graphs.
In turn, over every graph G there is a GNN architecture with the same expressive power as 1- WL for distinguishing vertices in G .
In this section, we show that the same relationship can be established between multi-relational 1- WL , on the one hand, and the R-GCN and CompGCN architectures, on the other.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph, and let
[Equation]
denote the sequence of R-GCN parameters given by Equation 2 up to iteration t .
Analogously, we denote by
[Equation]
the sequence of CompGCN parameters given by Equation 3 up to iteration t .
We first show that the multi-relational 1 - WL upper bounds the expressivity of both the R-GCN and CompGCN layers in terms of their capacity to distinguish vertices in labeled multi-relational graphs.
Theorem 1.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 the following holds:
• For all choices of initial vertex features consistent with ℓ , sequences W ( t ) R-GCN of R-GCN parameters, and vertices v and w in V ( G ) ,
[Equation]
• For all choices of initial vertex features consistent with ℓ , sequences W ( t ) CompGCN of CompGCN parameters, composition functions ϕ , and vertices v and w in V ( G ) ,
[Equation]
Noticeably, the converse also holds.
That is, there is a sequence of parameter matrices W ( t ) R-GCN such that R-GCN has the same expressive power in terms of distinguishing vertices in graphs as the coloring
C ( t ) R .
This equivalence holds provided the initial labels are encoded by linearly independent vertex features, e.g., using one-hot encodings.
The result also holds for CompGCN as long as the composition map ϕ can express vector scaling, e.g., ϕ is point-wise multiplication or circular correlation, two of the composition functions studied and implemented in the paper that introduced the CompGCN architecture (Vashishth et al., 2020).
Theorem 2.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 the following holds:
• There are initial vertex features and a sequence W ( t ) R-GCN of parameters such that for all v and w in V
[Equation]
G ) ,
[Equation]
• There are initial vertex features, a sequence W ( t ) CompGCN of parameters and a composition function ϕ such that for all v and w in V ( G ) ,
[Equation]
On the Choice of the Composition Function for CompGCN Architectures.
As Theorem 2 shows the expressive power of the 1- RWL is matched by that of the CompGCN architectures if we allow the latter to implement vector scaling in composition functions.
However, not all composition maps that have been considered in relationship with CompGCN architectures admit such a possibility.
Think, for instance, of natural composition maps such as point-wise summation or vector concatenation.
Interestingly, we can show that CompGCN architectures equipped with these composition maps are provably weaker in terms of expressive power than the ones studied in the proof of Theorem 2, as they correlate with a weaker variant of 1- WL that we define next.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
The weak multirelational 1 - WL computes a vertex coloring C ( t ) WR : V ( G ) → N for t > 0 as follows:
[Equation]
u ∈ N i ( v ) }} , | N 1 ( v ) | , . .
| N r ( v ) | (cid:1)(cid:17) , for v in V ( G ) .
In iteration 0 , the coloring C (0) WR := ℓ .
During aggregation, the weak variant does not take information about the relations into account.
The only information relative to the different relations is the number of neighbors associated with each of them.
We define the stable coloring C ∞ WR analogously to the 1 - WL .
As it turns out, this variant is less powerful than the original one.
Proposition 3.
There exist a labeled, multi-relational graph G =
( V ( G ) , R 1 ( G ) , R 2 ( G ) , ℓ ) and two vertices v and w in V ( G ) , such that C (1) R ( v )
̸ = C (1) R ( w ) but C ∞
WR ( v ) =
C ∞ WR ( w ) .
As shown next, the expressive power of CompGCN architectures that use point-wise summation or vector concatenation is captured by this weaker form of 1 - RWL .
Theorem 4.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 the following holds
: • For all choices of initial vertex features consistent with ℓ , sequences W ( t ) CompGCN of CompGCN parameters, and vertices v and w in V ( G ) ,
[Equation]
for either point-wise summation or concatenation as the composition map.
• There exist initial vertex features and a sequence W ( t ) CompGCN of CompGCN parameters, such that for all vertices v and w in V ( G ) ,
[Equation]
) WR
[Equation] [Equation]
[Equation] [Equation]
t )
[Equation]
CompGCN =
h
[Equation]
t ) w, CompGCN , for either point-wise summation or concatenation as the composition map.
Together with Proposition 3 and Theorem 2, this result states that CompGCN architectures based on vector summation or concatenation are provably weaker in terms of their capacity to distinguish vertices in graphs than the ones that use vector scaling.
We have shown that R-GCN and CompGCN with point-wise multiplication have the same expressive power in terms of distinguishing non-isomorphic multi-relational graphs or distinguishing vertices in a multi-relational graph.
As it turns out, these two architectures actually define the same functions.
A similar result holds between CompGCN with vector summation/subtraction and concatenation.
See
Appendix B.2 for details.
Limitations and More Expressive Architectures
Theorem 1 shows that both R-GCN as well as CompGCN have severe limitations in distinguishing structurally different multi-relational graphs.
Indeed, the following results shows that there exists pairs of non-isomorphic, multi-relational graphs that neither R-GCN nor CompGCN can distinguish.
Proposition 5.
For all r ≥ 1 , there exists a pair of non-isomorphic graphs G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) and H =
( V ( H ) , R 1 ( H ) , . . .
, R r ( H ) , ℓ ) that cannot be distinguished by R-GCN or CompGCN .
We note here that the two graphs G and H from the above theorem can also be used to show that neither R-GCN nor CompGCN will be able to compute different features for vertices in G and H , making them indistinguishable.
Hence, to overcome the limitations of the CompGCN and R-GCN , we introduce local k -order relational networks ( k - RN s), leveraging recent progress in overcoming
GNNs’ inherent limitations in expressive power (Morris et al., 2021, 2019, 2020, 2022a).
To do so, we first extend the local k -dimensional Weisfeiler–Leman algorithm (Morris et al., 2020), see
Subsection A.2, to multi-relational graphs.
Multi-relational Local k - WL .
Given a multi-relational graph G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) , we define the multi-relational atomic type atp r : V ( G ) k
→ N such that atp r ( v ) =
atp r ( w ) for v and w in V ( G ) k
if and only if the mapping φ : V ( G ) → V ( G ) where v g (cid:55)→ w g induces a partial isomorphism, preserving the relations, i.e., we have v p =
v q ⇐⇒ w p = w q
and ( v p , v q ) ∈
R i ( G )
⇐⇒ ( φ ( v p ) , φ ( v q ))
∈
R i ( G ) for i in [ r ] .
The multi-relational local k - WL ( k - RLWL ) computes the coloring C ( t ) k,r : V ( G ) k
→ N for t ≥ 0 , where C (0) k,r :=
atp r ( v ) , and refines a coloring
C ( t ) k,r (obtained after t iterations of the k - RLWL ) via the aggregation function
[Equation]
where θ j ( v , w ) :
= ( v 1 , . .
. , v j − 1 , w, v j +1 , . .
, v k ) .
That is, θ j ( v , w ) replaces the j -th component of the tuple v with the vertex w .
Like the local k - WL (Morris et al., 2020), the algorithm considers only the local j -neighbors, i.e., v i and w must be adjacent, for each relation in each iteration and additionally differentiates between different relations.
The coloring functions for the iterations of the multi-relational k - RLWL are then defined by
[Equation]
In the following, we derive a neural architecture, the k - RN , that has the same expressive power as the k - RLWL in terms of distinguishing non-isomorphic multi-relational graphs.
The k - RN Architecture.
Given a labeled, multi-relational graph G , for each k -tuple v in V ( G ) k , a k - RN architecture computes an initial feature h (0) v consistent with its multi-relational atomic type, e.g., a one-hot encoding of atp r ( v ) .
In each layer, t > 0 , a k - RN computes a k -tuple feature h ( t ) v ,k :=
UPD ( t ) (cid:16) h ( t
[Equation]
1) v ,k , AGG ( t ) (cid:0) {{ ϕ ( h ( t
[Equation]
1) θ 1 ( v ,w ) ,k , z ( t ) i ) | w ∈ N i ( v 1 ) and i ∈ [ r ] }} , . . . ,
[Equation]
t
[Equation]
θ k ( v ,
[Equation]
) ,k , z
[Equation]
t )
i
[Equation]
i
[Equation]
where the functions UPD ( t ) and AGG ( t ) for t > 0 may be a differentiable parameterized functions, e.g., neural networks.
Similarly to Equation 3, z ( t ) i in R c is the learned edge feature for the i th relation at layer t and ϕ : R d × R b → R c is a composition map.
In the case of graph-level tasks, e.g., graph classification, one uses
[Equation]
to compute a single vectorial representation based on learned k -tuple features after iteration T .
The following results shows that the k - RLWL upperbounds the expressivity of any k - RN in terms of distinguishing non-isomorphic graphs.
Proposition 6.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 , r > 0 , k ≥ 1 , and all choices of UPD ( t ) , AGG ( t ) , and all v and w in V ( G ) k ,
[Equation]
Moreover, we can also show the converse, resulting in the following theorem.
Proposition 7.
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 and k ≥ 1 , there exists UPD ( t ) , AGG ( t ) , such that for all v and w in V ( G ) k ,
[Equation]
The following result implies that increasing k leads to a strict boost in terms of expressivity of the k - RLWL and k - RN architectures in terms of distinguishing non-isomorphic multi-relational graphs.
Proposition 8.
For k ≥ 2 and r ≥ 1 , there exists a pair of non-isomorphic multi-relational graphs
G r =
( V ( G r ) , R 1 ( G r ) , . . .
, R r ( G r ) , ℓ ) and H =
( V ( H r ) , R 1 ( H r ) , . . .
, R r
( H r ) , ℓ ) such that:
• For all choices of UPD ( t ) , AGG ( t ) , for t > 0 , and READOUT the k - RN architecture will not distinguish the graphs G r and H r .
• There exists UPD ( t ) , AGG ( t ) , for t > 0 , and READOUT such that the ( k +1) - RN will distinguish them.
Moreover, the following results shows that for k = 2 the k - RN architecture is strictly more expressive than CompGCN and R-GCN in distinguishing non-isomophics graphs.
Corollary 9.
There exists a 2 - RN architecture that is strictly more expressive than the CompGCN and the R-GCN architecture in terms of distinguishing non-isomorphic graphs.
k - RN s for Vertex-level Prediction.
As defined in Equations 6 and 7, an k - RN architecture either computes k -tuple- or graph-level features.
However, it is straightforward to compute a vertex-level features, see, e.g., Morris et al.
(2022b, Section 4.1).
Scalability.
Although the k - RN is provably expressive, see Proposition 8, it suffer some high memory requirement.
Similar to the k - WL , it’s memory complexity can only be lower bounded in Ω ( n k ) , making it not applicable for large knowledge graphs.
However, recent progress in making higher-order architectures more scalable, e.g., Morris et al.
(2022b); Bevilacqua et al. (2021);
Qian et al.
(2022), can be straightforwardly lifted to the multi-relational case.
Experimental Study
Here, we investigate to what extend the above theoretical results hold for real-world data distributions.
Specifically, we aim to answer the following questions.
Q1 Does the theoretical equivalence of R-GCN and CompGCN hold in practice?
Q2 Does the performance depend on the dimension of vertex features?
Q3 Does CompGCN benefit from normalization and learnable edge weights?
Q4 Does the theoretical difference in composition functions of CompGCN hold in practice?
Datasets.
To answer Q1 to Q4, we investige R-GCN and CompGCN ’s empirical performance on the small-scale AIFB (6 000 vertices) and the large-scale AM (1.6 million vertices) (Ristoski et al., 2016) vertex classification benchmark dataset; see Section F for dataset statistics.
[Figure]
Featurization.
Most relational GNNs for vertex- and link-level tasks assume that the initial vertex states come from a learnable vertex embedding matrix (Wang et al., 2021; Ali et al., 2021b).
However, this vertex feature initialization or featurization method makes the model inherently transductive, i.e., the model must be re-trained when adding new vertices.
Moreover, such an initialization strategy is incompatible with our Weisfeiler-Leman-based theoretical results since a learnable vertex embedding matrix will result in most initial vertex features being pair-wise different.
Here, however, being faithful to the Weisfeiler-Leman formulation, we initialize all vertex features with the same d -dimensional vector, namely, a standard basis vector of R d , e.g., (1 , 0 , . .
. , 0) in R d . 6 Relation-specific weight matrices in the case of R-GCN and edge features in the case of CompGCN are still learnable.
We stress here that such a featurization strategy endows GNNs with inductive properties.
Since we are using the same vertex feature initialization, we can run inference on previously unseen vertices or graphs.
Implementation.
We use the R-GCN and CompGCN implementation provided by PyG framework (Fey and Lenssen, 2019).
The source code of all methods and evaluation procedures is available at https://github.com/migalkin/RWL .
For the smaller AIFB dataset, both models use two GNN layers.
For the larger AM dataset, R-GCN saturates with three layers.
Following the theory, we do not use any basis decomposition of relation weights in R-GCN .
We list other hyperparameters in
Section F. We report averaged results of five independent runs using different random seeds.
We conducted all experiments in the full-batch mode on a single GPU (Tesla V100 32 GB or RTX 8000).
Discussion.
Probing R-GCN with different aggregations and CompGCN on the smaller AIFB (Figure 1a) and larger AM (Figure 1b) datasets, we largely confirm the theoretical hypothesis of their expressiveness equivalence ( Q1 ) and observe similar performance of both GNNs.
The higher variance on AIFB is due to the small test set size (36 vertices), i.e., one misclassified vertex drops accuracy by ≈ 3% .
To test if increasing the input vertex feature dimensions leads to more expressive GNN architectures ( Q2 ), we vary the initial vertex feature dimension in { 2 , 4 , 8 , . . .
, 64 , 128 } on the smaller AIFB dataset (Figure 1a) and do not observe any significant differences starting from d = 4 and above.
Having identified that, we report the best results of compared models on the larger AM graph with the vertex feature dimension d in { 4 , 8 } .
Following the theory where the sum aggregator is most expressive, we investigate this finding on the smaller AIFB dataset for both GNNs.
R-GCN with mean aggregation shows slightly better results on the larger AM dataset, which we attribute to the unstable optimization process of the sum aggregator where vertices might have thousands of neighbors, leading to large losses and noisy gradients.
We hypothesize that stabilizing the training process on larger graphs might improve performance.
Furthermore, we perform an ablation study (Figure 2) of main CompGCN components ( Q3 ), i.e., direction-based weighting (over direct, inverse, and self-loop edges), relation projection update in each layer, and message normalization in the GCN style D − 12 AD − 12 ; see also Sections E and D.
[Figure]
[Figure]
The crucial components for the smaller and larger graphs are (1) three-way direction-based message passing and (2) normalization.
Replacing message passing over three directions (and three weight matrices) with one weight matrix using a single adjacency leads to a significant drop in performance.
Removing normalization increases variance in the larger graph.
Finally, removing both directionality and normalization leads to significant degradation in predictive performance.
Studying composition functions (Figure 3), we do not find significant differences among nonparametric mult , add , rotate functions ( Q4 ); see Section E. Performance of an MLP over a concatenation of vertex and edge features falls within confidence intervals of other compositions and does not exhibit a significant accuracy boost.
Conclusion
Here, we investigated the expressive power of two popular GNN architectures for knowledge or multirelational graphs, namely, CompGCN and R-GCN .
By deriving a variant of the 1 - WL , we quantified their limits in distinguishing vertices in multi-relational graphs.
Further, we investigated under which conditions, i.e., the choice of the composition function, CompGCN , reaches the same expressive power as R-GCN .
To overcome the limitations of the two architectures, we derived the provably more powerful k - RN architecture.
By increasing k , the k - RN architecture gets strictly more expressive.
Empirically, we verified that our theoretical results translate largely into practice.
Using CompGCN and R-GCN in a vertex classification setting over small and large multi-relational graphs shows that both architectures provide a similar performance level.
We believe that our paper is the first step in a principled design of GNNs for knowledge or multi-relational graphs.
Acknowledgements
Pablo Barceló is funded by Fondecyt grant 1200967, the ANID - Millennium Science Initiative
Program - Code ICN17002, and the National Center for Artificial Intelligence CENIA FB210017,
Basal ANID.
Mikhail Galkin is funded by the Samsung AI grant held at Mila.
Christopher Morris is partially funded a DFG Emmy Noether grant (468502433) and RWTH Junior Principal Investigator
Fellowship under the Excellence Strategy of the Federal Government and the Länder.
Miguel Romero is funded by Fondecyt grant 11200956, the Data Observatory Foundation, and the National Center for Artificial Intelligence CENIA FB210017, Basal ANID.
A Appendix A.1 Related Work
In the following, we expand on relevant related work.
GNNs.
Recently, GNNs (Gilmer et al., 2017; Scarselli et al., 2009) emerged as the most prominent graph representation learning architecture.
Notable instances of this architecture include, e.g., Duvenaud et al.
Hamilton et al.
(2017) and Veliˇckovi´c et al.
(2018), which can be subsumed under the message-passing framework introduced in Gilmer et al.
In parallel, approaches based on spectral information were introduced in, e.g., Defferrard et al.
; Bruna et al.
Kipf and Welling (2017) and Monti et al.
(2017)—all of which descend from early work in Scarselli et al.
; Baskin et al.
; Kireev (1995); Micheli and Sestito (2005); Merkwirth and Lengauer (2005); Micheli (2009) and Sperduti and Starita (1997).
Limits of GNNs and More Expressive Architectures.
Recently, connections between GNNs and Weisfeiler–Leman type algorithms have been shown (Morris et al., 2019; Xu et al., 2019).
Specifically, Morris et al.
(2019) and Xu et al.
(2019) showed that the 1- WL limits the expressive power of any possible GNN architecture in terms of distinguishing non-isomorphic graphs.
In turn, these results have been generalized to the k - WL , see, e.g., Morris et al.
(2019); Azizian and Lelarge (2020);
Geerts et al.
; Geerts (2020); Maron et al.
; Morris et al.
(2020, 2022a), and connected to permutation-equivariant function approximation over graphs, see, e.g., Chen et al.
; Geerts and Reutter (2022); Maehara and NT (2019).
Barceló et al.
(2020) further established an equivalence between the expressiveness of GNNs with readout functions and C 2 , the 2 -variable fragment of first-order logic extended by counting quantifiers.
Relational GNNs.
Relational GNNs enjoy a profound usage in many areas of machine learning, such as complex question answering in NLP (Fu et al., 2020) or visual question answering (Huang et al., 2022) in the intersection of NLP and vision.
Notably, Schlichtkrull et al.
(2018) proposed the first architecture, namely, R-GCN , being able to handle multi-relational data.
Further, Vashishth et al.
(2020) proposed an alternative GNN architecture, namely, CompGCN , using less number of parameters and reporting improved empirical performance.
In the knowledge graph reasoning area, R-GCN and CompGCN , being strong baselines, spun off numerous improved GNNs for vertex classification and transductive link prediction tasks (Galkin et al., 2020; Yu et al., 2020; Zhang et al., 2022).
Furthermore, they inspired architectures for more complex reasoning tasks such as inductive link prediction (Zhu et al., 2021;
Teru et al., 2020; Ali et al., 2021a; Zhang and Yao, 2022) and logical query answering (Daza and Cochez, 2020; Alivanistos et al., 2022; Zhu et al., 2022).
Despite various applications, there has not been any theoretical work shedding light on multirelational GNNs’ expressive power and learning performance.
Some recent empirical results highlight interesting properties of relational GNNs, e.g., a randomly initialized and untrained R-GCN still demonstrates non-trivial performance (Degraeve et al., 2022), or that random perturbation of the relations does not lead to performance drops for CompGCN (Zhang et al., 2022).
A.2 The Weisfeiler–Leman Algorithm
In the following, we briefly describe Weisfeiler–Leman-type algorithms, starting with the 1dimensional Weisfeiler–Leman algorithm ( 1 - WL ).
The 1 - WL .
The 1 - WL , or color refinement , is a simple heuristic for the graph
isomorphism problem, originally proposed by Weisfeiler and Leman (1968).
7 Intuitively, the algorithm determines if two graphs are non-isomorphic by iteratively coloring or labeling vertices.
Given an initial coloring or labeling of the vertices of both graphs, e.g., their degree or application-specific information, in each iteration, two vertices with the same label get different labels if the number of identically labeled neighbors is not equal.
If, after some iteration, the number of vertices annotated with a specific label is different in both graphs, the algorithm terminates and a stable coloring (partition) is obtained.
We can then conclude that the two graphs are not isomorphic.
It is easy to see that the algorithm cannot distinguish all non-isomorphic graphs (Cai et al., 1992a).
Nonetheless, it is a powerful heuristic that can successfully test isomorphism for a broad class of graphs (Arvind et al., 2015; Babai and Kucera, 1979; Kiefer et al., 2015).
Formally, let G =
( V ( G ) , E ( G ) , ℓ ) be a labeled graph.
In each iteration, t > 0 , the 1- WL computes a vertex coloring C ( t ) : V ( G ) → N , which depends on the coloring of the neighbors.
That is, in iteration t > 0 , we set
[Equation]
where RELABEL injectively maps the above pair to a unique natural number, which has not been used in previous iterations.
In iteration 0 , the coloring C (0) := ℓ .
To test if two graphs G and H are non-isomorphic, we run the above algorithm in “parallel” on both graphs.
If the two graphs have a different number of vertices colored c in N at some iteration, the 1 - WL distinguishes the graphs as non-isomorphic.
Moreover, if the number of colors between two iterations, t and ( t + 1) , does not change, i.e., the cardinalities of the images of C ( t ) and C ( t +1) are equal, or, equivalently,
[Equation]
for all vertices v and w in V ( G ) , the algorithm terminates.
For such t , we define the stable coloring
C ∞ ( v ) =
C ( t ) ( v ) for v in V ( G ) .
The stable coloring is reached after at most max {| V ( G ) | , | V ( H ) |} iterations (Grohe, 2017).
Due to the shortcomings of the 1- WL or color refinement in distinguishing non-isomorphic graphs, several researchers, e.g., (Babai, 1979; Immerman and Lander, 1990), devised a more powerful generalization of the former, today known as the k -dimensional Weisfeiler-Leman algorithm ( k - WL ).
Oblivious k - WL .
Intuitively, to surpass the limitations of the 1- WL , the k - WL colors ordered subgraphs instead of a single vertex.
More precisely, given a graph G , it colors the tuples from
V ( G ) k for k ≥ 2 instead of the vertices.
By defining a neighborhood between these tuples, we can define a coloring similar to the 1- WL .
Formally, let G be a labeled graph, and let k ≥ 2 .
In each iteration t ≥ 0 , the algorithm, similarly to the 1- WL , computes a coloring C ( t )
k : V ( G ) k
→ N .
In the first iteration, t = 0 , the tuples v and w in V ( G ) k get the same color if they have the same atomic type, i.e., C (0)
k
( v ) :=
atp ( v ) .
Now, for t ≥ 0 , C ( t +1) k is defined by
[Equation]
with M ( t ) ( v ) the tuple
[Equation]
We also call M ( t ) an aggregation function .
Here
[Equation]
That is, θ j ( v , w ) replaces the j -th component of the tuple v with the vertex w .
Hence, two tuples v and w with the same color in iteration t get different colors in iteration ( t + 1) if there exists a j in [ k ] such that the number of j -neighbors of v and w , respectively, colored with a certain color is different.
Hence, two tuples are adjacent or j -neighbors if they are different in the j th component (or equal, in the case of self-loops).
Again, we run the algorithm until convergence, i.e.,
[Equation]
for all v and w in V ( G ) k holds, and call the partition of V ( G ) k induced by C ( t )
k
the stable partition.
For such t , we define C ∞ k ( v ) :
= C ( t ) k
( v ) for v in V ( G ) k .
To test whether two graphs G and H are non-isomorphic, we run the k - WL in “parallel” on both graphs.
Then, if the two graphs have a different number of k -tuples colored c in N , the k - WL distinguishes the graphs as non-isomorphic.
By increasing k , the algorithm becomes more powerful in distinguishing non-isomorphic graphs, i.e., for each k ≥ 1 , there are non-isomorphic graphs distinguished by ( k + 1) - WL but not by k - WL (Cai et al., 1992a).
Local δ - k -dimensional Weisfeiler–Leman Algorithm.
Morris et al.
(2020) introduced a more efficient variant of the k - WL , the local δ - k -dimensional Weisfeiler–Leman algorithm ( δ - k - LWL ).
In contrast to the k - WL , the δ - k - LWL considers only a subset of the entire neighborhood of a vertex tuple.
Let the tuple w = θ j ( v , w ) be a j -neighbor of v .
We say that w is a local j -neighbor of v if w is adjacent to the replaced vertex v j .
Otherwise, the tuple w is a global j -neighbor of v .
The δ - k - LWL considers only local neighbors during the neighborhood aggregation process, and discards any information about the global neighbors.
Formally, the δ - k - LWL refines a coloring C ( t ) k,δ (obtained after t rounds of the δ - k - LWL ) via the aggregation function
[Equation]
hence considering only the local j -neighbors of the tuple v in each iteration.
The coloring functions for the iterations of the δ - k - LWL are then defined by
[Equation]
Note that the 1 - WL is equivalent to the δ -1- LWL .
Morris et al.
(2020) showed that, for each k , the δ - k - LWL can distinguish graphs that the k - WL cannot and derived a variation of the former that is strictly more powerful than the k - WL .
B Missing Proofs in Section
Theorem 10 (Theorem 1 in the main text) .
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥
the following hold:
• For all choices of initial vertex features consistent with ℓ , sequences W ( t ) R-GCN of R-GCN parameters, and vertices v and w in V ( G ) ,
[Equation]
• For all choices of initial vertex features consistent with ℓ , sequences W ( t )
[Equation]
of CompGCN parameters, composition functions ϕ ,
and vertices v and w in V ( G ) ,
[Equation]
Proof.
We only prove it for CompGCN as the proof for R-GCN is analogous.
Fix initial vertex features ( h (0) v ) v ∈ V ( G ) for G consistent with ℓ , a sequence W ( t ) CompGCN of parameters, a composition function ϕ , and two vertices v and w in V ( G ) .
We prove the result by induction on t ≥ 0 .
For t = 0 , the statement follows immediately from the fact the initial features ( h (0) v ) v ∈ V ( G ) are consistent with ℓ .
Assume now that C ( t ) R ( v ) =
C ( t ) R ( w ) , for t > 0 .
Hence, by Equation 4, it must be the case that
• C ( t − 1) R
( v ) =
C ( t − 1) R ( w ) , and • {{ C ( t − 1) R ( u ) | u ∈ N i ( v ) }} = {{ C ( t − 1) R ( u ) | u ∈ N i ( w ) }} , for each
i
∈
[ r ] .
Then, by induction hypothesis, it holds that:
• h ( t − 1) v, CompGCN =
h ( t − 1) w, CompGCN , and • {{ h ( t − 1) u, CompGCN | u ∈ N i ( v ) }} = {{ h ( t − 1) u, CompGCN | u ∈ N i ( w ) }} , for each i in [ r ] .
From these two we conclude by applying Equation 3 that h ( t ) v, CompGCN = h ( t ) w, CompGCN .
This is because we have that h ( t − 1) v, CompGCN W ( t )
= h ( t − 1) w, CompGCN W ( t
[Equation]
0 and
[Equation]
for each i ∈ [ r ] .
Theorem 11 (Theorem 2 in the main text) .
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
For all t ≥ 0 :
• There exist initial vertex features and a sequence W ( t ) R-GCN of parameters such that for all v and w in V ( G ) ,
[Equation]
• There exist initial vertex features, a sequence W ( t ) CompGCN of parameters and a composition function ϕ such that for all v and w in V ( G ) ,
[Equation]
Proof.
We focus on the case of CompGCN when the composition map ϕ is vector scaling, that is, ϕ ( h , α )
=
α h , for h in R d and α in R .
As we explain later, this implies the cases of R-GCN ,
CompGCN with point-wise multiplication, and also CompGCN with circular-correlation.
The proof is a refinement of (Morris et al., 2019, Theorem 2) for multi-relational graphs.
For a matrix B , we denote by B i
its i -th row.
Let n = | V ( G ) | and without loss of generality assume
V ( G ) =
[ n ] .
We represent vertex features for G as a matrix F in R n × d , where F v corresponds to the vertex feature of v .
By slightly abusing notation, we view vertex features as a coloring for G .
In particular, we denote by Γ G ( F ) the application of one step of the 1 - RWL on G .
That is, Γ G ( F ) is a coloring C : V ( G ) → N such that for each v in V ( G ) ,
[Equation]
where C F is the coloring corresponding to the matrix F .
On the other hand, the update rule of
CompGCN can be written as follows:
[Equation]
where W 0 and W 1 are the parameter matrices, α i are the scaling factors,
A i is the adjacency matrix for the relation
R i ( G ) , and J is the all-one matrix of appropriate dimensions, representing the biases.
Here we choose σ to be the sign function sign and the bias b to be b = − 1 .
Using the same argument as in (Morris et al., 2019, Corollary 16), we can replace σ by the ReLU function.
We need the following lemma shown in (Morris et al., 2019, Lemma 9).
Lemma 12 (Morris et al.
Let B in N s × t be a matrix such that all the rows are pairwise distinct.
Then there is a matrix X in R t × s such that the matrix sign ( BX − J ) in {− 1 , 1 } s × s is non-singular.
Following Morris et al.
(2019), we say that a matrix is row-independent modulo equality if the set of all rows appearing in the matrix is linearly independent.
For two colorings C and C ′ of G , we write C ≡ C ′ if the colorings define the same partition on V ( G ) .
The key lemma of the proof is the following:
Lemma 13.
Let F in R n × d be row-independent modulo equality.
Then there are matrices W 0 and
W 1 in R d × e and scaling factors α i in R , for i in [ r ] , such that the matrix
[Equation]
is row-independent modulo equality and F ′ ≡ Γ G ( F ) .
Proof.
Let q be the number of distinct rows in F and let (cid:101) F in R q × d be the matrix whose rows are the distinct rows of F in an arbitrary but fixed order.
We denote by Q 1 , . . .
, Q q the associated color classes , that is, a vertex v in [ n ] is in Q j if and only if F v = (cid:101) F j .
By construction, the rows of (cid:101) F are linearly independent, and hence there is a matrix M in R d × q such that (cid:101) F M in R q × q is the identity matrix.
It follows that the matrix F M in R n × q has entries:
[Equation]
Let D in N n × q ( r +1) be the matrix with entries:
[Equation]
otherwise
[Equation]
So the v -th row of D is the concatenation of a one-hot vector encoding of the color of v and a vector encoding for the multiset of the colors in N i ( v ) , for each i in [ r ] .
We have
[Equation]
if we view D as a coloring of G .
We can also see D as a block matrix D =
[ N 0 N 1 · · · N r ] , where
N 0 = F M in N n × q
and N i
=
A i F M in N n × q for each i in [ r ] .
Since 0 ≤ D vh ≤ n − 1 , for all v in [ n ] , h in [ q ( r + 1)] , we have
[Equation]
E where
[Equation]
Indeed, E vj is simply the n -base representation of the vector ( D vj , D v ( qj ) , . . .
, D v ( rqj ) ) , and hence
E v = E w if
and only if D v = D w .
Let p be the number of distinct rows in E and let (cid:101) E in N p
×
q be the matrix whose rows are the distinct rows of E in an arbitrary but fixed order.
We can apply Lemma 12 to (cid:101) E and obtain a matrix X in R q × p such that sign ( (cid:101) EX − J ) in R p × p is non-singular.
In particular, sign ( EX − J ) is row-independent modulo equality and sign ( EX − J ) ≡ E ≡ Γ G ( F ) .
Let W
=
W 1 = MX in R d × p and α i
= n i for i in [ r ] .
We have
[Equation]
Hence F ′ is row-independent modulo equality and F ′ =
sign ( EX − J ) ≡ Γ G ( F ) .
Now the theorem follows directly from Lemma 13.
We start with initial vertex features ( h (0) v ) v ∈ V ( G ) consistent with ℓ such that different features are linearly independent.
Hence the matrix F (0) representing the initial features is row-independent modulo equality and we can apply iteratively
Lemma 13 to obtain the required sequence W ( t ) CompGCN such that C ( t ) R ≡ F ( t ) , where F ( t ) is the matrix representing the vertex features ( h ( t ) v, CompGCN ) v ∈ V ( G ) .
In particular, C ( t ) R ( v ) =
C ( t ) R ( w ) ⇔ h ( t ) v, CompGCN = h ( t ) w, CompGCN , for all v and w in V ( G ) .
Remark 14.
Note that the dimensions d × e of the parameter matrices at layer t correspond to the number of distinct colors before ( q ) and after ( p ) the application of the layer.
The case of CompGCN with point-wise multiplication holds since we can simulate vector scaling as α h = h ∗ ( α, . .
. , α ) , where ∗ denotes point-wise multiplication.
Similarly, the case of R-GCN follows as we can simulate vector scaling by setting W i
=
α
i W 1 , for each i in [ r ] .
Finally, we show that the result also holds for CompGCN with circular correlation.
This composition map is defined as follows 9 :
[Equation]
where h , z in R d , h ⋆ z in R d and i in [ d ] .
We can easily simulate one layer of CompGCN with vector scaling using two layers of CompGCN with circular-correlation.
Indeed, for a layer of the form
[Equation]
where g u in R d , for all u in V ( G ) , we first use a layer of the form
[Equation]
where P in R d × d reverts the vertex features, that is, all the entries are zero except for P ( n − i +1)
i
=
for all i in [ d ] , followed by a layer
[Equation]
B.1 On the Choice of the Composition Function for R-GCN Architectures
Proposition 15 (Proposition 3 in the main text) .
There exist a labeled, multi-relational graph
G =
( V ( G ) , R 1 ( G ) , R 2 ( G ) , ℓ ) and two vertices v and w in V ( G ) , such that C (1) R ( v )
̸ = C (1) R ( w ) but C ∞
WR ( v ) =
C ∞ WR ( w ) .
Proof.
We have V ( G ) =
{ v, w, u 1 , u 2 } , R 1 ( G ) = { ( v, u 1 ) , ( w, u 2 ) } , R 2 ( G ) =
{ ( v, u 2 ) , ( w, u 1 ) } , ℓ ( v ) =
ℓ ( w ) = 0 , ℓ ( u 1 ) = 1 and ℓ ( u 2 ) = 2 .
Hence,
C [Equation]
[Equation]
v ) =
RELABEL
[Equation] [Equation]
C
[Equation]
[Equation]
w )
[Equation]
RELABEL (cid:16)(cid:0) 0 , {{ (2 , 1) , (1 , 2) }} (cid:1)(cid:17) , that is, C (1) R ( v )
̸
= C (1) R ( w ) .
On the other hand,
[Equation]
and then C ∞ WR ( v ) =
C ∞ WR ( w ) .
As shown next, the expressive power of CompGCN architectures that use point-wise summation/substraction or vector concatenation is captured by this weaker form of multi-relational 1- WL .
Theorem 16 (Theorem 4 in the main text) .
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then:
• For all t ≥ 0 , choices of initial vertex features consistent with ℓ , sequence W ( t ) CompGCN of CompGCN parameters, and vertices v and w in V ( G ) ,
[Equation]
, CompGCN
[Equation]
for either point-wise summation/substraction or concatenation as the composition map.
• For all t ≥ 0 , there exist initial
vertex features and a sequence W ( t ) CompGCN of CompGCN parameters, such that for all vertices v and w in V ( G ) ,
[Equation]
for either point wise summation substraction concatenation composition map
Proof.
We start with the first item.
We focus first on the case of CompGCN with vector concatenation.
Note that if h in R d , z in R b and W in R ( d + b ) × e , then we have
[Equation]
where X in R d × e is the matrix given by the first d rows of W , while Y in R b × e is the matrix given by the last b rows of W .
In particular, we can write
[Equation]
Fix initial vertex features ( h (0) v ) v ∈ V ( G ) for G consistent with ℓ , a sequence W ( t ) CompGCN of parameters and two vertices v and w in V ( G ) .
We proceed by induction on t ≥ 0 .
For t =
we are done as the features ( h (0) v ) v ∈ V ( G ) are consistent with ℓ .
Assume now that C ( t ) WR ( v ) =
C ( t )
[Equation]
( w ) , for t > 0 .
Then, by Equation 3, we have that
• C ( t − 1) WR ( v ) =
C ( t − 1) WR ( w ) , • {{ C ( t − 1) WR ( u ) | i ∈
[ r ] , u ∈ N i ( v ) }} = {{ C ( t − 1) WR ( u ) |
i ∈
[ r ] , u ∈ N i ( w ) }} , • | N i ( v ) | = | N i ( w ) | for each i ∈
[ r ] .
Then, by induction hypothesis, it holds that:
• h ( t − 1) v, CompGCN =
h ( t − 1) w, CompGCN , and • {{ h ( t − 1) u, CompGCN | i ∈
[ r ] , u ∈ N i ( v ) }} = {{ h ( t − 1) u, CompGCN | i ∈
[ r ] , u ∈ N i ( w ) }} .
Then we have
• (cid:80) i ∈
[ r ] | N i ( v )
| z ( t ) i
=
(cid:80)
i ∈
[ r ] | N i ( w )
| z ( t ) i , and • (cid:80)
i ∈
[ r ] (cid:80) u ∈ N i ( v ) h ( t − 1) u, CompGCN = (cid:80) i ∈
[ r ] (cid:80) u ∈ N i ( w ) h ( t − 1) u, CompGCN .
We conclude that h ( t ) v, CompGCN = h ( t ) w, CompGCN .
Note that the update rule for the case of point-wise summation/substraction is the same except that now X ( t ) 1 = Y ( t ) 1 .
Hence exactly the same argument applies.
We now turn to the second item.
We follow the same strategy and terminology as in the proof of Theorem 11.
In this case, given a vertex feature matrix F in R n × d , we denote by ˆ Γ G ( F ) the application of one step of the weak 1 - RWL .
Hence, ˆ Γ G ( F ) is a coloring C : V ( G ) → N such that for each v in V ( G ) ,
[Equation]
where C F is the coloring corresponding to the matrix F .
In this case, the update rule for CompGCN with vector concatenation can be written as follows:
[Equation]
where W 0 in R d × e and W 1 = (cid:20) X 1 Y 1 (cid:21) ∈ R ( d + b ) × e , for X 1 ∈ R d × e , Y 1 ∈ R b × e , are the parameter matrices, Z i ∈ R n × b is the matrix where each row is a copy of the edge feature z i ∈ R b associated with the relation R i ( G ) ,
A i is the adjacency matrix for the relation
R i ( G ) , and J is the all-one matrix of appropriate dimensions.
We have the following:
Lemma 17.
Let F in R n × d be row-independent modulo equality.
Then there are matrices W 0 in R d × e , X 1 in R d × e , Y 1 in R b × e and vectors z i in R b , for i in [ r ] such that the matrix
[Equation]
is row-independent modulo equality and F ′ ≡ ˆ Γ G ( F ) .
Proof.
Let q be the number of distinct rows in F and let (cid:101) F in R q × d be the matrix whose rows are the distinct rows of F in an arbitrary but fixed order.
We denote by Q 1 , . . .
, Q q the associated color classes , that is, a vertex v in [ n ] is in Q j if and only if F v = (cid:101) F j .
By construction, the rows of (cid:101) F are linearly independent, and hence there is a matrix M in R d × q such that (cid:101) F M in R q × q is the identity matrix.
It follows that the matrix F M in R n × q has entries:
[Equation]
[Equation]
Let M 0 , M 1 in N d × (2 q + r ) , M 2 in N r × (2 q + r ) be the block matrices M 0 =
[ M O O ′ ] , M 1 =
[ O M O ′ ] and M 2 =
[ O ′′ O ′′
I ] , where O in R d × q , O ′ in R d × r , O ′′ in R r × q are all-
0 matrices, and I in R r × r is the identity matrix.
For each i in [ r ] , the required z i in R r is the vector with all entries 0 except for the i -th position which is 1 .
Let Z i be the corresponding matrix whose rows are copies of z i .
We define D in N n × (2 q + r ) as:
[Equation]
The v -th row of F M encodes the color of v , the v -th row of (cid:80) i ∈
[ r ] A i F M encodes the multiset of the colors of u , when we range over i in [ r ] and u in N i ( v ) , and the v -th row of (cid:80) i ∈
[ r ] A i Z i contains the sizes of N i ( v ) for all i in [ r ] .
Hence,
[Equation]
D if we view D as a coloring of G .
Let p be the number of distinct rows in D and let (cid:101) D in N p × (2 q + r ) be the matrix whose rows are the distinct rows of D in an arbitrary but fixed order.
We apply Lemma 12 to (cid:101) D and obtain a matrix
X in R (2 q + r ) × p such that sign ( (cid:101) DX − J ) in R p × p is non-singular.
In particular, sign ( DX − J ) is row-independent modulo equality and sign ( DX − J )
≡ D ≡ ˆ Γ G ( F ) .
Let W
=
M 0 X in R d × p ,
X
1 = M 1 X in R d × p , and Y 1 = M 2 X in R r × p .
We have
[Equation]
Hence F ′ is row-independent modulo equality and F ′ =
sign ( DX − J )
≡ ˆ Γ G ( F ) .
The theorem follows directly by iteratively applying Lemma 17 starting with vertex features ( h (0) v ) v ∈ V ( G ) consistent with ℓ such that different features are linearly independent.
The case of CompGCN with point-wise summation/substraction follows from the fact that this architecture can simulate CompGCN with vector concatenation.
Indeed, we can simulate one layer of CompGCN with vector concatenation using two layers of CompGCN with point-wise summation/substraction.
Take a layer of the form
[Equation]
where g u in R d , for u in V ( G ) , W 0 ∈ R
d × e , W 1 ∈ R ( d + b )
× e and z i ∈ R b .
We first use a layer
[Equation]
where B ∈ R d × ( d + b ) is the d × d identity matrix with b additional all- 0 columns.
So (cid:101) h v =
( g v , 0 , . . . , 0) ∈ R d + b .
Then we apply a layer
[Equation]
where W ′
∈ R ( d + b ) × e is
the matrix W 0 ∈ R d × e with b additional all- 0 rows, while z ′ i = (0 , . . .
, 0 , z i ) ∈ R d + b .
Together with Proposition 15 and Theorem 11, this result states that CompGCN architectures based on vector summation or concatenation are provably weaker in terms of their capacity to distinguish vertices in graphs than the ones that use vector scaling.
B.2 A comparison between R-GCN and CompGCN architectures
We proved that R-GCN and CompGCN with point-wise multiplication have the same power discriminating vertices in (multi-relational) graphs.
Here we show that these architectures actually define the same functions on multi-relational graphs.
Theorem 18.
The following statements hold:
• For any sequence of parameters W ( t ) CompGCN for CompGCN with point-wise multiplication, there is a sequence of parameters W ( t ) R-GCN for R-GCN such that for each labeled, multi-relational graph G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) and choice of initial vertex features, we have h ( t ) v, R-GCN = h ( t ) v, CompGCN , for each v in V ( G ) .
• Conversely, for any sequence of parameters W ( t ) R-GCN for R-GCN , there exists a sequence of parameters W (2 t ) R-GCN for CompGCN with point-wise multiplication such that for each labeled, multi-relational graph G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) and choice of initial vertex features, we have h (2 t ) v, CompGCN = h ( t ) v, R-GCN , for each v in V ( G ) .
Proof.
The first item follows since we can simulate one layer of CompGCN with point-wise multiplication using one layer of R-GCN .
Indeed, take a layer of the form
[Equation]
where g u , z i ∈ R d .
This is equivalent to
[Equation]
where W i = Λ i W 1 , where Λ
i ∈ R
d × d is the diagonal matrix whose diagonal is precisely z i .
For the second item, we can simulate one layer of R-GCN with two layers of CompGCN with point-wise multiplication.
Take a layer
[Equation]
where g u ∈ R d , W 0 ∈ R d × e , W i ∈ R
d × e .
We first apply a layer
[Equation]
where B ∈ R d × dr is the concatenation of r copies of the d × d identity matrix.
In particular, (cid:101) h v ∈ R dr is the vector g v repeated r times.
Then we use the layer
[Equation]
where W ′
∈ R dr × e is
the matrix W 0 ∈ R d × e with d ( r − 1) additional all- 0 rows, W ′ 1 ∈ R dr × e is the (vertical) concatenation of the matrices
W i for i ∈
[ r ] , and z i ∈ R dr is the vector with all entries 0 except for the d positions ( i − 1) d + 1 , . . .
, ( i − 1)
d + d which contain the value 1 .
Remark 19.
A similar result holds for the case of CompGCN with point-wise summation/subtraction and CompGCN with vector concatenation.
The simulations between these two architectures are implicitly given in the proof of Theorem 16.
Remark 20.
Note that, as a consequence of Theorem 11, Proposition 15 and the first item of Theorem 16, there are functions defined by R-GCN or CompGCN with point-wise multiplication that cannot be expressed by CompGCN with point-wise summation/subtraction or vector concatenation.
This even holds in the non-uniform sense, that is, if we focus on a single labeled multi-relational graph (the one from Proposition 15).
C Missing proofs in Section
Proposition 21 (Proposition 5 in the main text) .
For all r ≥ 1 , there exists a pair of non-isomorphic graphs G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) and H =
( V ( H ) , R 1 ( H ) , . . .
, R r ( H ) , ℓ ) that cannot be distinguished by R-GCN or CompGCN .
Proof.
We explicitly construct the graphs G and H for r ≥ 2 .
To do so, we take a pair of graphs A and B , non-distinguishable by 1 - WL , and transform them into the multi-relational graphs G and H .
Let A be a cycle on six vertices and B be the disjoint union of two cycles on three vertices.
Clearly, the 1 - WL cannot distinguish the two graphs.
Now let V ( G ) :
= V ( A ) and V ( H ) :
= V ( B ) .
Further, let R i ( G ) :
=
E ( A ) and R i ( H ) :
=
E ( B ) for i in [ r ] .
Observe that the multi-relational 1 - WL will reach the stable coloring after one iteration and it will not distinguish the multi-relational graphs G and H .
Hence, by Theorem 10, the result follows.
Proposition 22 (Theorem 6 in the main text) .
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 , r > 0 , k ≥ 1 , and all choices of UPD ( t ) , AGG ( t ) , and all v and w in V ( G ) ,
[Equation]
Proof sketch.
The proof is analogous to the proof of Morris et al.
(2019, Proposition 3).
Proposition 23 (Theorem 7 in the main text) .
Let G =
( V ( G ) , R 1 ( G ) , . . .
, R r ( G ) , ℓ ) be a labeled, multi-relational graph.
Then for all t ≥ 0 and k ≥ 1 , there exists UPD ( t ) , AGG ( t ) , such that for all v and w in V ( G ) ,
[Equation]
Proof.
To prove the results, we need to ensure that there exists instantiations of UPD ( t ) and AGG ( t ) that are injective.
To show the existence of injective instantiations of AGG ( t ) for t > 0 , we write
AGG ( t ) as
[Equation] [Equation]
t
[Equation]
z
[Equation] [Equation]
i ∈
[ r ] }} (cid:1)(cid:17)
[Equation]
where AGG ( t ) out and AGG ( t ) in ,j for j in [ k ] may be a differentiable parameterized functions, e.g., neural networks.
Observe that we can represent AGG ( t ) in ,j as
[Equation]
for j in [ k ] , resembling the aggregation of Equation 3, by Theorem 11, the injectiveness of the above aggregation function follows.
A similar argument can be made for AGG ( t ) out and UPD ( t ) , implying the result.
Moreover, the following result implies that increasing k leads to a strict boost in terms of expressivity of the k - RLWL and k - RN s architectures in terms of distinguishing non-isomorphic multi-relational graphs.
Proposition 24.
For k ≥ 2 and r ≥ 1 , there exists a pair of non-isomorphic multi-relational graphs
G r =
( V ( G r ) , R 1 ( G r ) , . . .
, R r ( G r ) , ℓ ) and H r =
( V ( H r ) , R 1 ( H r ) , . . .
, R r
( H r ) , ℓ ) that can be distinguished by the ( k + 1) - MLWL but not by the k - MLWL .
Proof.
See Proof C.1.
Corollary 25 (Corollary 8 in the main text) .
For k ≥ 2 and r ≥ 1 , there exists a pair of non-isomorphic multi-relational graphs G r =
( V ( G r ) , R 1 ( G r ) , . . .
, R r ( G r ) , ℓ ) and H =
( V ( H r ) , R 1 ( H r ) , . . .
, R r
( H r ) , ℓ ) such that:
• For all choices of UPD ( t ) , AGG ( t ) , for t > 0 , and READOUT the k - RN architecture will not distinguish the graphs G r and H r .
• There exists UPD ( t ) , AGG ( t ) , for t > 0 , and READOUT such that the ( k +1) - RN will distinguish them.
Proof.
Follows from Theorem 23 and Theorem 24.
Corollary 26.
There exists a 2 - RN architecture that is strictly more expressive than the CompGCN and the R-GCN architecture in terms of distinguishing non-isomorphic graphs.
Proof.
This follows from Corollary 25 and the fact that a 2 - RN is capable to distinguish the graphs constructed in the proof of Proposition 21, which follows from the fact that the δ - 2 - LWL can distinguish the graphs A and B ; see, e.g., the proof of Lemma 13 in Morris et al.
(2022b).
C.1 Proof of Proposition
In the following, we outline the proof of Theorem 24.
We modify the construction employed in (Morris et al., 2020), Appendix C.1.1., where they provide an infinite family of graphs ( G k , H k ) k ∈ N such that the k - WL does not distinguish G k and H k , although the δ - k - LWL distinguishes G k and H k .
We recall some relevant definitions from their paper.
Construction of G k and H k .
Let K denote the complete graph on k + 1 vertices (without any self-loops).
The vertices of K are indexed from 0 to k .
Let E ( v ) denote the set of edges incident to v in K : clearly, | E ( v ) |
=
k for all v in V ( K ) .
We call the elements of V ( K ) base vertices , and the elements of E ( K ) base edges .
Define the graph G k as follows:
For the vertex set V ( G k ) , we add (a) ( v, S ) for each v in V ( K ) and for each even subset S of E ( v ) , (b) two vertices e 1 , e 0 for each edge e in E ( K ) .
For the edge set E ( G k ) , we add (a) an edge { e 0 , e 1 } for each e in E ( K ) , (b) an edge between ( v, S ) and e 1 if v in e and e in S , (c) an edge between ( v, S ) and e 0 if v in e and e not in S ,
Define a companion graph H k , in a similar manner to G k , with the following exception: in Step 1(a), for the vertex 0 in V ( K ) , we choose all odd subsets of E (0) .
Distance-two-cliques.
A set S of vertices is said to form a distance-two-clique if the distance between any two vertices in S is exactly 2 .
The following results were shown in (Morris et al., 2020).
Lemma 27 ((Morris et al., 2020)) .
The following holds for the graphs G k and H k defined above.
• There exists a distance-two-clique of size ( k + 1) inside G k .
• There does
not exist a distance-two-clique of size ( k + 1) inside H k .
Hence, G k and H k are non-isomorphic.
Lemma 28 ((Morris et al., 2020)) .
The δ - k - LWL distinguishes G k and H k , while the (oblivious) k - WL does not distinguish G k and H k .
Moreover, we need the following result showing that the δ - k - LWL forms a hierarchy.
Lemma 29.
For k ≥ 2 , the δ - k - LWL distinguishes G k and H k , while the δ - ( k − 1) - LWL does not distinguish G k and H k .
Proof.
The fact that δ - k - LWL distinguishes the graphs G k and H k follows from Lemma 28.
We know argue that the δ - ( k − 1) - LWL does not distinguish the two graphs.
First, the (oblivious) k - WL has the same expressive power in distinguishing non-isomorphic graphs as the non-oblivious or folklore ( k − 1) - WL ; see Grohe (2021) for details.
Hence, it will not distinguish the graphs G k and H k .
The non-oblivious ( k − 1) - WL (Grohe, 2021) uses the following aggregation function
[Equation]
instead of Equation 8.
Notice that from ( C ( t ) k
( θ 1 ( v , w )) , . .
, C ( t ) k
( θ k − 1 ( v , w ))) we can recover if there is an edge between the vertex w and a vertex v j for j in [ k − 1] in the underlying graph.
Hence, the non-oblivious ( k − 1) - WL is at least as powerful as the δ - ( k − 1) - LWL , implying that the δ - ( k − 1) - LWL is weaker than the δ - k - LWL .
We now construct non-isomorphic multi-relational graphs G r = (
[Equation]
( G
[Equation] [Equation]
[Equation]
and H r =
( V ( H r ) , R 1 ( H r ) , . . .
, R r
( H r ) , ℓ ) that can be distinguished by the ( k + 1) - RLWL but not by the k - RLWL .
Let V ( G r ) :
= V ( G k ) and V ( H r ) :
=
V ( H k ) .
Further, let R i ( G r ) :
=
E ( G k ) and R i ( H r ) :
= E ( H k ) for i in [ r ] .
By a straightforward inductive argument it follows that M ( t ) δ ( v ) =
M ( t ) δ ( w ) implies
M ( t ) r ( v ) =
M ( t ) r ( w ) for all k -tuples v and w in V ( G k ) k or V ( H k ) k .
This finishes the proof.
D R-GCN
Additionally, we probe a modification of the R-GCN model with an MLP transformation (denoted as
R-GCN +MLP)
to facilitate parameter sharing between different relation-specific message propagations:
[Equation]
This modification has a slightly higher count of learnable parameters.
E CompGCN
The original CompGCN architecture proposed in Vashishth et al.
(2020) considers directed graphs with self-loops, and uses an additional sum to differentiate between in-going, out-going, and self-loop edges, a degree-based normalization, and different weight matrices for these three cases, i.e., h ( t ) v, CompGCN :
= σ (cid:16) h ( t
[Equation]
1) v, CompGCN W (
[Equation]
+ (cid:88) i ∈
[ r ] (cid:88)
[Equation]
where D := { in , out } , representing in-going an out-going edges, respectively.
Here, N di ( v ) is the restriction of N di ( v ) of N i ( v ) to in-going, out-going, and self-loop edges incident to the vertex v .
Further, c v,w :=
(cid:112) | N di ( v ) | · | N di ( w ) | .
The update of the previous vertex state is performed via the self-loop direction which we separate into the term h
( t − 1) v, CompGCN W ( t ) 0 for the sake of a unified notation.
In the ablation studies, we probe the following modifications and combinations of those.
• CompGCN without normalization ( -norm ):
[Equation]
• CompGCN without direction-specific weights ( -dir ): h ( t ) v, CompGCN :
= σ (cid:16) h ( t − 1) v, CompGCN W ( t )
+ (cid:88) i ∈
[ r ] c v,w (cid:88) w ∈ N i ( v ) ϕ (cid:0) h ( t − 1) w, CompGCN , z ( t ) i (cid:1) W ( t ) 1 (cid:17) ∈ R e , • CompGCN without relations update: z t +1 i =
z ti ( -rp ).
As a composition function ϕ ( h w , z i ) we probe several element-wise functions and an MLP:
• add : ϕ ( h w , z i ) =
h w + z i – element-wise addition • mult : ϕ ( h w , z i ) =
h w ∗
z i – element-wise multiplication (Hadamard product) • rotate (Sun et al., 2019): ϕ ( h w , z i ) =
h w ⊙
z
i – rotation in complex space •
MLP : ϕ ( h w , z i ) =
MLP ([ h w , z i ]) where [ · ] is column-wise concatenation
F Datasets and Hyperparameters
Statistics about the datasets are presented in Table 1.
As neither of the datasets contain an explicit validation set, we retain a random 15% sample of train vertices for validation and use it to optimize hyperparameters.
[Table]
Final hyperparameters are listed in Table 2, the total parameter count for all trained models is presented in Table 3.
Due to the size of the AM graph and identified stability of the initial vertex feature dimension, we only train models with dimension d = 4 on AM.
[Table] [Table]