pub fn transitivity_gap(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the transitivity gap.
global_transitivity - avg_local_transitivity — the difference
between the global clustering coefficient (fraction of closed
triplets) and the mean local clustering coefficient. Can be
positive or negative. Returns 0.0 for graphs with no triplets.
§Examples
use rust_igraph::{Graph, transitivity_gap};
// K_4: global=1.0, all local=1.0 → gap=0.0
let g = Graph::from_edges(
&[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!(transitivity_gap(&g).unwrap().abs() < 1e-10);