pub fn ollivier_ricci_curvature(
graph: &Graph,
alpha: f64,
) -> IgraphResult<Vec<f64>>Expand description
Ollivier-Ricci curvature for each edge (lazy random walk variant).
For an edge (u, v), defines probability measures on the neighborhoods:
mu_u(w) = alpha if w == u, else (1-alpha) / deg(u) for each neighbor.
The Ollivier-Ricci curvature is kappa(u,v) = 1 - W1(mu_u, mu_v) / d(u,v).
Since d(u,v) = 1 for adjacent vertices in unweighted graphs:
kappa(u,v) = 1 - W1(mu_u, mu_v).
Uses an approximate Wasserstein computation via the ATD (Average Transportation Distance) heuristic for efficiency.
§Parameters
graph— Undirected, connected graph.alpha— Laziness parameter in [0, 1).alpha = 0gives the standard Ollivier-Ricci;alpha = 0.5is the “Lin-Lu-Yau” variant.
§Examples
use rust_igraph::{Graph, ollivier_ricci_curvature};
// Triangle: high curvature (positive)
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let curv = ollivier_ricci_curvature(&g, 0.0).unwrap();
assert!(curv[0] > 0.0);