Skip to content
Graph Intelligence Hub
Menu

Algorithm

GraphSAGE

activeNeeds verification

Inductive graph neural network that learns functions to sample and aggregate neighbour features, so it can embed nodes unseen during training.

Definition

Intuition

Instead of one embedding per node, learn how to build an embedding from a sampled neighbourhood — so new nodes get embeddings without retraining.

Complexity

TimeO(∏ S_k · d) per node with fixed sample sizes S_k
SpaceO(batch · ∏ S_k · d)

Python

from torch_geometric.nn import SAGEConv
conv1 = SAGEConv(in_channels, 128, aggr='mean')
conv2 = SAGEConv(128, out_channels, aggr='mean')

Cypher (Neo4j GDS)

CALL gds.beta.graphSage.train('myGraph', {
  modelName: 'sage', featureProperties: ['f1', 'f2']})

Procedure names and options vary between GDS versions; check the GDS docs for your version.

An interactive step-by-step visualizer for this algorithm is planned for phase 3.

Profile

Time complexityO(∏ S_k · d) per node with fixed sample sizes S_k
Space complexityO(batch · ∏ S_k · d)

Relationships

Applied to
Prerequisites
Implemented by
Related