Skip to main content

edge_distribution_entropy

Function edge_distribution_entropy 

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

Compute the edge distribution entropy.

For each edge (u,v), consider the pair (d(u), d(v)) as a sample from the joint degree distribution. Compute Shannon entropy of this distribution normalized by log(2m). Measures how diverse edge types are in terms of endpoint degrees. Returns 0.0 for edgeless or trivial graphs.

§Examples

use rust_igraph::{Graph, edge_distribution_entropy};

// K_3: all edges connect degree-2 vertices → 1 class → H=0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(edge_distribution_entropy(&g).unwrap().abs() < 1e-10);