A Barycentric Coding Model for Measures on Graphs

Synthesis and analysis of measures via discrete transport geometry

Structure of the talk

New in this talk: exponential and logarithmic maps for the discrete transport geometry computed by Hamiltonian shooting, with no time discretization of the variational problem, put to work in barycentric synthesis and analysis for measures on graphs.

  1. Background: the Kantorovich problem, the Wasserstein metric \(W_2\), and the barycentric coding model (BCM) it supports
  2. Why the Kantorovich picture breaks on a graph
  3. Solution 1: keep Kantorovich and regularize (entropic transport on a graph metric)
  4. Solution 2: start from Benamou–Brenier instead, and build a Riemannian structure on measures that sees the edges; implement the BCM there
  5. New: computing the exponential and logarithmic maps of that structure by Hamiltonian shooting
  6. Numerical experiments, and where this might go next

Introducing myself

A bit about me

  • Defended my PhD in mathematics at Tufts University this April, where I was a member of the High Dimensional Learning & Data Analysis (HILDA) group under James M. Murphy
  • Other experience:
    • summer stint at the consulting firm Analysis Group Inc., where I worked on NLP problems as a data scientist
    • Naval Research Enterprise Internship at the Naval Research Laboratory, where I worked on novel signal processing methods in the Acoustics Division
  • Non-mathematical interests: music, cats, cooking (in no particular order, I could never choose between the 3)

Spatial Signal Processing

Signals that live on graphs

  • Social, transportation, sensor, and neuronal networks all carry data on the vertices of a weighted graph; today’s data are probability measures on the vertices
  • There is no grid and no coordinates, only the edges: the geometry of the domain is the graph
  • The question: how do we average such measures, and decompose one into others, in a way that respects that geometry?
A synthetic probability measure on the graph of the standard 10-20 EEG electrode system, coloured by mass
A synthetic measure on the standard 10-20 system graph

Shuman, Narang, Frossard, Ortega, Vandergheynst. “The emerging field of signal processing on graphs.” IEEE Signal Processing Magazine 30.3 (2013): 83–98.

Optimal Transport:

A Tool for Comparing Probability Distributions

A multimodal density mu transported onto a unimodal density nu by a map T

Optimal Transport Defines a Metric on Probability Measures

Kantorovich Problem, Wasserstein Geometry

  • Let \(\mu, \nu \in \P(\R^d)\) be finite variance probability measures on \(\R^d\). Then the optimal transport cost, denoted by \(W_2\), between \(\mu\) and \(\nu\) is given by the following optimization problem:
    \[ W_2^2(\mu,\nu) = \inf\left\{ \int_{\R^d\times\R^d} \|x-y\|^2\, d\gamma(x,y) : \gamma \in \Pi(\mu,\nu) \right\}. \]
  • This is a special case of the Kantorovich problem (KP), but for historical reasons the distance between measures defined by this problem is referred to as the \((L^2\)-)Wasserstein distance

Background on Optimal Transport

How does transport encode information about the underlying domain?

  • The \(W_2\) distance between two distributions tells us how expensive it is to move one to the other “physically”
  • This contrasts with, e.g., the \(L^2\) difference between the densities of two distributions, where mass “teleports”
Interpolation between two densities in the W2 geometry (mass slides across) and the L2 geometry (mass fades in and out) Schematic: W2 interpolation moves mass horizontally, L2 interpolation moves it vertically

Barycentric Coding Models

Averaging without linear structure

  • In \(\R^d\), a barycenter (AKA a weighted average) \(\bar x = \sum \lambda_i x_i\) of points \(\{x_i\}_{i=1}^p\) is also a minimizer for the function
    \[ x \mapsto \sum_i \frac{\lambda_i}{2} \|x - x_i\|^2 \]
  • The latter is expressed through a squared distance, so it generalizes. With a transport distance it defines transport barycenters (Agueh–Carlier 2011 for \(W_2\)): for a dictionary \(\Refs = \{\nu_i\}_{i=1}^p\) and weights \(\lambda \in \Delta^{p-1}\), i.e. \(\lambda_i \ge 0\), \(\sum_i \lambda_i = 1\),
    \[ \nu_\lambda = \arg\min \left\{ \J_{\Refs,\lambda}[\nu] = \sum_i \frac{\lambda_i}{2} W_2^2(\nu, \nu_i) \right\} \]
  • Two jobs: synthesis, given \(\Refs, \lambda\) compute \(\nu_\lambda\); analysis, given \(\nu_0\) and \(\Refs\) recover \(\lambda\)

Agueh, Carlier (2011); Werenski et al. (2022); in GW geometry, Chowdhury, Needham (2020) and Díaz Martín, Medri, Murphy (2025).

Example BCM

  • Vertices of the triangle: the dictionary atoms, three measures on the graph of the contiguous US states
  • Points inside: syntheses of the atoms
  • Each is annotated with its true \(\lambda\) and the \(\hat\lambda\) recovered by analysis: to \(4 \times 10^{-8}\) with Hamiltonian shooting; the paper’s Chambolle-Pock analysis of the same measures lands at \(10^{-2}\)–\(10^{-3}\)
  • Computed with the graph transport geometry of this talk; by the end you will know how
A triangle of measures on the US states graph, annotated with true and recovered barycentric coordinates

Why do this?

Applications of optimal transport on discrete domains & BCMs in general

  • Some things we can do with transport-based BCMs:
    • Automatic color grading of images, inferring reflectance functions & missing geometry (Bonneel et al. 2016, using entropic transport; next section)
    • Construct novel ways to study community segregation (Peng, Murphy 2025)
    • Sample efficient classification of point cloud data (Mallery, Murphy, Aeron 2025)
A photo of two cats on a purple couch, recolored in steps along a graph transport geodesic toward the blue and yellow palette of Van Gogh's The Starry Night, shown at right
Color grading (after Bonneel et al.): quantize both images to 64 colors in CIELAB, so each image becomes a histogram, a probability measure on those 64 points; Bonneel et al. transport with the cost \(\|c_i - c_j\|^2\) on this fixed support. Here the 64 colors are joined into a 6-nearest-neighbour graph and the photo’s histogram moves along a graph-transport geodesic toward the painting’s: on a general graph the ground cost is replaced by transport along edges

Definitions

