Skip to main content

clustering_degree_correlation

Function clustering_degree_correlation 

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

Compute the clustering-degree correlation.

Pearson correlation between vertex degree and local clustering coefficient. Returns 0.0 for graphs where the correlation is undefined (constant degree or constant clustering, or fewer than 2 vertices with degree >= 2).

§Examples

use rust_igraph::{Graph, clustering_degree_correlation};

// K_4: all same degree and clustering → 0.0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!(clustering_degree_correlation(&g).unwrap().abs() < 1e-10);