torch-geometric

Build and train graph neural networks with PyTorch Geometric layers.

33.0k|3.2k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill torch-geometric-k-dense-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: torch-geometric
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/torch-geometric
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill torch-geometric-k-dense-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PyG Geometric provides a PyTorch-based library for building and training graph neural networks, offering data structures, 60+ GNN layers, scalable training, and ecosystem tooling.

Core Features & Use Cases

  • Graph data and datasets: data containers, standard datasets, transforms, and loaders for node, graph, and link prediction tasks.
  • Modeling and experimentation: built-in layers (GCN, GAT, GraphSAGE, GIN, TransformerConv), heterogeneous graph support, and high-level APIs for rapid prototyping.
  • Scalability and explainability: support for neighbor sampling, large-graph workflows, and explainability modules.

Quick Start

Install PyG and start by building a simple GCN on a small dataset to see end-to-end training.

Frequently Asked Questions about torch-geometric

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a Graph Neural Network in PyTorch for node classification?

Build a Graph Neural Network in PyTorch for node classification using PyG's data containers and built-in layers like GCN or GraphSAGE, enabling end-to-end training on standard graph datasets.

Can I train GNN models on large graphs using neighbor sampling?

Train GNN models on large graphs using PyG's scalable neighbor sampling workflows, which allow efficient training on massive datasets without loading the entire graph into memory.

Does PyTorch Geometric support heterogeneous graphs for link prediction?

PyTorch Geometric supports heterogeneous graphs for link prediction by providing specialized data structures and message passing layers tailored for multi-type node and edge relations.

What is the best way to explain GNN model predictions on graph data?

Explain GNN model predictions on graph data using PyG's dedicated explainability modules, which help identify the structural and feature-based subgraphs driving node or graph classification outputs.

Do I need to install extra packages like torch_sparse to use PyG layers?

PyG requires PyTorch as a base dependency, while optional extras like torch_sparse and torch_scatter are needed to unlock specific advanced GNN layers and optimized scatter operations.