Graphs, Markov chains, and measures on them

  • A graph \(\X = (V, E)\), simple and connected, with symmetric edge weights \(\omega : E \to \R^+\) (\(\omega \equiv 1\) if unspecified), represented by the transition kernel \(Q\) of its random walk and the steady state distribution \(\pi\):
    \[ Q(x,y) = \frac{\omega(x,y)}{\deg_\omega(x)}\ \text{for } (x,y) \in E,\ 0 \text{ otherwise}; \qquad \pi(x) = \frac{\deg_\omega(x)}{\sum_{y \in V} \deg_\omega(y)}; \qquad \pi(x)Q(x,y) = \pi(y)Q(y,x) \]
  • A function \(\varphi\) on \(\X\) lives on the vertices, \(\varphi \in \R^{|V|}\); a vector field \(\Phi\) lives on the edges, \(\Phi \in \R^{|V| \times |V|}\)
  • Probability measures are densities with respect to \(\pi\):
    \[ \P(\X) = \Big\{ \nu \in \R_+^{|V|} : \sum_{x \in \X} \nu(x)\pi(x) = 1 \Big\} \]
    a simplex; its interior is \(\{\nu > 0\}\), its boundary the measures that vanish somewhere

Why is transport on graphs a problem?

Degeneracy of the Classical Transport Geometry when \(|\Omega| < \infty\)

  • Exercise to the reader: Let \(\X_2 = \{a, b\}\) be the two-point graph with a single edge. Characterize every coupling for a fixed pair of measures \(\nu_\alpha, \nu_\beta \in \P(\X_2)\) and solve KP explicitly
  • Conclude that \(\left(\P(\X_2), W_2\right) \simeq \left([0,1], \sqrt{|x-y|}\right)\)
  • Further conclude that if \(\nu(t) : [0,1] \to \P(\X_2)\) is a geodesic curve then it is constant! So you can’t even define a shortest-path between two measures on a two point graph.
  • Moral of the story: transport on a discrete space breaks if we come at it from the POV of coupled probability measures / KP

Two Ways Out

What do we do computationally about the degenerate transport geometry?

  • The Kantorovich problem is degenerate on a graph, but it is a linear program on matrices, and the BCM only needs a distance and a way to minimize \(\J\)
  • Solution 1 (static): keep the Kantorovich problem. Regularize it so it stops being degenerate, and feed it a cost matrix built from the graph. Cheap, and the graph is seen only through pairwise distances
  • Solution 2 (dynamic): replace the Kantorovich problem by the fluid-mechanical picture of \(W_2\) (Benamou–Brenier, coming up): \(W_2\) as the least kinetic energy of a flow carrying one measure to the other. Kinetic energy and flows make sense on a graph, and they define a Riemannian metric on \(\P(\X)\) that lives on the edges; the price is solving differential equations on the graph instead of a linear program

Solution 1: Keep Kantorovich, Regularize

Entropic transport on a ground metric built from the graph

A “Static” Approach to Barycenters of Measures

Entropic regularization: four steps to a BCM on a graph

  1. Cuturi 2013. Regularize the Kantorovich problem with an entropy term: strongly convex, and Sinkhorn’s algorithm computes transport costs at “lightspeed”
    \[ \begin{aligned} \OT_{reg}(\mu, \nu) &= \inf\left\{ \langle \gamma, C \rangle + \varepsilon_{reg} H(\gamma) : \gamma \in \Pi(\mu, \nu) \right\}, \quad H(\gamma) = -\sum_{x,y \in \X} \gamma(x,y)\left(\log \gamma(x,y) - 1\right) \end{aligned} \]
  2. Benamou, Carlier, Cuturi, Nenna, Peyré 2015. Regularized barycenters of empirical measures by iterative Bregman projections
  3. Bonneel, Peyré, Cuturi 2016. On a fixed support, differentiate through Sinkhorn to fit the weights: a first BCM with both synthesis and analysis
  4. G., Murphy 2025. Plug a cost matrix built from the graph into that scheme (next slide)

Cuturi. “Sinkhorn distances: lightspeed computation of optimal transport.” NeurIPS 26 (2013). Bonneel, Peyré, Cuturi. “Wasserstein barycentric coordinates: histogram regression using optimal transport.” ACM Trans. Graph. 35.4 (2016): 71.

Benamou, Carlier, Cuturi, Nenna, Peyré. “Iterative Bregman projections for regularized transportation problems.” SIAM J. Sci. Comput. 37.2 (2015): A1111–A1138.

Solution 1 in Practice

Regularized barycenters on the US states graph (G., Murphy, SampTA 2025)

  • The cost matrix comes from the graph: squared shortest-path distance, squared diffusion distance of the random walk at time \(t\), or a Fermat distance; Bonneel et al.’s fixed-support scheme does the rest
  • It works: synthesis and analysis both run, and the coordinates are recovered to a relative error of \(2 \times 10^{-5}\)
  • The drawback: a pairwise distance matrix does not encode edge connectivity, so the graph is seen only through distances; the entropy biases every output, and the geometry degenerates again as \(\varepsilon_{reg} \to 0\). What would a barycenter that sees the edges directly look like?
Three reference measures on the US states graph and their entropic barycenter with weights (0.5, 0.3, 0.2), recovered as (0.5010, 0.3004, 0.1986)
The SampTA experiment redone with the current code: squared diffusion-distance cost at \(t = 16\), \(\varepsilon_{reg} = 10^{-3}\), \(\lambda = (0.5, 0.3, 0.2)\); the recovered \(\hat\lambda\) and its relative error are under the panel

G., Murphy. “Regularized 2-Wasserstein barycenters on discrete metric spaces.” SampTA 2025.

Solution 2: Start from Benamou–Brenier

A Riemannian structure for transport on graphs

A simplex of measures with a geodesic curve between two of its points

The Fluid-Mechanical Picture of \(W_2\)

Benamou-Brenier Formula

  • A second characterization of \(W_2\): it arises from a Riemannian structure on an “infinite-dimensional manifold” of densities, via the Benamou–Brenier formula
    \[ W_2^2(\rho_0, \rho_1) = \inf\left\{ \A(\rho(x,t), V(x,t)) = \int_0^1 \|V(t,x)\|^2_{L^2(\rho(t,x))}\, dt \right\} \]
  • The infimum is taken over pairs \(\rho : [0,1] \times \R^d \to \R\), \(V : [0,1] \times \R^d \to \R^d\) which satisfy the continuity equation with temporal boundary conditions:
    \[ \frac{\partial \rho}{\partial t} + \nabla \cdot (\rho V) = 0; \qquad \rho(0, \cdot) = \rho_0,\ \rho(1, \cdot) = \rho_1 \]

