Skip to content
StackDecode
AI & ML Atlas
Deep LearningarchitectureInteractive simulation

GraphSAGE

Samples a fixed number of neighbours and learns an aggregator, so it scales to huge graphs.

The idea

For each node it randomly samples a few neighbours instead of using all of them, aggregates their features (mean, pooling or LSTM) and concatenates the result with the node's own features. Because it learns a function rather than a table of node embeddings, it works on nodes never seen in training (inductive learning).

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

0.650.040.980.950.830.950.280.78
  • 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
1/7

Add more layers and notice the numbers drift together: too many rounds blur node identities.

Step by step

  1. 1Sample a fixed number of neighbours for each node.
  2. 2Aggregate the sampled neighbours' features.
  3. 3Concatenate with the node's own features and transform.
  4. 4Normalise and repeat for each layer.

Where it is used

Large graphs such as Pinterest's, and graphs that grow over time.

Watch out for

Sampling adds variance to the embeddings.

Related