Graph Convolutional Networks (GCN)
A GNN layer that averages each node with its neighbours, then transforms it.
The idea
A GCN layer multiplies the features by a normalised adjacency matrix (with self-loops), which averages each node with its neighbours, and then applies a weight matrix and non-linearity. It is the graph analogue of a convolution: the same weights are shared across all nodes.
H′ = σ(D̂^(−½) Â D̂^(−½) H W)
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- node feature
- messages to centre node
Each node holds a number (darker = bigger). In a graph network every node updates itself using only the nodes it is linked to.
- layer:
- 0
- spread:
- 0.937
Add more layers and notice the numbers drift together: too many rounds blur node identities.
Step by step
- 1Add self-loops to the adjacency matrix and normalise it.
- 2Average each node's features with its neighbours' (·H).
- 3Multiply by a weight matrix W.
- 4Apply a non-linearity.
- 5Stack a few layers.
Where it is used
Node classification in citation and social graphs.
Watch out for
Treats all neighbours roughly equally and needs the full graph in memory.