pub fn degree_entropy_ratio(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the degree entropy ratio.
Shannon entropy of the degree distribution divided by log(n). Measures how uniform the degree distribution is. Returns 1.0 for regular graphs, values < 1 for heterogeneous degree distributions. Returns 0.0 for trivial graphs.
§Examples
use rust_igraph::{Graph, degree_entropy_ratio};
// K_3: all degrees equal → H = log(1) = 0... wait, p=1 for one class
// Actually all vertices have same degree → 1 class → H=0, but ratio = 0/log(3)?
// Better: P(d=2) = 1 → H = -1*log(1) = 0 → ratio = 0
// For non-trivial: cycle has uniform degrees too
// Let's use star: center deg=4, leaves deg=1
let star = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
let r = degree_entropy_ratio(&star).unwrap();
assert!(r > 0.0 && r < 1.0);