Skip to main content

clustering_path_ratio

Function clustering_path_ratio 

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

Compute the clustering-path ratio.

C * n / L — a normalized product of clustering and inverse path length. Higher values indicate stronger small-world properties. Returns 0.0 for disconnected or trivial graphs.

§Examples

use rust_igraph::{Graph, clustering_path_ratio};

// K_4: C=1, L=1, n=4 → 4.0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!((clustering_path_ratio(&g).unwrap() - 4.0).abs() < 1e-10);