[[lecture-data]] Summary
- graph isomorphism problem
- GNNs cannot distinguish graphs with identical eigenvalues
- But many non-isomorphic graphs share spectra
- This problem is not solvable in polynomial time
- One heuristic is the Weisfeiler-Leman Graph Isomorphism Test
Today
- Are GNNs as powerful as the Weisfeiler-Leman Graph Isomorphism Test?
- computational graphs
- requirements for a powerful GNN
- graph isomorphism networks (last architecture we will discuss)
Much of the content from today from “How Powerful are GNNs” by Xu et al 2019 - created this architecture
- measure expressive power wrt WL test
1. Graph Signals and Graph Signal Processing
Recall from last class that we discussed the Weisfeiler-Leman Graph Isomorphism Test, which uses the
Color refinement algorithm
The color refinement algorithm is an algorithm to assign colorings to nodes.
Givengraph with node features
let(assign colors based on node feature values)letwhile
True:
let
- assign colors based on previously assigned colors
if,break.else,Here, is a hash function that assigns colors.
Today, we will finish up the example that we began last class.
Example
Color refinement for
No node features, so assume all 1. First, Assign colors based on node features.
step: $c_{1}(0) = c_{2}(0)=c_{3}(0) = f(\cdot, 1) = k_{1}$$
step: $\begin{aligned} c_{1}(1) &= f(k_{1}, { k_{1} }) &= k_{1} \ c_{3}(1) &= f(k_{1}, { k_{1} }) &= k_{1} \ c_{2}(1) &= f(k_{1}, { k_{1}, k_{1} }) &= k_{2} \end{aligned}$$Evaluate: did the colors change?
- Yes: continue!
step: $\begin{aligned} c_{1}(2) &= f(k_{1}, { k_{1} }) &= k_{1} \ c_{3}(2) &= f(k_{1}, { k_{1} }) &= k_{1} \ c_{2}(2) &= f(k_{2}, { k_{1}, k_{1} }) &= k_{2} \end{aligned}$$Evaluate: did the colors change?
- No - so we are done!
- This is the final coloring.
returnColor refinement for Again, there are no node features, so we assume the signals are all .
step: assign colors based on node features: c_{1}(0) = c_{2}(0)=c_{3}(0) = f(\cdot, 1) = k_{1}$$ `step` t=1\begin{aligned} c_{1}(1) = c_{2}(1) = c_{3}(1) = f(\cdot, { k_{1}, k_{1} }) = k_{1} \end{aligned}$$
evaluate: did the colors change?
- No - so we are done
- This is the final coloring
return
Since the outputs of the algorithm are different, we can conclude that and are not isomorphic.
Note
There are other better algorithms that perform similar tests, but they often come at the expense of more computations
Today, we want to know: Are GNNs as powerful as the Weisfeiler-Leman Graph Isomorphism Test?
Proposition
Proof
Consider the representation of GNNs (recall graph SAGE for something similar) where each layer consists of
aggregation step on the neighborhood of each node
combine step
And with a permutation invariant readout layer (these are typically like the mean, max, sum, etc)
Suppose after iterations in the WL test and layers as described above,
- the embeddings
- the WL test cannot decide if and are non-isomorphic
If the WL test cannot decide, then every previous iteration in the test, then
- and must have the same color multisets, call them , and
- the color neighborhoods are also the same for all
NTS that if WL test for and gives the same color, then the GNN gives the same embedding.
want to show if the WL test gives for all , then the GNN always produces
Since there are no node features, impute as the feature for all nodes in each graph.
- The color refinement algorithm will assign the same colors to all nodes at the initial step as we saw in the example
- The 0th layer of the GNN assigns for all since all feature values are the same
Induction Hypothesis Suppose holds for iteration/layer .
the WL test outputs the same colors and for all . That is,
By the induction hypothesis, we have that Since the same and functions are applied to both graphs, then we automatically get that Thus, by induction, if the colors for all , the the embeddings at any .
for all between the embeddings of the nodes and the coloring assignment.
This creates a valid map
We can extend this mapping to include the multiset of embeddings/colors of the neighbors as well, and say that the multiset of all embeddings and neigeborhood embedding pairs also has a map And these are each the same for the two graphs.
Thus, the and are the same for all . And, due to the permutation invariance of the readout layer as defined above, we must have .
we assumed that the embeddings were NOT equal! Thus, it must be the case that the WL test CAN decide if and are non-isomorphic.
see the WL test is at least as powerful as a GNN for detecting graph non-isomorphism
What have we shown here?
We want to know if GNNs are at least as powerful as the WL test. ie if the WL test tells and apart, does there exist a GNN that can tell and apart?
ie, are GNNs as powerful as the WL test at telling non-isomorphic graphs apart?
Example
Can a GCN tell these apart? Recall
Graph Convolutional Networks graph convolutional network layer is given by (x_{\ell})_{i} = \sigma\left[ \sum_{j \in N(i)} \frac{(x_{\ell-1})_{j}}{\lvert N(i) \rvert } H_{\ell}\right]$$ Note that H_{\ell}$ are row vectors. We can think of each layer as a "degree normalized aggregation"
Introduced by Kipf and Willing, 2017, a
In AGGREGATE-COMBINE form, a GCN layer is given by WLOG, assume . The first layer with readout gives us
But then we get the same output for every layer and this GNN fails for permutation invariant readouts.
Takeaway
Exercise
Check if graph SAGE with the aggregation: Can tell these graphs apart.
In the example above, where did things break?
Pros: GCNs and any permutation equivariant GNN does not distinguish between nodes 1 and 3. This is an implicit data augmentation mechanism!
Cons: The GCN cannot distinguish between (1 and 3) and 2, but the structure at 1 or 3 is different from at node 2.
Let’s define the computational graph
computational graph
The computational graph tracks the communications that each node makes at each layer or iteration of an algorithm/network.
Example
Since 1 and 3 are symmetric, their computational graph is symmetric
is sufficient because the diameter (or the longest shortest path between two nodes) is of length 2.
We can imagine that we are mapping computational graphs to some embedding space. The issue with the GCN is that it is mapping all three computational graphs to a single embedding space.

