Skip to main content

centrality_rank_correlation

Function centrality_rank_correlation 

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

Compute the Spearman rank correlation between degree centrality and betweenness centrality.

Returns a value in [-1, 1]. Values near 1 indicate that vertices with high degree also have high betweenness (consistent importance). Values near 0 indicate no monotonic relationship. Returns 0.0 for trivial graphs or graphs where one centrality is constant.

ยงExamples

use rust_igraph::{Graph, centrality_rank_correlation};

// Path graph: degree and betweenness are inversely related at endpoints
let g = Graph::from_edges(
    &[(0,1),(1,2),(2,3),(3,4)], false, Some(5)
).unwrap();
let rho = centrality_rank_correlation(&g).unwrap();
// For a path, internal vertices have both higher degree and betweenness
assert!(rho > 0.5);