Benamou, Brenier. “A computational fluid mechanics solution to the Monge-Kantorovich mass transfer problem.” Numer. Math. 84.3 (2000): 375–393. The Riemannian reading is Otto’s: “The geometry of dissipative evolution equations: the porous medium equation.” Comm. PDE 26 (2001).

Continuity Equations on Graphs

The admissible mean

  • The construction that follows is due to Maas (2011), independently Mielke (2011) and Chow–Huang–Li–Zhou (2012); its Riemannian geometry is developed in Erbar–Maas (2012)
  • Plan: take the right-hand side of Benamou–Brenier as the definition of a distance on \(\P(\X)\). On a graph, \(\nabla\) and \(\nabla\cdot\) are easy (differences along edges, sums over neighbours); the trouble is the product \(\rho V\) in the continuity equation, a function on vertices times a vector field on edges
    \[ \frac{\partial \rho}{\partial t} + \nabla \cdot (\rho V) = 0 \]
  • An admissible mean is a function \(\theta : \R^+ \times \R^+ \to \R^+\); it must be concave, lower semi-continuous, 1-homogeneous, symmetric, and \(C^2\) on \((0,\infty)^2\).
  • Examples:
    \[ \theta_{\log}(s,t) = \frac{s-t}{\log(s) - \log(t)}; \qquad \theta_{geo}(s,t) = \sqrt{st} \]
  • For \(\rho \in \P(\X)\), define \(\theta(\rho)(x,y) = \theta(\rho(x), \rho(y))\); now \(\theta\) turns functions into vector fields

Continuity Equations on Graphs, Cont’d

Finally: we write down a continuity equation

  • We now have the language to express a discrete continuity equation
\[ \CE(\rho_A, \rho_B) := \left\{ (\rho, m) : \frac{\partial \rho}{\partial t} + \divX(\theta(\rho) \odot m) = 0,\ \rho(0,\cdot) = \rho_A,\ \rho(1,\cdot) = \rho_B \right\} \]
\[ \A(\rho, m) := \frac{1}{2} \int_0^1 \sum_{i,j \in \X} \frac{m(t,i,j)^2}{\theta(\rho(t,i), \rho(t,j))}\, Q(i,j)\pi(i)\, dt. \]
\[ \W(\rho_A, \rho_B) := \inf\left\{ \sqrt{\A(\rho, m)} : (\rho, m) \in \CE(\rho_A, \rho_B) \right\}. \]

Read: the momentum \(m\) on each edge is charged against the mean \(\theta\) of the densities at its two ends, and \(\W\) is the least such kinetic energy along a path from \(\rho_A\) to \(\rho_B\). Benamou–Brenier, with \(\rho V\) replaced by \(\theta(\rho) \odot m\).

Maas, Jan. “Gradient flows of the entropy for finite Markov chains.” Journal of Functional Analysis 261.8 (2011): 2250–2292.

The \(\W\) Geometry

Riemannian Geometry Objects: Tangent Space & Metric Tensor

  • We’ll need to understand two things about the Riemannian geometry of \((\P(\X), \W)\): the metric tensor, and the exponential mapping
  • First, we need to say what the tangent space is, and how we can compute the inner product of two vectors at a point.
\[ T_\nu \P(\X) = \left\{ \nabla\varphi \in \R^{|V| \times |V|} : \varphi \in \R^{|V|} \right\}, \]
\[ \langle \nabla\varphi, \nabla\psi \rangle_\nu = \frac{1}{2} \sum_{x,y \in V} \theta(\nu(x), \nu(y))\, \nabla\varphi(x,y)\, \nabla\psi(x,y). \]

The \(\W\) Geometry, Cont’d

The two maps the rest of the talk computes

  • With \(\gamma_{\nu,m}\) the geodesic from \(\nu\) with initial velocity \(m \in T_\nu\P(\X)\):
    \[ \exp_\nu(m) = \gamma_{\nu,m}(1), \qquad \exp_\nu^{-1}(\gamma_{\nu,m}(1)) = m, \qquad \exp_\nu : U \subset T_\nu \P(\X) \to \P(\X) \]
  • \(\exp_\nu^{-1}\) is single-valued on the ball of the injectivity radius; the radius of \((\P(\X), \W)\) is not known, and everything below assumes we stay inside it
  • The geodesic equation of \((\P(\X), \W)\) is explicit, as a Hamiltonian system in \((\rho, \varphi)\); that is the shooting section

An Implementation of a Barycentric Coding Model for Graphs

What existed, and what we add

Barycentric coding on graphs, before and after

  • Before. Barycentric synthesis and analysis for entropic \(W_2\) on a fixed support (Bonneel, Peyré, Cuturi 2016): Solution 1. For \(\W\), a convex program for one geodesic (Erbar et al. 2020), no barycenters
  • What we add. A BCM on \((\P(\X), \W)\) built from its Riemannian structure: intrinsic gradient descent for synthesis, a tangent-space Gram matrix for analysis, both driven by \(\exp_\nu\) and \(\exp_\nu^{-1}\)
  • Two ways to compute those maps. Erbar et al.’s space-time convex program (the paper): any pair of measures, sparsely supported ones included. Hamiltonian shooting on the geodesic equations (new): one to two orders of magnitude faster, interior measures only

Erbar, Rumpf, Schmitzer, Simon (2020); Chow, Li, Zhou (2020); Cui, Liu, Zhou (2021); Cui, Dieci, Zhou, SIAM J. Sci. Comput. (2022).

Implementation Details

Just how ugly can it get?

  • The method proposed by Erbar et al. says, essentially: solve this problem
    \[ \begin{aligned} \min\Big\{ F^*(\vec x) + G(\vec x) = {}& \big(\hat\A(\vec x) + \mathcal{I}_{\J_\pm}(\vec x) + \mathcal{I}_{\J_{avg}}(\vec x)\big)^* \\ &+ \mathcal{I}_{\CE}(\vec x) + \mathcal{I}_{K}(\vec x) + \mathcal{I}_{\J_=}(\vec x) \Big\} \end{aligned} \]
  • Chambolle-Pock solves problems in this form by operating on \(F^*, G\) one after the other, and the decoupling means that each sub-function can be addressed directly
  • This amounts to 4 linear algebra problems and two batches of geometric projections that are solved by Newton’s method

