Unified graph learning framework with PyTorch
Project description
One graph learning surface for homogeneous, heterogeneous, and temporal workloads.
Documentation · Quick Start · API Reference · Examples · Support Matrix · Issues
VGL is a PyTorch-first graph learning library with one canonical Graph abstraction, one data loading surface, and one training stack.
It is designed for teams that do not want separate APIs for homogeneous graphs, heterogeneous graphs, temporal event graphs, batching, sampling, checkpoints, and trainer orchestration. The same public package surface spans all of those concerns.
Why VGL
- One graph container:
Graph.homo(),Graph.hetero(), andGraph.temporal()share one core representation with schema validation, views, and batching. - One training path:
Trainer,Task,Metric, checkpoints, callbacks, and loggers live in the same public surface instead of being stitched together ad hoc. - One sampling surface: node, link, graph, and temporal sampling all flow through
vgl.dataloading. - Interop without a separate project: DGL, PyG, NetworkX, CSV, and edge-list adapters are built in.
- Broad operator coverage: VGL ships 60+ convolution and encoder components on a consistent
MessagePassingfoundation.
Installation
VGL works with Python 3.10+ and PyTorch 2.4+.
pip install sky-vgl
pip install "sky-vgl[full]"
pip install "sky-vgl[networkx]"
pip install "sky-vgl[pyg]"
pip install "sky-vgl[dgl]"
Use full when you want the optional integration surface in one install. For environment-specific guidance, tested version combinations, and local verification commands, see the Support Matrix and the Installation guide.
Install from source
git clone https://github.com/skygazer42/sky-vgl.git
cd sky-vgl
pip install -e ".[dev]"
Quick Start
The shortest path into VGL is the same pattern you see in mainstream Python ML packages:
- Load or build a graph.
- Define a plain PyTorch model.
- Bind supervision through a
Task. - Train and evaluate with
Trainer.
import torch
import torch.nn as nn
import torch.nn.functional as F
from vgl import PlanetoidDataset, Trainer
from vgl.nn import GCNConv
from vgl.tasks import NodeClassificationTask
from vgl.transforms import Compose, NormalizeFeatures
dataset = PlanetoidDataset(
root="data",
name="Cora",
transform=Compose([NormalizeFeatures()]),
)
graph = dataset[0]
class GCN(nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels):
super().__init__()
self.conv1 = GCNConv(in_channels, hidden_channels)
self.conv2 = GCNConv(hidden_channels, out_channels)
def forward(self, graph):
x = self.conv1(graph.x, graph)
x = F.relu(x)
x = F.dropout(x, p=0.5, training=self.training)
return self.conv2(x, graph)
model = GCN(
in_channels=graph.x.size(1),
hidden_channels=64,
out_channels=graph.y.max().item() + 1,
)
task = NodeClassificationTask(
target="y",
split=("train_mask", "val_mask", "test_mask"),
metrics=["accuracy"],
)
trainer = Trainer(
model=model,
task=task,
optimizer=torch.optim.Adam,
lr=1e-2,
max_epochs=200,
)
history = trainer.fit(graph, val_data=graph)
print(trainer.test(graph))
Next steps:
Package Layout
| Module | What it gives you |
|---|---|
vgl.graph |
Graph, GraphBatch, GraphView, Block, HeteroBlock, schema-aware graph utilities |
vgl.dataloading |
DataLoader, samplers, sampling plans, sample records, materialization helpers |
vgl.nn |
graph operators, readout, encoders, MessagePassing, heterogeneous and temporal layers |
vgl.engine |
Trainer, callbacks, loggers, checkpoints, history, optimizer helpers |
vgl.tasks |
node classification, graph classification, link prediction, temporal prediction |
vgl.data |
built-in datasets, dataset registry, on-disk dataset support |
vgl.ops |
graph queries, compact/subgraph utilities, block construction, random walks |
vgl.compat |
DGL, PyG, NetworkX, CSV, and edge-list interoperability |
vgl.storage |
feature stores, graph stores, mmap-backed storage primitives |
vgl.transforms |
feature, split, and structure transforms |
GraphBatch is the canonical batched graph container for graph-level training inputs.
GraphView is the canonical read-only graph projection for snapshot/window-style access.
NodeStore and EdgeStore are lower-level storage-facing graph internals; prefer Graph, GraphView, and GraphBatch in application code.
Architecture
VGL is organized around a stable public graph core plus task-oriented higher layers. The intended path is:
Graph -> DataLoader / samplers -> Task -> Trainer
That keeps the data model, batch model, and training loop aligned instead of exposing unrelated APIs that users have to reconcile themselves.
If you want the fuller package walkthrough, see the Architecture overview and Core concepts.
Choosing VGL vs. PyG or DGL
Choose VGL when you want one consistent package surface across graph types and training workflows.
Choose PyG when your priority is the broader PyTorch-native graph ecosystem around Data, HeteroData, NeighborLoader, HGTLoader, to_hetero(), and optional compiled extensions.
Choose DGL when GraphBolt-style staged data pipelines or distributed graph training and sampling are first-order requirements.
References:
Examples
Representative examples live under examples/:
examples/homo/node_classification.pyexamples/homo/graph_classification.pyexamples/homo/link_prediction.pyexamples/homo/conv_zoo.pyexamples/hetero/node_classification.pyexamples/hetero/link_prediction.pyexamples/hetero/graph_classification.pyexamples/temporal/event_prediction.pyexamples/temporal/memory_event_prediction.py
The full, browsable set is documented on the Examples page.
Documentation
The published documentation is at skygazer42.github.io/sky-vgl.
Development
Run the main local checks before sending a change upstream:
python -m pytest -q
python -m ruff check .
python -m mypy vgl
python -m mkdocs build --strict
Compatibility note:
Legacy compatibility namespaces stay supported through the current 0.x line. New code should migrate to vgl.graph, vgl.dataloading, vgl.engine, vgl.tasks, and vgl.metrics now. Breaking removals will be announced in the changelog before they ship.
See the Migration guide for the stable import paths.
Compatibility changes and migration notes are tracked in docs/changelog.md.
Performance-impacting changes should summarize benchmark method or artifact changes in docs/changelog.md.
Contributing
Contributions are welcome.
- Fork the repository.
- Create a branch for your change.
- Run the local verification commands.
- Open a pull request with the problem statement, approach, and verification notes.
If your change affects packaging, release behavior, or optional backends, also read the Release guide and Support Matrix.
License
See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sky_vgl-0.2.1.tar.gz.
File metadata
- Download URL: sky_vgl-0.2.1.tar.gz
- Upload date:
- Size: 236.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0610a3a08bc92700b82dbba2626a078c9b4d61faecbf75a43b559a086aa6c6cc
|
|
| MD5 |
f50c5f52fac20780e6067a587570ccfa
|
|
| BLAKE2b-256 |
8c16d2c6cdaaa72104287dd60422ebb9e4de56ea4d61a35a3b9e4e58bf804621
|
File details
Details for the file sky_vgl-0.2.1-py3-none-any.whl.
File metadata
- Download URL: sky_vgl-0.2.1-py3-none-any.whl
- Upload date:
- Size: 277.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ab15b33aa628b7921ed9a52ba57a865e8ad8d22a417106f9877d50eba16e57
|
|
| MD5 |
6f8ca4d041226d30241430f45fb91fb7
|
|
| BLAKE2b-256 |
6de38e81d25be175a460ef0e0f338e636ffa32a3025298ff026707ea4064b5b1
|