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

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.},
  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.1.tar.gz (577.2 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.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gradgraph-0.0.1.tar.gz
  • Upload date:
  • Size: 577.2 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.1.tar.gz
Algorithm Hash digest
SHA256 55d4087c619f2ea62ef4200c9c545a5125fed77af7ba47459cbdee406f0f215d
MD5 ee770a11e76a103d25887e1cafd002ac
BLAKE2b-256 8bac4355feb1343ba5b2a61d5198c064b3419d43a09a5e578892475a0ba564f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gradgraph-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 33.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 819203bfdbc44902538825684de048470fae2d20460c63d25fb3f82fffe01f67
MD5 8068ab2f33873a7a8c955e054312fc7b
BLAKE2b-256 4c9649d908a4b40fdd8e951d19ad2093cd23bc9c0b6624df106fae0bb0f6a2b9

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