Decomposition of Erbar et al.’s algorithm

It’s simple, really.

Diagram from Erbar et al. (2020) of the constraint sets and proximal maps in their Chambolle-Pock scheme

Erbar, Matthias, et al. “Computation of optimal transport on discrete metric measure spaces.” Numerische Mathematik 144.1 (2020): 157–200.

Synthesis: minimizing \(\J\)

Getting back towards barycenters

  • Recall that the variance functional is expressed directly in terms of a metric!
    \[ \J[\nu] = \sum_{i=1}^{p} \frac{\lambda_i}{2} \W^2(\nu_i, \nu) \]
  • Minimizers exist: \(\nu \mapsto \W^2(\nu_i, \nu)\) is convex along linear interpolations (Erbar–Maas 2012), so \(\J\) is convex and continuous on a compact convex set. Uniqueness, and convexity along geodesics, are open
  • To find one, the oldest trick in the book: gradient descent. Find the direction in which \(\J\) decreases fastest and take a small step that way
  • Two problems: how do I know what direction to walk in, and how do I walk in it?

Erbar, Maas. “Ricci curvature of finite Markov chains via convexity of the entropy.” Arch. Ration. Mech. Anal. 206 (2012): 997–1038.

Synthesis Plan: Intrinsic Gradient Descent

When in Non-Euclidean spaces, do as the Non-Euclidean Optimizers Do

  • Gradient descent, \(x_{k+1} = x_k - t_k \nabla F(x_k)\): the same idea on \(\P(\X)\), with the intrinsic gradient of the Riemannian structure and steps along its geodesics
Level sets of a quadratic function in the plane; gradient descent iterates x0, x1, x2 zig-zag toward the minimizer, each step along the negative gradient, perpendicular to the level set

Absil, Mahony, Sepulchre. Optimization Algorithms on Matrix Manifolds. Princeton (2008). Huang, Absil, Gallivan. “ROPTLIB: an object-oriented C++ library for optimization on Riemannian manifolds.” ACM TOMS (2016).

Synthesis Plan: Reading the Two Maps

What \(\exp^{-1}\) and \(\exp\) mean on a graph, and how the paper approximated the step

  • Direction, \(\exp^{-1}_\nu(\nu_i)\): the initial momentum \(m_i(0)\) of the geodesic from \(\nu\) to \(\nu_i\): an edge field, the tangent vector from the geometry section, the first output of any geodesic solver. The descent direction for \(\J\) is \(m = \sum_i \lambda_i m_i(0)\)
  • Step, \(\exp_\nu(\varepsilon m)\): the point at time \(\varepsilon\) on the geodesic launched from \(\nu\) with momentum \(m\). Geodesics solve the continuity equation, so near the launch point the step is one Euler step of it:
    \[ \frac{\partial\rho}{\partial t} = -\divX\big(\theta(\rho) \odot m\big) \quad\Longrightarrow\quad \exp_\nu(\varepsilon m) = \rho(\varepsilon) \approx \nu - \varepsilon\, \divX\big(\theta(\nu) \odot m\big) \]
  • The heuristic: replace \(\exp\) by this first-order update: momenta from the geodesic solver (next slides), one sparse product for the step, mass conserved because \(\divX\) sums to zero
  • What it costs: the error is \(O(\varepsilon^2)\) per step, so \(\varepsilon\) must be small and the descent takes many steps, each needing \(p\) fresh geodesics

Synthesis Plan: Intrinsic Gradient Descent

When in Non-Euclidean spaces, do as the Non-Euclidean Optimizers Do

  • The update in Riemannian calculus: the direction is a sum of logarithmic maps, the step an exponential map. Those two maps are all the BCM needs. Last line: the paper’s Euler step from the previous slide; shooting computes both maps directly
\[ \begin{aligned} \nu_{k+1} &= \exp_{\nu_k}\Big( -t_k \nabla_\W \Big\{ \sum_{i=1}^p \frac{\lambda_i}{2} \W^2(\nu_i, \nu) \Big\} \Big) \\ &= \exp_{\nu_k}\Big( t_k \Big( \sum_{i=1}^p \lambda_i \exp^{-1}_{\nu_k}(\nu_i) \Big) \Big) \\ &\approx \nu_k - t_k\, \divX\Big( \theta(\nu_k) \odot \sum_{i=1}^p \lambda_i m_i(0) \Big) \end{aligned} \]
A curved manifold with a tangent plane at the current iterate nu_0; the log-map directions to nu_1, nu_2, nu_3 live in the tangent plane

Approximating Geodesic Curves via Chambolle-Pock

Discretize space-time, then minimize the action as a convex program

  • Erbar et al. (2020): approximate \(\W\) by non-smooth convex optimization
  • Discretize \([0,1]\) into \(N\) steps, take a weak form of the CE, introduce slack variables to decouple the non-linear relations in the action, then minimize; the output is a discretized geodesic in the \(\W\) geometry
  • Works for any pair of measures, sparsely supported ones on the boundary included: the problem is convex and needs no interiority (remember this later)
A simplex of measures with a discretized geodesic curve between two of its points

Erbar, Matthias, et al. “Computation of optimal transport on discrete metric measure spaces.” Numerische Mathematik 144.1 (2020): 157–200.

Analysis Plan: Inverting The Exponential Map

Take it to the Tangent Space

  • To analyze a measure \(\nu_0\) against references \(\Refs = \{\nu_i\}_{i=1}^p\), we use a theorem of Werenski et al.
  • Theorem (Werenski, Murphy, Aeron et al. 2022, for \(W_2\) on \(\R^d\)). Let \(T_i\) be the optimal transport map from \(\nu_0\) to \(\nu_i\) and
    \[ A_{ij} = \big\langle T_i - \mathrm{Id},\ T_j - \mathrm{Id} \big\rangle_{L^2(\nu_0)} . \]
    Then \(\nu_0\) is the barycenter of \(\Refs\) with weights \(\lambda\) if and only if \(\displaystyle \min_{\lambda \in \Delta^{p-1}} \lambda^\top A \lambda = 0\), and the minimizer is \(\lambda\)
  • Why: the first-order condition for \(\J\) is \(\sum_i \lambda_i (T_i - \mathrm{Id}) = 0\), and \(T_i - \mathrm{Id} = \exp_{\nu_0}^{-1}(\nu_i)\) is a tangent vector, so \(\lambda^\top A \lambda = \|\sum_i \lambda_i \exp^{-1}_{\nu_0}(\nu_i)\|^2\)
  • On a graph: replace \(T_i - \mathrm{Id}\) by the log map and \(L^2(\nu_0)\) by the metric tensor at \(\nu_0\). Analysis is then \(p\) log maps, one \(p \times p\) Gram matrix, and a small quadratic program over the simplex

