Skip to main content

degree_span_ratio

Function degree_span_ratio 

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

Compute the degree span ratio.

DSR(G) = (d_max - d_min) / d̄

Normalizes the degree range by the mean degree. Returns 0.0 for edgeless or empty graphs.

§Examples

use rust_igraph::{Graph, degree_span_ratio};

// K_3: all degrees equal → span ratio = 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(degree_span_ratio(&g).unwrap().abs() < 1e-10);