Skip to main content

Core library for graph-structured parameter optimization via gradient methods.

Project description

GradGraph

License: MIT Tests Documentation Status PyPI version PyPI downloads

GradGraph is a Python library for gradient-based parameter optimization on graph-structured data.
It provides tools to preprocess temporal graphs into optimization-ready arrays and TensorFlow templates for simulating ODE/PDE-based dynamical systems.


Features

  • Graph preprocessing

    • Extract linear paths from networkx graphs
    • Apply sliding-window transformations to generate equal-length arrays
    • Handle temporal node attributes (e.g. position, time of appearance)
  • Differentiable dynamical models

    • Define custom ODE/PDE-inspired layers (BasePDESystemLayer)
    • Use local vs. global trainable parameters with constraints
    • Built on tf.keras for automatic differentiation and training
  • Training utilities

    • BasePDESystemTrainer integrates with the full Keras training API
    • Gradient accumulation and optimizer splitting (global vs. local)
    • Early stopping, learning rate scheduling, and checkpointing callbacks
  • Applications

    • Modeling biological growth (e.g. fungal networks)
    • Simulating transport, epidemiological spread, and other temporal graph processes
    • General gradient-based parameter estimation on irregular domains

Installation

From PyPI (recommended)

The package is published on PyPI, so you can install it directly with:

pip install gradgraph

From source

git clone https://github.com/Fricker95/gradgraph.git
cd gradgraph
pip install -e .

Dependencies include: numpy, scipy, networkx, tensorflow>=2.0, matplotlib.


Examples

See the notebooks in examples/ (e.g., example_linear_growth_graph.ipynb) for end-to-end workflows: loading graphs, feature extraction, interpolation, model setup, training, and evaluation.


Documentation

Full API docs and guides are available on ReadTheDocs:
https://gradgraph.readthedocs.io/en/latest/

If you find something missing or unclear, please open an issue or PR.


Community

Who is this for?
Researchers and practitioners in network science, computational biology, applied mathematics, and machine learning who fit dynamical models on graphs and need efficient, gradient-based parameter estimation.

How to contribute

  • Open an issue for bugs or feature requests: https://github.com/Fricker95/gradgraph/issues
  • Submit a pull request for improvements (tests appreciated!).
  • Follow a clear commit message style and include concise docstrings/type hints where possible.

If you plan a larger contribution, feel free to start a discussion in an issue to align on design.


License

This project is released under the MIT License.
See the LICENSE file for details.


Citation

This work was supported by EUR SPECTRUM at Université Côte d’Azur (50%) and by the French National Research Agency (ANR) through the project NEMATIC (50%), grant number ANR-21ANR08Z6RCHX.

If you use GradGraph in your research, please cite the associated JOSS paper (pending):

@article{Fricker2025gradgraph,
  title   = {GradGraph: Gradient-based Parameter Optimization on Graph-Structured Data in Python},
  author  = {Fricker, Nicolas E. and Monasse, Laurent and Guerrier, Claire},
  journal = {Journal of Open Source Software},
  year    = {2025},
  note    = {In review},
}

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

gradgraph-0.0.2.tar.gz (396.7 kB view details)

Uploaded Source

Built Distribution

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

gradgraph-0.0.2-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file gradgraph-0.0.2.tar.gz.

File metadata

  • Download URL: gradgraph-0.0.2.tar.gz
  • Upload date:
  • Size: 396.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gradgraph-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d731dd566407098c3e5f6e83935c7299fe889d3ce794cae807a823a9f6fef86f
MD5 b4727c24dff3893f71b1493c93b22873
BLAKE2b-256 c994da23d89b89aca9559372ae7d8975a429044e9941c6b63839fc902aea13de

See more details on using hashes here.

File details

Details for the file gradgraph-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: gradgraph-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gradgraph-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae34f2d6ffede87c613d94e063158c7b623f4bf9b02d40dfa42fe9b77cfdfe0f
MD5 71f282f2b205de022be6149db54bf53a
BLAKE2b-256 c66878a09ca87217387e7a3ea2b0ba6f550b1dd7ab6dfda23e9ea38f3e9ce3bb

See more details on using hashes here.

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