Skip to main content

degree_max_deviation

Function degree_max_deviation 

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

Compute the maximum degree deviation from the mean.

Δ_max = max_v |d(v) - d̄|

The largest absolute deviation of any vertex’s degree from the mean degree. Returns 0.0 for empty or edgeless graphs.

§Examples

use rust_igraph::{Graph, degree_max_deviation};

// Star S_5: center d=4, leaves d=1, d̄=1.6 → max|4-1.6|=2.4
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((degree_max_deviation(&g).unwrap() - 2.4).abs() < 1e-10);