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
| Time | O(∏ S_k · d) per node with fixed sample sizes S_k |
|---|---|
| Space | O(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 complexity | O(∏ S_k · d) per node with fixed sample sizes S_k |
|---|---|
| Space complexity | O(batch · ∏ S_k · d) |
Relationships
- Belongs to
- Introduced by
- Applied to
- Part of
- Prerequisites
- Graph Convolutional Network (GCN)(Algorithm)
- node2vec(Algorithm)
- Message passing(Concept)
- Node embedding(Concept)
- Implemented by
- Deep Graph Library (DGL)(Library / framework)
- Neo4j Graph Data Science(Library / framework)
- PyTorch Geometric (PyG)(Library / framework)
- Related
- GCN and GraphSAGE(Timeline event)