Skip to main content

edge_degree_discrepancy

Function edge_degree_discrepancy 

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

Compute the normalized degree discrepancy across edges.

D = Σ_{(u,v)∈E} (d(u) - d(v))² / (4m)

Measures how differently-connected each edge’s endpoints are, normalized by edge count. Zero for regular graphs. Self-loops are skipped. Returns 0.0 for the empty graph.

§Examples

use rust_igraph::{Graph, edge_degree_discrepancy};

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