Graph Neural Networks (GNN)
Neural networks that learn on graphs by passing messages between connected nodes.
The idea
Each node keeps a feature vector. In every layer it collects ("aggregates") messages from its neighbours, combines them with its own vector and updates it. After k layers a node knows about everything within k hops. The result can classify nodes, predict links or summarise the whole graph.
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
- 1Give every node an initial feature vector.
- 2Each node gathers its neighbours' vectors.
- 3Aggregate them (sum, mean or attention).
- 4Update the node's vector with a learnable function.
- 5Repeat for several layers, then read out predictions.
Where it is used
Molecules, social networks, recommendation, traffic prediction.
Watch out for
Too many layers over-smooth: all nodes become alike.