Skip to main content

clustering_bimodality

Function clustering_bimodality 

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

Sarle’s bimodality coefficient of the clustering coefficient distribution.

Defined as (skewness² + 1) / kurtosis where kurtosis is the excess kurtosis + 3 (i.e. the raw kurtosis). Values > 5/9 ≈ 0.556 suggest a bimodal or uniform distribution; values near 1/3 suggest unimodal.

Returns 0.0 if fewer than 4 vertices have defined clustering coefficients.

§Examples

use rust_igraph::{Graph, clustering_bimodality};

// K4: all CC = 1.0, zero variance → bimodality not meaningful, returns 0
let g = Graph::from_edges(
    &[(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)],
    false,
    Some(4),
)
.unwrap();
assert!(clustering_bimodality(&g).unwrap().abs() < 1e-10);