Skip to main content

augmented_forman_ricci_curvature

Function augmented_forman_ricci_curvature 

Source
pub fn augmented_forman_ricci_curvature(graph: &Graph) -> IgraphResult<Vec<f64>>
Expand description

Augmented Forman-Ricci curvature for each edge.

An extension that also accounts for quadrangles (4-cycles) containing the edge: AF(u,v) = 4 - deg(u) - deg(v) + 3 * triangles(u,v) + 2 * quadrangles(u,v)

This provides a richer local geometric descriptor that captures 4-cycle structure in addition to triangles.

ยงExamples

use rust_igraph::{Graph, augmented_forman_ricci_curvature};

// Square graph 0-1-2-3-0: edge (0,1) has 0 triangles, 1 quadrangle
let g = Graph::from_edges(&[(0,1),(1,2),(2,3),(3,0)], false, Some(4)).unwrap();
let curv = augmented_forman_ricci_curvature(&g).unwrap();
// AF(0,1) = 4 - 2 - 2 + 3*0 + 2*1 = 2
assert!((curv[0] - 2.0).abs() < 1e-10);