Werenski, Matthew, et al. “Measure estimation in the barycentric coding model.” International Conference on Machine Learning. PMLR, 2022.

Ambrosio, Luigi, Nicola Gigli, and Giuseppe Savaré. Gradient flows: in metric spaces and in the space of probability measures. Basel: Birkhäuser Basel, 2005.

Hyperparameters of the Algorithms

  • Our synthesis and analysis routines involve 4 hyperparameters:
    • \(\delta_g\) — convergence threshold for Chambolle-Pock, measures the weighted \(L^2\) norm difference between approximations of geodesics, default set at \(10^{-10}\)
    • \(N\) — number of steps per geodesic, defaults to 100 steps
    • \(\delta_b\) — convergence threshold for synthesis gradient descent, also an \(L^2\) norm measurement, default set at \(10^{-8}\)
    • \(\varepsilon\) — step size for gradient descent, default set at 1.0, dynamically shrinks if the step size takes the algorithm outside the admissible constraint set
  • N.B., each geodesic is expensive to compute, with complexity scaling quadratically in both \(N\) and \(|V|\)

Hamiltonian Shooting

Exponential and logarithmic maps without the space-time program

Where the time goes

The BCM only ever uses the start of a geodesic

  • Chambolle-Pock is a first-order method: reaching tolerances like \(\delta_g = 10^{-10}\) takes \(10^4\)–\(10^5\) iterations, each with a global space-time elliptic solve, over \(O(N \cdot |E|)\) variables
  • But look at what synthesis and analysis actually consume:
    • Synthesis: \(\exp_{\nu_k}\), and the initial momenta \(m_i(0)\)
    • Analysis: the initial tangent vectors \(\exp^{-1}_{\nu_0}(\nu_i)\), to build the Gram matrix
  • A geodesic is determined by its initial point and velocity, and satisfies an ODE of dimension \(2n\), independent of any time grid \(N\)
  • Idea: solve the geodesic ODE directly. \(\exp\) becomes an initial value problem; \(\exp^{-1}\) becomes a boundary value problem, solved by shooting

Geodesics as a Hamiltonian System

Position: the measure \(\rho\). Momentum: the potential \(\varphi\).

  • Stationarity of the action in \(m\) puts optimal momenta in gradient form, \(m_t = \theta(\rho_t) \odot \nabla\varphi_t\): velocities live in the tangent space from before
  • Stationarity in \(\rho\) gives the second equation. Together:
    \[ \dot\rho(x) = \sum_{y} \theta\big(\rho(x), \rho(y)\big)\, \nabla\varphi(x,y)\, Q(x,y), \qquad \dot\varphi(x) = -\frac{1}{2} \sum_{y} \partial_1\theta\big(\rho(x), \rho(y)\big)\, \nabla\varphi(x,y)^2\, Q(x,y) \]
  • These are Hamilton’s equations (in the \(\pi\)-weighted pairing) for the kinetic energy
    \[ H(\rho, \varphi) = \frac{1}{4} \sum_{x,y} \theta\big(\rho(x), \rho(y)\big)\, \nabla\varphi(x,y)^2\, Q(x,y)\pi(x) \]
  • First equation: the continuity equation. Second: a discrete Hamilton–Jacobi equation. On a graph this is the Wasserstein Hamiltonian flow of Chow–Li–Zhou, in the form written down by Cui–Liu–Zhou

Chow, Li, Zhou. “Wasserstein Hamiltonian flows.” J. Differential Equations 268.3 (2020): 1205–1219. Cui, Liu, Zhou. “What is a stochastic Hamiltonian process on finite graph? An optimal transport answer.” J. Differential Equations 305 (2021).

What the Hamiltonian buys us

Conservation laws, and the distance from initial data alone

  • \(H\) is conserved along geodesics: constant speed, and a free accuracy check on any integrator
  • Total mass is conserved: it is the conserved quantity of the gauge symmetry \(\varphi \mapsto \varphi + c\)
  • The metric speed is \(\|\dot\rho_t\|^2_\W = 2H\), so
    \[ \W^2(\rho_A, \rho_B) = \int_0^1 2H\, dt = 2H(\rho_A, \varphi_0) \]
    The squared distance is read off the initial data
  • The analysis Gram matrix is assembled exactly from the recovered potentials:
    \[ A_{ij} = \big\langle \nabla\varphi_i,\ \theta(\nu) \odot \nabla\varphi_j \big\rangle_Q \]

The Exponential Map

Shoot forward

  • Given \(\nu\) and a potential \(\varphi_0\) (or a momentum \(m_0\), converted by one weighted-Laplacian solve), integrate from \(\rho(0) = \nu\), \(\varphi(0) = \varphi_0\):
    \[ \exp_\nu(\nabla\varphi_0) = \rho(1) \]
  • In our implementation: fixed-step RK4, 150 steps on \([0,1]\); \(H\) and total mass drift by \(\sim 10^{-12}\) relative over the unit horizon
  • Interior only. The right-hand side of the ODE involves \(\partial_1\theta(\rho(x), \rho(y))\), which blows up as \(\rho(x) \to 0\): shooting needs \(\rho > 0\) everywhere and does not apply to sparsely supported measures, where Chambolle-Pock still does. A step that would push some \(\rho(x)\) below a positivity floor is bisected (up to 4 times) before giving up
  • Replaces the first-order heuristic \(\nu + t \operatorname{div}_\X m(0)\) in the synthesis update with an exponential map

The Logarithmic Map

