Graph optimal transport on sparse reversible graphs
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphot-0.0.2.tar.gz.
File metadata
- Download URL: graphot-0.0.2.tar.gz
- Upload date:
- Size: 131.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a95fd17264f363cfbcf0b8b1f14a9c94729e1fb7fdfd6b825d2d7c3d44de19
|
|
| MD5 |
2d09ea044497e0349f3803d0b0c876f0
|
|
| BLAKE2b-256 |
cf5dfe3a9efce72d90681c0025619be5c199c5acc10612a007e440d2a8260721
|
Provenance
The following attestation bundles were made for graphot-0.0.2.tar.gz:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2.tar.gz -
Subject digest:
74a95fd17264f363cfbcf0b8b1f14a9c94729e1fb7fdfd6b825d2d7c3d44de19 - Sigstore transparency entry: 1107678093
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: graphot-0.0.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 112.7 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29679284aa7aa9f3b7113bf3e63d0e37fe260c066689f6f2b0cdb32712bd8ffa
|
|
| MD5 |
83f64bfa4ede6c7e5152841ce7c2177f
|
|
| BLAKE2b-256 |
783bbceb51e043378d2e3d35c75ee2d2f10ab6a5d01d690f59f65d504077ffed
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp313-cp313-win_amd64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp313-cp313-win_amd64.whl -
Subject digest:
29679284aa7aa9f3b7113bf3e63d0e37fe260c066689f6f2b0cdb32712bd8ffa - Sigstore transparency entry: 1107678097
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 121.5 kB
- Tags: CPython 3.13, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb85ffd9b70a8d7e1fd2b41fe212e1d42908d008bced13e50092dab8372f989
|
|
| MD5 |
c3868f30561906afd50fb1437db9490e
|
|
| BLAKE2b-256 |
73e60f0ddc8fd2589ab15177768fa6fd803a277901b0260c69ccf1e85533f927
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
2fb85ffd9b70a8d7e1fd2b41fe212e1d42908d008bced13e50092dab8372f989 - Sigstore transparency entry: 1107678103
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 98.4 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0cc13b4b853114f278bd911d75f79d9f1df1d5873b098ae8451cc22c25bdfcb
|
|
| MD5 |
4e53c54da984d2a44765c488a2dd6f37
|
|
| BLAKE2b-256 |
51c258aa34387ff76a9d75c72ed13f4a0405cd3d419fe39df268b6bc89e9a231
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
b0cc13b4b853114f278bd911d75f79d9f1df1d5873b098ae8451cc22c25bdfcb - Sigstore transparency entry: 1107678105
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: graphot-0.0.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 112.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555a45a6f9e67725e95fd577e2dcaf780d596d07d020caf6c45138be13320699
|
|
| MD5 |
d0e7a00f52b4aa478f48f1a6caf947a8
|
|
| BLAKE2b-256 |
149c60785203679bb0ba30cbf658ae8500d20c33d2d7b226a487d14d241757ed
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp312-cp312-win_amd64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp312-cp312-win_amd64.whl -
Subject digest:
555a45a6f9e67725e95fd577e2dcaf780d596d07d020caf6c45138be13320699 - Sigstore transparency entry: 1107678098
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 121.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b55a26bb66c7a70101bb5ba0497399b5b2bb5cf852ff733866df39431e1d33f0
|
|
| MD5 |
bb3560d97dc5b27f6d091c3826ba3ff3
|
|
| BLAKE2b-256 |
865e84e6864df7e0d7945b5d3b701345e523d7262853f4ef10fa320846778fe7
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
b55a26bb66c7a70101bb5ba0497399b5b2bb5cf852ff733866df39431e1d33f0 - Sigstore transparency entry: 1107678100
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 98.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b5e3eb48fdc5bbb7f4805514f1ad8265013eb1cebfbb84f7c044a8618093556
|
|
| MD5 |
99211de796888abd33567d68bf1727fe
|
|
| BLAKE2b-256 |
b0859141cac4171ea3cf7e028c1cb965bcce77036eee18e33b60c155846cb5af
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
4b5e3eb48fdc5bbb7f4805514f1ad8265013eb1cebfbb84f7c044a8618093556 - Sigstore transparency entry: 1107678095
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: graphot-0.0.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 113.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5f237d1dfb1f5fb8a8c1d2f08309d5f081b666ff02816a4827083e25b73a72f
|
|
| MD5 |
ec7ef5b86fff1d746db85d2b5d5170fe
|
|
| BLAKE2b-256 |
2846eaf07d8035c8e1e3d6c082bbf25542c54dca3337465f3aaa30994ac74d36
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp311-cp311-win_amd64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp311-cp311-win_amd64.whl -
Subject digest:
a5f237d1dfb1f5fb8a8c1d2f08309d5f081b666ff02816a4827083e25b73a72f - Sigstore transparency entry: 1107678101
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 121.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.24+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a282db6a3c89f1afaf57130ccd6ac9777486c36cb2359d40e14c8c45dbc0f963
|
|
| MD5 |
f9b63181a45ae886dfed091d8c524703
|
|
| BLAKE2b-256 |
514316a29caa8997ebc5a29a376bde2668cb3cd95625c1edd17b94e12c4b48b9
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
a282db6a3c89f1afaf57130ccd6ac9777486c36cb2359d40e14c8c45dbc0f963 - Sigstore transparency entry: 1107678094
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 99.0 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d54bbc03c62c187f103b9153e1d255c63f558077e886b179cdc579db3fa02ae4
|
|
| MD5 |
43e14923295ba0d50ba183009363accb
|
|
| BLAKE2b-256 |
bbbce528d743674594eaa970e9037924c95d2ae45e4b59824f0a96072cf9fa93
|
Provenance
The following attestation bundles were made for graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
publish.yml on LvDAO/Graph-Optimal-Transport
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphot-0.0.2-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
d54bbc03c62c187f103b9153e1d255c63f558077e886b179cdc579db3fa02ae4 - Sigstore transparency entry: 1107678096
- Sigstore integration time:
-
Permalink:
LvDAO/Graph-Optimal-Transport@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/LvDAO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b43adeb1a3167c698377d7f3fb9077fcc271ff7 -
Trigger Event:
push
-
Statement type: