SAGPooling
Graph pooling that keeps the top-k nodes ranked by a graph-convolution attention score.
Graphs and geometry · 63 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Graphs and geometry
- Parameters
- 258
- Operations
- 63
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICML 2019
- Cited by
- 840 (as of 18 October 2026)
- Authors
- Junhyun Lee, Inyeop Lee, Jaewoo Kang
- Source
- torch_geometric 2.6.1
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m2624
- Graph hash
- 7e3b1a62919a445314acc86a148e51123c4fd1d8589760b63f3e832bd14ffcb7
- Skeleton hash
- 67018c209133d2344fa8d9062451e65269779d16cab7f4d8e1f62ccd67fe74e2
- Architecture hash
- a3917976a95e0f852d144cbd51b01d7c2e29f4fd8d4ee8c9fcdc098107048814
- Diagram SHA-256
- 841ac219ad6300e67c955afb707f115552004f347372b3006bc3866887ed38b9
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
SAGPool, short for Self-Attention Graph Pooling, is a graph pooling method based on self-attention. The trick is that the attention scores come from a graph convolution, so the pooling considers both node features and graph topology. Those scores decide which nodes should be dropped and which should be retained. The pooling ratio k in (0, 1] is a hyperparameter that determines the number of nodes to keep. The kept node features are the row-wise indexed feature matrix times the attention mask, and the adjacency matrix is indexed down to the kept rows and columns.
In the base form, a single projection inside the graph convolution is the only parameter of the SAGPool layer. Any GNN that takes node features and an adjacency matrix can be substituted for that convolution. The paper compares Cheb, SAGE and GAT versions of the scorer. PyTorch Geometric's SAGPooling defaults the scorer to GraphConv with a pooling ratio of 0.5. It can also pool by a minimum score instead of a ratio, in which case the ratio argument is ignored.
The motivation was that earlier hierarchical pooling either had quadratic storage complexity with parameter count tied to the number of nodes, or fixed the complexity but ignored graph topology. Because it is a sparse pooling method, SAGPool needs O(|V|+|E|) storage where dense pooling methods need O(|V|^2). Its parameter count stays consistent regardless of input graph size. In the experiments, SAGPool outperformed the hierarchical pooling methods on all the datasets. The authors flag one limitation: the pooling ratio cannot be parameterized to find optimal values for each graph. The two first authors contributed equally, with their order determined randomly.
Key idea. Self-attention scores computed by graph convolution rank the nodes for pooling, so both node features and graph topology are considered. SAGPool uses a consistent number of parameters regardless of the input graph size.
- SAGPool
- SAGPooling
- Self-Attention Graph Pooling
- self-attention pooling
- graph pooling
- top-k pooling
- hierarchical pooling
- graph classification
- GraphConv
- pooling ratio
- PyTorch Geometric
- torch_geometric
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{lee2019selfattentiongraphpooling,
title={Self-Attention Graph Pooling},
author={Junhyun Lee and Inyeop Lee and Jaewoo Kang},
year={2019},
eprint={1904.08082},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1904.08082},
}