Shooting: aim, fire, correct

  • To compute \(\exp_\nu^{-1}(\mu)\), solve for the initial potential:
    \[ F(\varphi_0) := \exp_\nu(\nabla\varphi_0) - \mu = 0 \]
  • Gauge \(\langle \varphi_0, 1 \rangle_\pi = 0\), and \(F\) conserves mass: \(n - 1\) equations in \(n - 1\) unknowns
  • Damped Newton, with the Jacobian by forward-mode automatic differentiation through the integrator and a backtracking line search on \(\|F\|_\pi\)
  • Initial guess: linearize the flow at \(t = 0\). One sparse SPD solve:
    \[ L_{\theta}(\nu)\, \varphi_0 = \pi \odot (\mu - \nu), \qquad L_\theta(\nu) = \nabla^\top \operatorname{Diag}\big(\kappa \odot \theta(\nu)\big) \nabla \]
    with \(\kappa(x,y) = Q(x,y)\pi(x)\) the symmetric edge weight: the graph Laplacian with edge weights \(\kappa \odot \theta(\nu)\)
  • Warm starts: in an outer loop, the previous \(\varphi_0\) is an excellent initial guess

Shooting for the geodesic BVP is classical in shape analysis: Klassen, Srivastava, Mio, Joshi, IEEE PAMI (2004). For Wasserstein–Hamiltonian systems: Cui, Dieci, Zhou, SIAM J. Sci. Comput. (2022).

Closing the Loop: the BCM by Shooting

The synthesis update from before, without the approximation

  • Synthesis. With \(\varphi_0^{(i)}\) the potential of \(\exp^{-1}_{\nu_k}(\nu_i)\):
    \[ \nu_{k+1} = \exp_{\nu_k}\Big( h\, \nabla \sum_{i=1}^p \lambda_i \varphi_0^{(i)} \Big) \]
    Each iteration: \(p\) log maps, warm-started from the previous iterate, and one exp map. Halve \(h\) if the step hits the positivity floor or fails to decrease \(\J\); stop when the descent direction’s metric norm \(\sqrt{2H}\) is small
  • Analysis. Log-map the target to each reference, build \(A_{ij} = \langle \nabla\varphi_i, \theta(\nu) \odot \nabla\varphi_j \rangle_Q\), solve the same quadratic program over the simplex
  • Two different time grids. Shooting still integrates the geodesic ODE on a grid of \(K\) RK4 steps, but that grid discretizes an ODE: error \(O(K^{-4})\), refined at will without touching Newton. Chambolle-Pock’s \(N\) steps discretize the action being minimized: error \(O(1/N)\), and every variable scales with \(N\). So synthesis and analysis should use the same method

A Geodesic by Shooting

3×3 grid, the example from the package tutorial

t = 0.00 0.254 0.190 0.063 0.190 0.127 0.048 0.063 0.048 0.016 t = 0.25 0.144 0.166 0.081 0.166 0.162 0.082 0.081 0.082 0.036 t = 0.50 0.075 0.125 0.088 0.125 0.175 0.125 0.088 0.125 0.075 t = 0.75 0.036 0.082 0.081 0.082 0.162 0.166 0.081 0.166 0.144 t = 1.00 0.016 0.048 0.063 0.048 0.127 0.190 0.063 0.190 0.254 0.0 0.1 0.2 mass
  • 6 Newton iterations; round trip \(\|\exp_{\rho_A}(\nabla\varphi_0) - \rho_B\| \approx 8 \times 10^{-12}\); relative drift in \(H\) along the path \(\approx 8 \times 10^{-13}\)
  • \(\W^2 = 4.774998\) by shooting vs. \(4.537\) and \(4.644\) from Chambolle-Pock at \(N = 20\) and \(40\), which approaches from below at rate \(O(1/N)\)

How fast?

Random interior endpoint pairs on grid graphs, 20 trials each

25 nodes, 40 edges100 nodes, 180 edges
Shooting \(\exp^{-1}\): Newton iterations, cold / warm3–4 / 2–33–4 / 3
Shooting \(\exp^{-1}\): time92 ms1.6 s
Chambolle-Pock (\(N = 32\), \(\delta_g = 10^{-8}\)): time3.1 s (34×)636.1 s (391×)
Round trip \(\|\exp_\nu(\exp_\nu^{-1}\mu) - \mu\|_\pi\), worst\(3 \times 10^{-11}\)\(9 \times 10^{-10}\)
\(\W^2\) vs. C-P, worst relative gap\(3 \times 10^{-2}\)\(3 \times 10^{-2}\)

Median wall-clock per geodesic, one CPU thread, after JIT warm-up. Chambolle-Pock is slow, so it was run on only 5 of the 25-node pairs and 1 of the 100-node pairs. The \(\W^2\) gap is Chambolle-Pock’s \(O(1/N)\) discretization of the action; shooting’s only discretization error is the integrator’s, \(O(K^{-4})\).

Shooting is one to two orders of magnitude faster than Chambolle-Pock, and the speedup grows with problem size: 34× at 25 nodes, 391× at 100 nodes.

Two Discretizations of the Same Geodesic

What each method discretizes, and what that costs

Chambolle-Pock (the paper)Hamiltonian shooting (new)
What is discretizedthe action, on a space-time gridthe geodesic ODE, in time only
Unknowns\(O(N\,|E|)\): a path \((\rho, m)\) on \(N\) time steps\(n - 1\): the initial potential \(\varphi_0\)
Error\(O(1/N)\) in the time steps (Γ-convergence)\(O(K^{-4})\) in the RK4 steps, refined at will
Iterationfirst order: \(10^4\)–\(10^5\) primal-dual steps to \(\delta_g = 10^{-10}\)Newton: 3–4 steps cold, 2–3 warm, to \(10^{-12}\)
Outputthe whole path; the first-interval momentum\(\varphi_0\), hence \(\exp^{-1}\) and \(\W^2 = 2H\)
Admissible dataany pair of measures, boundary includedinterior of the simplex only
Guaranteeglobal optimum of the discretized problem, with a duality gapa stationary path; minimality certified against the convex program

Shooting is an Interior Method

What happens near the boundary of the simplex

  • \(\partial_1\theta(s,t) \to \infty\) as \(s \to 0\): like \(\tfrac12\sqrt{t/s}\) for the geometric mean, like \(t/(s\log^2(s/t))\) for the logarithmic mean. Either way \(H\) is not \(C^1\) up to the boundary
  • This is geometry: a solution either exists for all time or, at some finite \(T\), some \(\rho(x) \to 0\) or \(\varphi \to \infty\) (Cui–Liu–Zhou 2021, Remark 3.3); geodesics can touch the boundary even between interior endpoints, and uniqueness can fail there (Gangbo–Li–Mou 2019)
  • In practice: mollify toward uniform, \(\nu_\varepsilon = (1-\varepsilon)\nu + \varepsilon\mathbb{1}\), shoot for decreasing \(\varepsilon\) (warm-started), extrapolate; for boundary-supported data, Chambolle-Pock remains the reference

