Skip to main content

minimum_transport_cost

Function minimum_transport_cost 

Source
fn minimum_transport_cost(
    source: &[f64],
    target: &[f64],
    distances: &[f64],
    n: usize,
) -> Result<f64, CurvatureError>
Expand description

Exact Wasserstein-1 cost between two distributions under the hop metric distances, via a successive-shortest-path min-cost flow.

Returns Ok(f64::INFINITY) when some required transport edge has infinite (unreachable) cost, matching the Python early return.