Skip to main content

A Python toolbox for graph processing and analysis with Graph Neural Network utilities.

Project description

logo

License: GPL v3 CI Maintainer Documentation

GraphToolbox

GraphToolbox is a Python package designed for graph machine learning focused on time-series forecasting. It provides tools for data handling, model building, training, evaluation, and visualization.

Features

  • Data handling and preprocessing for graph datasets.
  • Various graph neural network models including Graph Convolutional Networks (GCNs), GraphSAGE and Graph Attention Networks (GATs).
  • Training and evaluation utilities for graph-based models.
  • Visualization tools for graph data and model results.

Convolutions

We benchmarked the entire collection of torch_geometric.nn.conv layers against myGNN, evaluating whether each operator can be instantiated and run end-to-end with standard node-feature inputs and a homogeneous graph structure.

Legend:

  • 🟢 = Working (fully compatible with myGNN)
  • 🔴 = Skipped (requires the dgNN package, not available on all platforms)
  • ⚪️ = Skipped (requires CUDA-specific dependencies or device-restricted libraries)
Convolution Type Status Convolutions
GCN / Spectral 🟢 GCNConv, ChebConv, SGConv, SSGConv, LGConv, GCN2Conv, ClusterGCNConv, FAConv
Attention-based 🟢 GATConv, GATv2Conv, SuperGATConv, TransformerConv, AGNNConv, DNAConv
MPNN / Aggregation 🟢 SAGEConv, GENConv, GraphConv, MFConv, LEConv, SimpleConv, EGConv, GravNetConv
MLP-based (GIN-style) 🟢 GINConv, GINEConv
Edge-conditioned 🟢 NNConv, ECConv, CGConv, GMMConv, GeneralConv, XConv
Recurrent / Gated 🟢 GatedGraphConv, ARMAConv, TAGConv
Residual / Deep 🟢 DirGNNConv, AntiSymmetricConv, FiLMConv, ResGatedGraphConv, PDNConv
Spectral / Poly 🟢 MixHopConv, GPSConv, FeaStConv, SplineConv, PANConv
Dynamic aggregators 🟢 PNAConv, EdgeConv, DynamicEdgeConv
Relational 🟢 RGCNConv, RGATConv, FastRGCNConv
Graph-level 🟢 WLConv, SignedConv
Missing optional deps 🔴 FusedGATConv (dgNN)
Heterogeneous graphs ⚪️ HANConv, HGTConv, HEATConv, HeteroConv
Point-cloud ⚪️ PointNetConv, PointConv, PointGNNConv, PointTransformerConv, PPFConv
CuGraph (CUDA only) ⚪️ CuGraphGATConv, CuGraphRGCNConv, CuGraphSAGEConv
Hypergraph ⚪️ HypergraphConv

Detailed statistics per status:

Status Count Percentage
🟢 51 78.5 %
🔴 1 1.5 %
⚪️ 13 20.0 %
Total Tested 65 100 %

FusedGATConv is not broken; it requires the dgNN package which is not available on all platforms. Installing it will make it pass. Installing torch-cluster, torch-sparse, and torch-spline-conv unlocked DynamicEdgeConv, GravNetConv, XConv, PANConv, and SplineConv.

If you spot a missing convolution, find an incompatibility, or want to help extend support, contributions are warmly welcomed! Feel free to open an issue or submit a PR so we can improve these results.

Installation

To install GraphToolbox, clone the repository and install the dependencies:

git clone git@github.com:eloicampagne/GraphToolbox.git
cd GraphToolbox
pip install .

To unlock the full set of supported convolutions, install the optional PyTorch Geometric extensions that match your PyTorch and platform versions. Replace ${TORCH} and ${CUDA} with the appropriate values (e.g. 2.5.1 and cpu):

pip install torch-scatter torch-sparse torch-cluster torch-spline-conv \
    -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html

Without these packages, DynamicEdgeConv, GravNetConv, XConv, PANConv, and SplineConv are unavailable. FusedGATConv additionally requires dgNN, which is not available on all platforms.

Usage

Here is a basic example of how to use GraphToolbox:

from torch_geometric.nn import GATConv

