Skip to main content

degree_distance_correlation

Function degree_distance_correlation 

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

Compute the degree-distance correlation.

Pearson correlation coefficient between vertex degree and eccentricity (maximum shortest-path distance from the vertex). Returns 0.0 for disconnected, trivial, or constant-degree-and-eccentricity graphs.

§Examples

use rust_igraph::{Graph, degree_distance_correlation};

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