Skip to main content

distance_skewness

Function distance_skewness 

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

Compute the distance skewness.

Skewness (third standardized moment) of the distribution of all pairwise shortest path lengths. Positive skew indicates most pairs are close with a long tail; negative skew indicates most pairs are far apart. Returns 0.0 for disconnected or trivial graphs.

§Examples

use rust_igraph::{Graph, distance_skewness};

// K_4: all distances = 1, zero variance → skewness = 0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!(distance_skewness(&g).unwrap().abs() < 1e-10);