Gangbo, Li, Mou. “Geodesics of minimal length in the set of probability measures on graphs.” ESAIM: COCV 25 (2019): 78. Cui, Liu, Zhou. “What is a stochastic Hamiltonian process on finite graph? An optimal transport answer.” J. Differential Equations 305 (2021).

Validating the Code with Numerical Experiments

Validation

How do we know if the thing actually works?

  • The code is validated by a suite of numerical experiments, looking at the following list of sanity checks:
    1. Invariants of the Hamiltonian flow along every integrated geodesic: \(H\) and total mass conserved (relative drift \(\sim 10^{-12}\)), round trip \(\exp_\nu(\exp_\nu^{-1}\mu) = \mu\) to \(10^{-10}\), time-reversal symmetry, and \(\sqrt{2H}\) against the closed-form distance on the two-point graph
    2. Agreement between independent solvers: do intrinsic descent with Chambolle-Pock geodesics and with Hamiltonian shooting land on the same barycenter?
    3. Round-trip consistency: synthesize with \(\lambda\), analyze to recover \(\hat\lambda\), check the relative error
    4. Comparison with the popular alternative: entropically regularized transport on a cost matrix built from the graph

A Geodesic Three Ways

Synthesis with \(\lambda = (1-t, t)\), the geodesic equations, and Chambolle-Pock

Top: the geodesic between two reference measures on a 5 by 5 grid at t = 0, 0.25, 0.5, 0.75, 1, by the Hamiltonian flow from the log map's initial potential. Bottom left: distance to that flow of the barycenter with weights (1-t, t), about 1e-6, and of the Chambolle-Pock path, about 1e-2. Bottom right: the coordinate t-hat recovered by shooting analysis of the point at time t from each of the three sources
Top: \(\gamma(t)\), the Hamiltonian flow from \(\varphi_0 = \exp^{-1}_{\nu_A}(\nu_B)\). Left: the barycenter with weights \((1-t, t)\) sits on \(\gamma\) to \(10^{-6}\); the Chambolle-Pock path at \(N = 20\) is \(10^{-2}\) off. Right: the coordinate recovered by analyzing the point at time \(t\) from each of the three sources

Two Solvers, One Barycenter

Intrinsic descent with Hamiltonian shooting vs. with Chambolle-Pock; same references, two edge weightings

Four reference measures on the hypercube graph; below, their barycenter by Hamiltonian shooting and by Chambolle-Pock, on the unweighted hypercube and with random edge weights drawn as edge widths
Round trip: analyzing each shooting barycenter against its references recovers \(\lambda = (\tfrac14, \tfrac14, \tfrac14, \tfrac14)\) to \(\|\hat\lambda - \lambda\|_\infty = 9 \times 10^{-8}\) (unweighted) and \(1.5 \times 10^{-7}\) (weighted); the Chambolle-Pock barycenters, analyzed the same way, to \(5 \times 10^{-3}\)

Two Solvers, One Barycenter

Intrinsic descent with Hamiltonian shooting vs. with Chambolle-Pock, 7×7 grid

Three reference measures on a 7 by 7 grid; below, the barycenter from intrinsic descent with Hamiltonian shooting and with Chambolle-Pock geodesics, which agree to within Chambolle-Pock's time discretization

Coordinate Recovery

Shooting recovers \(\lambda\) to \(10^{-7}\); Chambolle-Pock to \(10^{-3}\), bounded by its iteration tolerance

Relative coordinate-recovery error on a log axis for 4 by 4 and 7 by 7 grids: shooting's round trip at 4e-7 and 1e-8; Chambolle-Pock's round trip at N = 5, 10, 20 near 5e-4 on the 4 by 4 grid and falling from 1e-3 to 3e-4 on the 7 by 7; the two cross-checks at 3e-2 on the 4 by 4 and 8e-4 and 6e-3 on the 7 by 7

Solution 1 vs. Solution 2

Entropic transport on a graph metric against graph transport

  • Back to the fork: Sinkhorn on a graph metric (Solution 1) against graph transport by shooting (Solution 2), same three references
  • Upside to entropic transport: very fast (about a second against a minute here); coordinate recovery is comparable, \(10^{-8}\) to \(10^{-10}\) for all three
  • Downsides: distance matrices don’t capture all connectivity information, entropy biases the output
  • Takeaway: only the graph transport barycenter operates directly on the graph structure
Three reference measures on the US states graph and their barycenter computed three ways: graph transport by Hamiltonian shooting, Sinkhorn with a shortest-path cost, Sinkhorn with a diffusion-distance cost

Summing Up

Takeaways on what we did

  • Barycenters need more than a metric: they need a geometry with geodesics, and the Kantorovich geometry on a graph has none (the two-point graph). The Benamou–Brenier picture survives the passage to a graph and gives the discrete transport metric \(\W\) of Maas, a Riemannian structure in which barycenters can be computed
  • Synthesis and analysis can both be handled by working within the Riemannian geometry of \((\P(\X), \W)\): intrinsic gradient descent for synthesis, the tangent-space Gram matrix of Werenski et al. for analysis. Both consume only \(\exp\) and \(\exp^{-1}\)
  • Computing those maps was the obstacle: the space-time convex program of Erbar et al. gives them at \(O(1/N)\) accuracy and \(O(N|E|)\) cost
  • New: Hamiltonian shooting computes \(\exp\) and \(\exp^{-1}\) directly from the geodesic ODE, accurate to fourth order in the integrator step (Runge–Kutta) rather than first order in a time grid, and one to two orders of magnitude faster on interior data

Impact of the Work

  • GraphTransportation.jl is:
    • The first publicly available implementation of Erbar et al.’s method, expanded to allow users to do novel signal processing work by exploring the geometry of a graph-based probability simplex via gradient descent
    • A significant step forward for the HILDA group and its long-running interest in data analysis problems set on graphs
    • About 4,000 lines of Julia library code, 250+ test assertions, and a suite of numerical validation experiments

Looking Ahead

