Skip to main content

irlu_irregularity

Function irlu_irregularity 

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

Compute the IRLU irregularity (irregularity by log-ratio).

IRLU(G) = Σ_{(u,v)∈E} |ln(d(u)/d(v))|

Numerically equivalent to IRL(G) for all positive degrees (by logarithm properties), but provided for nomenclature completeness in the literature. Edges with a degree-0 endpoint are skipped. Self-loops are skipped.

§Examples

use rust_igraph::{Graph, irlu_irregularity};

// Star S_5: center d=4, leaves d=1
// 4 edges each |ln(4/1)| = ln(4) → 4·ln(4)
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((irlu_irregularity(&g).unwrap() - 4.0 * 4.0_f64.ln()).abs() < 1e-10);