Skip to main content

degree_tail_ratio

Function degree_tail_ratio 

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

Compute the tail ratio (fraction of vertices with degree ≥ 2·d̄).

Returns the fraction of vertices whose degree is at least twice the mean degree. A heavy-tail indicator: sparse graphs with hubs have higher tail ratios. Returns 0.0 for empty or edgeless graphs.

§Examples

use rust_igraph::{Graph, degree_tail_ratio};

// Star S_5: mean = 8/5 = 1.6, threshold = 3.2, only vertex 0 (d=4) qualifies → 1/5 = 0.2
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((degree_tail_ratio(&g).unwrap() - 0.2).abs() < 1e-10);