OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

PyG Documentation

PyG, or PyTorch Geometric, is a Python library built on PyTorch for developing and training graph neural networks and other geometric deep-learning methods. It provides graph data structures, dataset loaders, transforms, mini-batch handling and support for distributed and compiled training.

Independent OpenViST project profile, based on linked sources.

PyG Documentation — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use PyG when a PyTorch workflow needs graph-specific data handling, benchmark dataset access, batching across differently sized graphs, or graph neural network training support.

Who it is for

  • Python developers building graph neural networks with PyTorch
  • Researchers prototyping graph-learning methods on benchmark datasets
  • Teams handling graph, mesh or point-cloud data in geometric deep-learning workflows

Documented uses

  • Represent nodes, edges, features, targets and other graph attributes in a PyTorch-compatible data object.
  • Load and inspect benchmark datasets for graph or node prediction work.
  • Batch graphs with different numbers of nodes and edges for model training.
  • Apply transforms to graph and geometric data.
  • Build distributed or compiled graph-neural-network training workflows.
Before you choose

Requirements & limits

  • The core package requires PyTorch; the installation guide identifies Python 3.10 through 3.14.
  • Optional extension packages add specific capabilities and may require wheels matched to the PyTorch and CUDA versions.
  • The documented batching approach combines variable-size graphs through sparse block-diagonal connectivity and concatenated feature and target matrices.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install PyG for a basic Python setup

Install the core PyG package in a Python environment that already has PyTorch.

Before you start

  • Python 3.10 to 3.14
  • PyTorch
  • A virtual environment or container is recommended.

Steps

  1. Create or activate a virtual environment.

  2. Install the core package with the command below.

    Documented command
    pip install torch_geometric

Expected outcome

The core PyG package is installed; the documentation says basic use does not require external libraries beyond PyTorch.

Guide limitations

  • Additional packages are needed for some features, including heterogeneous GNN operators, graph sampling and clustering, accelerated sparse reductions, or SparseTensor support.
  • This is an installation recipe, not a test of the resulting environment.
Source-based practical guide

Load and batch the ENZYMES graph dataset

Follow the documented example to load ENZYMES and combine graphs into mini-batches.

Before you start

  • PyTorch and PyG installed
  • Access to download the dataset files

Steps

  1. Initialize TUDataset with root='/tmp/ENZYMES' and name='ENZYMES'.

  2. Create a PyG DataLoader with batch_size=32 and shuffle=True.

  3. Iterate over the loader to obtain batches; PyG combines graph connectivity and features for graphs of varying sizes.

Expected outcome

A loader yields graph mini-batches, with the documented example grouping 32 graphs per batch.

Guide limitations

  • The example demonstrates loading and batching, not model definition or training.
  • Dataset initialization downloads and processes raw dataset files.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
12 October 2026
Original website title
PyG Documentation — pytorch_geometric documentation · Official homepage title · retained in its source language