We need functions/embeddings/maps that are injective. ie, which map different computational graphs (or different multisets of embeddings) to different values in embedding space.
Theorem
Let and be two graphs that the Weisfeiler-Leman Graph Isomorphism Test determines are non-isomorphic. A GNN maps and to if the following hold:
Proof (sketch)
In the proof showing that the WL test is at least as powerful as a GNN for detecting graph non-isomorphism, we showed that if the color refinement algorithm gives , then the embeddings and that that there is a valid map We need to be injective. Why? We don’t want it to be the case that there are different colors that map to the same embedding .
Let be the hash function in the WL test. Recall that is is bijective for color multisets. We can write the embedding at layer as follows:
(x_{j})_{v} &= g(f[(c_{j-1})_{v}, \{ (c_{j-1})_{u} : u \in N(v) \}]) \\ (x_{j})_{v} &= g(f[g^{-1}((x_{j-1})_{v}), \{ g^{-1}((x_{j-1})_{u}) : u \in N(v) \}]) \\ &\approx \phi(\cdot, \varphi(\cdot)) \;\;\;\text{the GNN} \end{aligned}$$ So to have $g$ injective, we need the [[Concept Wiki/Graph Neural Networks\|GNN]] to be injective. Thus, $\phi, \varphi \implies$ the GNN is injective $\implies g$ is invective $\implies$ the GNN is as powerful as the [[Concept Wiki/Weisfeiler-Leman Graph Isomorphism Test\|WL test]]

Can a
But then we get the same output for every layer and this GNN fails for permutation invariant readouts.
Since 1 and 3 are symmetric, their computational graph is symmetric