One round of message passing, three aggregators
numeric▲△△Exact values where possible; six decimal places otherwise.
STATEMENT
Run one round of message passing on a four-node graph with a sum, a mean and the graph convolution’s weighted average, then relabel the graph and confirm that each output is relabelled with it.
GIVEN
The paw graph: a triangle on nodes , and , and node joined to node . Scalar features . The relabelling swaps nodes and .
FIND
; the mean over neighbours; with ; the same three after relabelling.
STRATEGY
Read each node’s neighbours off the graph. For the graph convolution, include the node itself and weight each pair by .
SOLUTION
Sum. Node ‘s neighbours are and ; node ‘s are and ; node ‘s are , and ; node ‘s is . So
Mean. The degrees are , giving .
Graph convolution. With self-loops the degrees are . Node averages nodes , and :
Node averages the same three nodes with the same weights, so it also gets . Node gets , and node gets .
Relabelled. Swapping nodes and gives , and node is now the pendant. Repeating the computation on the relabelled graph gives
in each case the original output with its first and last entries swapped.
Answer
Sum ; mean ; graph convolution . After relabelling, each is the original with entries and exchanged.
Check — sanity
The entries of add to , and each feature is counted once per neighbour: .
Check — numeric · i-14-gnn-checks.py
The complete reproduction script uses only the Python standard library. From a checkout of the repository, run:
python3 scripts/snippets/i-14-gnn-checks.pyIt checks all fifteen problems of the chapter and the numbers quoted in its four propositions, including the eigenvalues of the paw graph’s , computed by Jacobi rotations, and a message-passing network run on the two-triangle and hexagon graphs.
Executed in CI. The digits above are the digits it printed.
Where this breaks
The graph convolution gave nodes and the same value although their features differ, because their closed neighbourhoods coincide. A layer with a separate self-term, , keeps them apart whenever .
Variation
With features the sum returns the degrees , the mean returns all ones, and the graph convolution returns . The mean has erased even the degrees; the graph convolution keeps a trace of them.