Future directions and ideas to explore

  • Convergence theory for the descent. \(\J\) is convex along linear, probably not along geodesic, interpolation; in \(\R^d\) the same descent is saved by a Polyak–Łojasiewicz inequality. Does one hold on \((\P(\X), \W)\)?
  • Next: linearizing the BCM. Near a base measure \(\nu\), replace \(\exp^{-1}_\nu(\nu_i)\) by one weighted-Laplacian solve, \(L_\theta(\nu)\,\varphi_i = \pi \odot (\nu_i - \nu)\); on graphs, the discrete transport distance is locally a Laplacian quadratic form (Robertson, Wan, Cloninger 2024); this is linear optimal transport (cf. Wilson, Needham, Srivastava 2024)
  • Toward geodesic PCA on graphs: in the Wasserstein space over \(\R\), geodesic PCA becomes convex PCA in a linearized, tangent-space picture (Bigot, Gouet, Klein, López 2017). The linearized BCM supplies that picture for measures on graphs

References

  • My paper: G., Murphy. “Static and Dynamic Approaches to Computing Barycenters of Probability Measures on Graphs.” arXiv preprint arXiv:2603.26940 (2026).
  • My code: https://github.com/dcgentile/GraphTransportation.jl, with a Python implementation at https://github.com/dcgentile/graphtransport-py
  • My site: https://pilesofsand.com
  • Select references:
    • Benamou, Brenier. “A computational fluid mechanics solution to the Monge-Kantorovich mass transfer problem.” Numer. Math. 84.3 (2000): 375–393.
    • Agueh, Carlier. “Barycenters in the Wasserstein space.” SIAM J. Math. Anal. 43.2 (2011): 904–924.
    • Cuturi. “Sinkhorn distances: lightspeed computation of optimal transport.” NeurIPS 26 (2013).
    • Bonneel, Peyré, Cuturi. “Wasserstein barycentric coordinates: histogram regression using optimal transport.” ACM Trans. Graph. 35.4 (2016): 71.
    • Werenski et al. “Measure estimation in the barycentric coding model.” ICML, PMLR, 2022.
    • Otto. “The geometry of dissipative evolution equations: the porous medium equation.” Comm. PDE 26 (2001): 101–174.
    • Absil, Mahony, Sepulchre. Optimization Algorithms on Matrix Manifolds. Princeton, 2008. Huang, Absil, Gallivan. “ROPTLIB: an object-oriented C++ library for optimization on Riemannian manifolds.” ACM TOMS (2016).
    • Klassen, Srivastava, Mio, Joshi. “Analysis of planar shapes using geodesic paths on shape spaces.” IEEE PAMI 26.3 (2004): 372–383.
    • Chowdhury, Needham. “Gromov–Wasserstein averaging in a Riemannian framework.” CVPR Workshops 2020.
    • Díaz Martín, Medri, Murphy. “Gromov–Wasserstein barycenters: the analysis problem.” arXiv:2507.09865 (2025).
    • Wilson, Needham, Srivastava. “Fused Gromov–Wasserstein variance decomposition with linear optimal transport.” arXiv:2411.10204 (2024).
    • Bauer, Mémoli, Needham, Nishino. “Metric geometry of Lebesgue, Wasserstein, and Gromov–Wasserstein spaces: submetries, curvature, and geodesics.” arXiv:2608.11680 (2026).
    • Maas. “Gradient flows of the entropy for finite Markov chains.” J. Funct. Anal. 261.8 (2011): 2250–2292.
    • Mielke. “A gradient structure for reaction–diffusion systems and for energy-drift-diffusion systems.” Nonlinearity 24.4 (2011): 1329–1346.
    • Chow, Huang, Li, Zhou. “Fokker–Planck equations for a free energy functional or Markov process on a graph.” Arch. Ration. Mech. Anal. 203 (2012): 969–1008.
    • Erbar, Maas. “Ricci curvature of finite Markov chains via convexity of the entropy.” Arch. Ration. Mech. Anal. 206 (2012): 997–1038.
    • Chewi, Maunu, Rigollet, Stromme. “Gradient descent algorithms for Bures–Wasserstein barycenters.” COLT 2020.
    • Erbar, Rumpf, Schmitzer, Simon. “Computation of optimal transport on discrete metric measure spaces.” Numer. Math. 144.1 (2020): 157–200.
    • Gangbo, Li, Mou. “Geodesics of minimal length in the set of probability measures on graphs.” ESAIM: COCV 25 (2019): 78. Erbar, Maas, Wirth. “On the geometry of geodesics in discrete optimal transport.” Calc. Var. PDE 58 (2019): 19.
    • Afsari, Tron, Vidal. “On the convergence of gradient descent for finding the Riemannian center of mass.” SIAM J. Control Optim. 51.3 (2013): 2230–2260.
    • Chow, Li, Zhou. “Wasserstein Hamiltonian flows.” J. Differential Equations 268.3 (2020): 1205–1219.
    • Cui, Liu, Zhou. “What is a stochastic Hamiltonian process on finite graph? An optimal transport answer.” J. Differential Equations 305 (2021): 428–457.
    • Cui, Liu, Zhou. “Wasserstein Hamiltonian flow with common noise on graph.” SIAM J. Appl. Math. 83.2 (2023): 484–509.
    • Liu, Wu, Ye, Zhou. “Parametrized Wasserstein Hamiltonian flow.” SIAM J. Numer. Anal. 63.1 (2025).
    • Zhou, Zuo, Liu, Li. “Accelerated Markov chain Monte Carlo algorithms on discrete states.” arXiv:2505.12599 (2025).
    • Cui, Dieci, Zhou. “Time discretizations of Wasserstein–Hamiltonian flows.” Math. Comp. 91 (2022): 1019–1075.
    • Cui, Dieci, Zhou. “A continuation multiple shooting method for Wasserstein geodesic equation.” SIAM J. Sci. Comput. 44.5 (2022): A2918–A2943.
    • Chen, Cui, Dieci, Zhou. “Newton’s method for optimal transport problem on graphs.” arXiv:2605.07408 (2026).
    • Bigot, Gouet, Klein, López. “Geodesic PCA in the Wasserstein space by convex PCA.” Ann. Inst. H. Poincaré Probab. Statist. 53.1 (2017): 1–26.
    • Robertson, Wan, Cloninger. “Resistance distance and linearized optimal transport on graphs.” arXiv:2404.15261 (2024).

Thank you so much for your time and attention!

Please enjoy this picture of my cats.

Two cats curled up together on a sofa
✕ Exit