from graphtoolbox.data import DataClass, GraphDataset
from graphtoolbox.models import myGNN
from graphtoolbox.training import Trainer

# Load datasets
out_channels = 48
data = DataClass(path_train='./train.csv', 
                 path_test='./test.csv', 
                 data_kwargs=data_kwargs,
                 folder_config='.')

graph_dataset_train = GraphDataset(data=data, period='train', 
                                   graph_folder='../graph_representations',
                                   dataset_kwargs=dataset_kwargs,
                                   out_channels=out_channels)
graph_dataset_val = GraphDataset(data=data, period='val', 
                                 scalers_feat=graph_dataset_train.scalers_feat, 
                                 scalers_target=graph_dataset_train.scalers_target,
                                 graph_folder='../graph_representations',
                                 dataset_kwargs=dataset_kwargs,
                                 out_channels=out_channels)
graph_dataset_test = GraphDataset(data=data, period='test',
                                  scalers_feat=graph_dataset_train.scalers_feat, 
                                  scalers_target=graph_dataset_train.scalers_target,
                                  graph_folder='../graph_representations',
                                  dataset_kwargs=dataset_kwargs,
                                  out_channels=out_channels)

# Initialize model
conv_class = GATConv
conv_kwargs = {'heads': 2}
params = {'num_layers': 3, 
          'hidden_channels': 364, 
          'lr': 1e-3, 
          'batch_size': 16, 
          'adj_matrix': 'gl3sr', 
          'lam_reg': 0}

model = myGNN(
    in_channels=graph_dataset_train.num_node_features,
    num_layers=params["num_layers"],
    hidden_channels=params["hidden_channels"],
    out_channels=out_channels,
    conv_class=conv_class,
    conv_kwargs=conv_kwargs
)

# Initialize trainer
trainer = Trainer(
    model=model,
    dataset_train=graph_dataset_train,
    dataset_val=graph_dataset_val,
    dataset_test=graph_dataset_test,
    batch_size=params["batch_size"],
    return_attention=False,
    model_kwargs={'lr': params["lr"], 'num_epochs': 200},
    lam_reg=params["lam_reg"]
)

# Train model
pred_model_test, target_test, edge_index, attention_weights = trainer.train(
    plot_loss=True,
    force_training=True,
    save=False,
    patience=75
)

# Evaluate model
trainer.evaluate()

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Special thanks to all contributors of the GraphToolbox project:

  • Eloi Campagne
  • Itai Zehavi

Citation

If you use the GraphToolbox in your work, please cite the corresponding paper:

@article{campagne2025graph,
    author = {Campagne, Eloi and Amara-Ouali, Yvenn and Goude, Yannig and Kalogeratos, Argyris},
    title = {Graph Neural Networks for Electricity Load Forecasting},
    journal={arXiv preprint arXiv:2507.03690},
    year = {2025},
}

License

This project is licensed under the GPL License - see the LICENSE file for details.

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

graphtoolbox-0.1.0.tar.gz (119.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphtoolbox-0.1.0-py3-none-any.whl (117.9 kB view details)

Uploaded Python 3

File details

Details for the file graphtoolbox-0.1.0.tar.gz.

File metadata

  • Download URL: graphtoolbox-0.1.0.tar.gz
  • Upload date:
  • Size: 119.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for graphtoolbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7508d182e1e50aa6119ec82d11bbccf181c4f3ebb573b5b80f5b96e6a4da6011
MD5 0972ff314525c5291c60c1fca1a1cf32
BLAKE2b-256 ffe798e63555febeb7c45f8f42198429e4e3eefb5869559bc5a535f560d2302e

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphtoolbox-0.1.0.tar.gz:

Publisher: publish.yml on eloicampagne/graphtoolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graphtoolbox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: graphtoolbox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 117.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for graphtoolbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d7fd202e3e9aa7bdd4a78f8143d59117e14f7b483c8c980afb9d994d7c1c4de
MD5 4fdcc5f3cf00d4164addd1ba0dc0cb6b
BLAKE2b-256 07f71c3009d7e3528818d6e99be0e38fbd50b54062ac8e9d2840474cd787372b

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphtoolbox-0.1.0-py3-none-any.whl:

Publisher: publish.yml on eloicampagne/graphtoolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page