Skip to main content

degree_cv

Function degree_cv 

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

Compute the degree coefficient of variation.

CV(G) = σ/d̄ where σ = √(B(G)) is the degree standard deviation and d̄ = 2m/n is the average degree.

Returns 0.0 for regular graphs, edgeless graphs, or empty graphs. The CV is undefined when d̄ = 0 (edgeless); we return 0.0 in that case.

§Examples

use rust_igraph::{Graph, degree_cv};

// K_3: regular, CV = 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(degree_cv(&g).unwrap().abs() < 1e-10);