Expand description
Rust implementation of discrete Ollivier-Ricci curvature on a coupling graph.
Parity target: ollivier_ricci_curvature in
src/sc_neurocore/math/topology.py. For the same coupling matrix
and node pair, the Rust and Python paths return the same value to
within float64 round-off.
References: Ollivier, Y. (2009). “Ricci curvature of Markov chains on metric spaces.” J. Functional Analysis 256(3): 810-864.
Definition: kappa(i, j) = 1 - W1(mu_i, mu_j) / d(i, j) where d is the unweighted shortest-path (hop) distance, mu_i is the lazy random walk distribution from node i (idleness 1/2, the rest split by outgoing coupling weight), and W1 is the Wasserstein-1 (earth-mover) distance under the hop metric, solved exactly by a successive-shortest-path min-cost flow.
The min-cost-flow loop mirrors the Python reference iteration order (Bellman-Ford with ascending node scan) so the chosen augmenting paths — and therefore the floating-point accumulation of the transport cost — are identical across the two implementations.
Enums§
- Curvature
Error - Outcome of an Ollivier-Ricci curvature request.
Constants§
Functions§
- lazy_
random_ 🔒walk - Lazy random walk distribution from
node: probabilityIDLENESSstays, the remainder is split across outgoing edges by coupling weight. A sink (no outgoing weight) keeps all mass atnode. - minimum_
transport_ 🔒cost - Exact Wasserstein-1 cost between two distributions under the hop
metric
distances, via a successive-shortest-path min-cost flow. - ollivier_
ricci_ curvature - Discrete Ollivier-Ricci curvature between nodes
iandj. - shortest_
path_ 🔒distances - Unweighted (hop-count) all-pairs shortest-path distances via BFS.