Skip to main content

Dynamic optimal transport on sparse reversible graphs in JAX

Project description

JGOT (JAX Graph Optimal Transport)

PyPI

jgot solves two-endpoint dynamic optimal transport on sparse reversible graphs using JAX, following the time-discrete formulation of Erbar et al. (2020).

Install

PyPI package:

Core library:

pip install jgot

Examples (plotting dependencies included):

pip install "jgot[examples]"

Development environment:

uv sync --group dev

Minimal Example

import jax.numpy as jnp
from jgot 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 = jnp.array([1.0, 0.0])
mass_b = jnp.array([0.0, 1.0])
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(),
)

sol = solve_ot(problem, OTConfig())
print(float(sol.distance), sol.converged, sol.iterations_used)

Important:

  • Densities are represented with respect to pi.
  • Endpoints must satisfy sum(pi * rho) == 1.

Documentation

Detailed docs live under docs.

Recommended starting points:

Examples

Runnable scripts:

See examples/README.md for commands and outputs.

Release Automation

Maintainer note:

  • Pushing a tag like v0.1.0 triggers the publish workflow to PyPI.
  • Manual TestPyPI staging is available through the GitHub Actions Publish workflow.
  • Trusted Publishing must be configured on both PyPI and TestPyPI.

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

jgot-0.1.1.tar.gz (107.5 kB view details)

Uploaded Source

Built Distribution

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

jgot-0.1.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file jgot-0.1.1.tar.gz.

File metadata

  • Download URL: jgot-0.1.1.tar.gz
  • Upload date:
  • Size: 107.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jgot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b34dc81bb7c8ca8324481f3b26a4f0806bd28cbb15a8508647e836d975cf56cd
MD5 773a4c247f956cea510f951138f7e8b5
BLAKE2b-256 a9c3a75918e5196d92458f50485619b8d5c8ce1eb9cb0efb4b57b79e5c28f231

See more details on using hashes here.

Provenance

The following attestation bundles were made for jgot-0.1.1.tar.gz:

Publisher: publish.yml on LvDAO/JaxGraphOT

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

File details

Details for the file jgot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: jgot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jgot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c04c6418b3cd2ca2acc8e27456f1bf550b58242331e8ac264f8f22254fd805ee
MD5 84c4f0ab4b888210ff88d360e65c9088
BLAKE2b-256 a92934e9b85e382ceb2efb1b2fc751432a5500c4911eddf1afc76f4313cd5dbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for jgot-0.1.1-py3-none-any.whl:

Publisher: publish.yml on LvDAO/JaxGraphOT

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