Skip to main content

py_ollivier_ricci_curvature

Function py_ollivier_ricci_curvature 

Source
pub(crate) fn py_ollivier_ricci_curvature(
    knm_flat: Vec<f64>,
    n: usize,
    i: usize,
    j: usize,
) -> PyResult<f64>
Expand description

Discrete Ollivier-Ricci curvature between two nodes of a coupling graph.

Parity contract with sc_neurocore.math.topology.ollivier_ricci_curvature: for the same knm and (i, j), the Rust value agrees with the Python value to within float64 round-off.

knm_flat is the row-major n x n coupling matrix. Raises ValueError on a malformed shape, a non-finite or negative entry, or an out-of-range index, mirroring the Python validation.