Skip to content

Examples

Runnable scripts in the examples/ folder of the repository. Each one trains a model end to end and takes its options on the command line (python examples/<script>.py --help). Most datasets are downloaded on first use.

Script What it shows
node_classification.py Full-batch node classification with the ready-made GCN, GraphSAGE and GAT models, on Planetoid, Amazon and Coauthor datasets.
sage_ogbn_products.py GraphSAGE on the official ogbn-products split, with a preparation step that streams the downloaded archive into memory-mapped feature and graph stores.
gcn.py, gat.py A GCN and a GAT written layer by layer on Cora, with early stopping (Cora is loaded through PyG, which must be installed).
link_prediction.py A GCN encoder and dot-product decoder on edges split with RandomLinkSplit.
hetero_sage_dblp.py A heterogeneous GraphSAGE written by hand on DBLP, trained with the heterogeneous NeighborLoader.
to_hetero_dblp.py The same task with a homogeneous model converted by to_hetero or to_hetero_with_bases.
metapath2vec_dblp.py Unsupervised author embeddings on DBLP with MetaPath2Vec (meta-path APCPA), checked by predicting each author's research area with a logistic regression.
tgn_jodie.py A Temporal Graph Network on a JODIE dataset, after PyG's examples/tgn.py.
tgn_tgbl.py TGN on a TGB link property prediction dataset (tgbl-wiki) with the official one-vs-many MRR evaluation, after py-tgb's TGN example.
tgn_tgbn.py TGN on a TGB node property prediction dataset (tgbn-trade), evaluated with NDCG@10, after py-tgb's TGN example.
pointnet2_modelnet.py PointNet++ classification on ModelNet10 with fps, radius and PointNetConv, after PyG's examples/pointnet2_classification.py.
graph_gps_peptides.py The GPS graph transformer with random-walk encodings on Peptides-func, after PyG's examples/graph_gps.py.
dictionary_lookup.py The synthetic DictionaryLookup benchmark from "How Attentive Are Graph Attention Networks?": GATConv against GATv2Conv.
graph_network_block.py A GraphNetworkBlock with custom edge, node and global models.
compute_dataset_stats.py Statistics (graphs, nodes, edges, features, labels) of the built-in datasets.