Skip to main content

Module topology

Module topology 

Source
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§

CurvatureError
Outcome of an Ollivier-Ricci curvature request.

Constants§

IDLENESS 🔒
TOLERANCE 🔒

Functions§

lazy_random_walk 🔒
Lazy random walk distribution from node: probability IDLENESS stays, the remainder is split across outgoing edges by coupling weight. A sink (no outgoing weight) keeps all mass at node.
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 i and j.
shortest_path_distances 🔒
Unweighted (hop-count) all-pairs shortest-path distances via BFS.