graphot
graphot solves dynamic optimal transport on sparse reversible graphs.
Use it when you want:
- a transport path between two endpoint distributions on a graph,
- node densities over time,
- edge fluxes over time,
- a solver that runs from Python and returns NumPy arrays.
Install
Install from PyPI:
pip install graphot
If you want to run the plotting examples:
pip install "graphot[examples]"
If you are working from a local checkout instead, run pip install . or
pip install ".[examples]" from the repository root.
These docs use the public import path graphot:
from graphot import solve_ot
Quick Start
import numpy as np
from graphot import (
GraphSpec,
LogMeanOps,
OTConfig,
OTProblem,
TimeDiscretization,
solve_ot,
)
graph = GraphSpec.from_undirected_weights(
num_nodes=2,
edge_u=[0],
edge_v=[1],
weight=[1.0],
)
mass_a = np.array([1.0, 0.0], dtype=np.float64)
mass_b = np.array([0.0, 1.0], dtype=np.float64)
rho_a = mass_a / graph.pi
rho_b = mass_b / graph.pi
problem = OTProblem(
graph=graph,
time=TimeDiscretization(num_steps=64),
rho_a=rho_a,
rho_b=rho_b,
mean_ops=LogMeanOps(),
)
solution = solve_ot(problem, OTConfig())
print("distance:", float(solution.distance))
print("converged:", solution.converged)
print("iterations:", solution.iterations_used)
Three Things To Remember
graphotexpects endpoint densities with respect tograph.pi, not raw masses.- Convert ordinary masses with
rho = mass / graph.pi. - Check
solution.convergedon harder problems before treating the result as final.
What You Get Back
The most useful outputs are:
solution.distancesolution.state.rhosolution.state.msolution.diagnostics
Start Here
- Getting Started
- Graph Model
- API Reference
- Examples Guide
- Debugging and Diagnostics
- Numerical Limitations
Examples
The repository includes ready-to-run scripts for:
- two-node transport,
- cycle transport,
- line transport,
- directed reversible transport,
- large-grid transport.
See examples/README.md for the example index.
Release files for graphot 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| graphot-0.0.2.tar.gz | 131.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| graphot-0.0.2-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| graphot-0.0.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| graphot-0.0.2-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
Total release size: 1.1 MB
Release files / graphot-0.0.2.tar.gz
| Download URL | graphot-0.0.2.tar.gz |
|---|---|
| Size | 131.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74a95fd17264f363cfbcf0b8b1f14a9c94729e1fb7fdfd6b825d2d7c3d44de19
|
|
BLAKE2b-256 checksum How to use checksums |
cf5dfe3a9efce72d90681c0025619be5c199c5acc10612a007e440d2a8260721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp313-cp313-win_amd64.whl
| Download URL | graphot-0.0.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 112.7 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
29679284aa7aa9f3b7113bf3e63d0e37fe260c066689f6f2b0cdb32712bd8ffa
|
|
BLAKE2b-256 checksum How to use checksums |
783bbceb51e043378d2e3d35c75ee2d2f10ab6a5d01d690f59f65d504077ffed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 121.5 kB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2fb85ffd9b70a8d7e1fd2b41fe212e1d42908d008bced13e50092dab8372f989
|
|
BLAKE2b-256 checksum How to use checksums |
73e60f0ddc8fd2589ab15177768fa6fd803a277901b0260c69ccf1e85533f927
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 98.4 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b0cc13b4b853114f278bd911d75f79d9f1df1d5873b098ae8451cc22c25bdfcb
|
|
BLAKE2b-256 checksum How to use checksums |
51c258aa34387ff76a9d75c72ed13f4a0405cd3d419fe39df268b6bc89e9a231
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp312-cp312-win_amd64.whl
| Download URL | graphot-0.0.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 112.7 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
555a45a6f9e67725e95fd577e2dcaf780d596d07d020caf6c45138be13320699
|
|
BLAKE2b-256 checksum How to use checksums |
149c60785203679bb0ba30cbf658ae8500d20c33d2d7b226a487d14d241757ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 121.7 kB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b55a26bb66c7a70101bb5ba0497399b5b2bb5cf852ff733866df39431e1d33f0
|
|
BLAKE2b-256 checksum How to use checksums |
865e84e6864df7e0d7945b5d3b701345e523d7262853f4ef10fa320846778fe7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 98.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4b5e3eb48fdc5bbb7f4805514f1ad8265013eb1cebfbb84f7c044a8618093556
|
|
BLAKE2b-256 checksum How to use checksums |
b0859141cac4171ea3cf7e028c1cb965bcce77036eee18e33b60c155846cb5af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp311-cp311-win_amd64.whl
| Download URL | graphot-0.0.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 113.8 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a5f237d1dfb1f5fb8a8c1d2f08309d5f081b666ff02816a4827083e25b73a72f
|
|
BLAKE2b-256 checksum How to use checksums |
2846eaf07d8035c8e1e3d6c082bbf25542c54dca3337465f3aaa30994ac74d36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 121.8 kB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a282db6a3c89f1afaf57130ccd6ac9777486c36cb2359d40e14c8c45dbc0f963
|
|
BLAKE2b-256 checksum How to use checksums |
514316a29caa8997ebc5a29a376bde2668cb3cd95625c1edd17b94e12c4b48b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 99.0 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d54bbc03c62c187f103b9153e1d255c63f558077e886b179cdc579db3fa02ae4
|
|
BLAKE2b-256 checksum How to use checksums |
bbbce528d743674594eaa970e9037924c95d2ae45e4b59824f0a96072cf9fa93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency log