Alterlab torch geometric
Skill AlterLab-IEU/AlterLab-Academic-Skills/skills/data-science/alterlab-torch-geometric
Graph Neural Networks with PyTorch Geometric (PyG) — node and graph classification, link prediction, GCN, GAT, and GraphSAGE layers, heterogeneous graphs, and molecular property prediction. Use when building or training GNNs for geometric deep learning on graph-structured data. Part of the AlterLab Academic Skills suite.From its SKILL.md
npx -y skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-torch-geometricAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.1 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
PyTorch Geometric (PyG)
Overview
PyTorch Geometric is a library built on PyTorch for developing and training Graph Neural Networks (GNNs). Apply this skill for deep learning on graphs and irregular structures, including mini-batch processing, multi-GPU training, and geometric deep learning applications.
When to Use This Skill
This skill should be used when working with:
- Graph-based machine learning: Node classification, graph classification, link prediction
- Molecular property prediction: Drug discovery, chemical property prediction
- Social network analysis: Community detection, influence prediction
- Citation networks: Paper classification, recommendation systems
- 3D geometric data: Point clouds, meshes, molecular structures
- Heterogeneous graphs: Multi-type nodes and edges (e.g., knowledge graphs)
- Large-scale graph learning: Neighbor sampling, distributed training
Quick Start
uv pip install torch_geometric
Graphs are torch_geometric.data.Data objects: x (node features [N, F]), edge_index
(connectivity in COO [2, E]), optional edge_attr, y, pos, and any custom attribute
(train_mask, etc.). DataLoader batches multiple graphs into one block-diagonal graph
(no padding); a batch vector maps nodes back to their source graph.
Full install/sparse-deps, basic graph creation, benchmark loading, edge-index format, and
mini-batching details: references/getting_started.md.
Core Workflow
- Load or build data — benchmark datasets, custom
InMemoryDataset, or from CSV (references/datasets_and_loading.md; full catalog inreferences/datasets_reference.md). - Define a GNN — stack pre-built conv layers (GCNConv, GATConv, SAGEConv) or subclass
MessagePassingfor custom layers (references/building_gnns.md; full layer list inreferences/layers_reference.md). - Train — node classification (single graph, train/test masks), graph classification
(
DataLoader+ global pooling), or large-scale viaNeighborLoaderneighbor sampling (references/training_workflows.md). - Go advanced if needed —
HeteroData/to_heterofor heterogeneous graphs, transforms,GNNExplainerexplainability, hierarchical pooling, GPU, save/load (references/advanced_features.md; transforms catalog inreferences/transforms_reference.md).
Building GNNs (at a glance)
GNNs follow neighborhood aggregation: transform node features → propagate messages along edges →
aggregate from neighbors → update representations. PyG ships 40+ conv layers. When choosing one,
check its capabilities: SparseTensor support, edge_weight, edge_attr, bipartite, and lazy
(-1 channel) initialization. Code for GCN/GAT/GraphSAGE and custom MessagePassing layers
(including the _i/_j target/source naming convention) is in references/building_gnns.md.
Resources
Bundled References
This skill includes detailed reference documentation:
references/getting_started.md: Install, basic graph creation,Datastructure, edge-index format, mini-batchingreferences/building_gnns.md: Message passing, GCN/GAT/GraphSAGE code, customMessagePassinglayers, layer capabilitiesreferences/datasets_and_loading.md: Built-in datasets, customInMemoryDataset, loading graphs from CSVreferences/training_workflows.md: Node classification, graph classification, large-scale neighbor samplingreferences/advanced_features.md: Heterogeneous graphs, transforms, explainability, pooling, GPU, save/loadreferences/layers_reference.md: Complete listing of all 40+ GNN layers with descriptions and capabilitiesreferences/datasets_reference.md: Comprehensive dataset catalog organized by categoryreferences/transforms_reference.md: All available transforms and their use cases
Scripts
Utility scripts are provided in scripts/:
scripts/visualize_graph.py: Visualize graph structure using networkx and matplotlibscripts/create_gnn_template.py: Generate boilerplate code for common GNN architecturesscripts/benchmark_model.py: Benchmark model performance on standard datasets
Execute scripts directly or read them for implementation patterns.
Official Resources
What ships with it: 12 files
108.2 KB alongside SKILL.md, 3 of them executable
evals/
- evals.json4.4 KB
references/
- advanced_features.md5.5 KB
- building_gnns.md4.1 KB
- datasets_and_loading.md2.7 KB
- datasets_reference.md16.4 KB
- getting_started.md2.8 KB
- layers_reference.md16.7 KB
- training_workflows.md3.3 KB
- transforms_reference.md17.5 KB
scripts/
- benchmark_model.pyruns9.8 KB
- create_gnn_template.pyruns15.0 KB
- visualize_graph.pyruns10.0 KB