Skip to main content

degree_theil

Function degree_theil 

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

Compute the Theil index (GE(1)) of the degree sequence.

T = (1/n) Σ_{v: d(v)>0} (d(v)/d̄) · ln(d(v)/d̄)

A generalized entropy inequality measure. Zero for regular graphs, higher values indicate more inequality. Vertices with d=0 contribute 0 (by L’Hôpital: x·ln(x) → 0 as x → 0+). Returns 0.0 for the empty or edgeless graph.

§Examples

use rust_igraph::{Graph, degree_theil};

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