pyg-team/pytorch_geometric

Graph Neural Network Library for PyTorch

PyTorch Geometric (PyG)

What it is – A Python library built on top of PyTorch that makes it easy to develop and train graph neural networks (GNNs). It provides ready‑made implementations of dozens of GNN layers, utilities for loading and batching graph data, and support for large‑scale, heterogeneous, or dynamic graphs.

Why it matters – Graph‑structured data appears in many domains (social networks, citation networks, molecules, 3‑D meshes, recommendation systems, etc.). PyG lets researchers and engineers apply state‑of‑the‑art GNN models to these problems with only a few lines of code, while still giving full flexibility to create custom layers.

Key features (as described in the README)

  • Unified, PyTorch‑like API – Same tensor‑centric workflow you already know from PyTorch; a minimal example fits in ~20 lines.
  • Large catalogue of models – Over 40 published GNN layers (GCN, GAT, GraphSAGE, GIN, RGCN, etc.) and higher‑level models are already implemented.
  • Scalable data handling – Mini‑batch loaders, sampling strategies, and multi‑GPU support for graphs with millions of nodes.
  • Extensibility – Custom layers can be built by subclassing the MessagePassing base class; the README shows a full EdgeConv example.
  • Integration with modern PyTorch – Works with torch.compile, TorchScript, and the pyg-lib CUDA kernels for fast sparse operations.
  • Rich ecosystem – Includes benchmark datasets, transforms for meshes/point clouds, and links to tutorials, Colab notebooks, and external resources.

Typical workflow (quick‑tour excerpt)

  1. Load a dataset, e.g. the Cora citation graph via Planetoid.
  2. Define a model by stacking provided layers such as GCNConv.
  3. Train with the standard PyTorch optimizer loop.
  4. Evaluate on node‑classification or other graph tasks.

Who should use it – Machine‑learning researchers experimenting with new GNN ideas, data scientists needing a production‑ready GNN toolbox, and anyone who already works with PyTorch and wants to add graph capabilities.

Links from the README


All information above is taken directly from the repository’s README; no additional features are inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Dispatch