Skip to main content

edge_entropy

Function edge_entropy 

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

Shannon entropy of the edge-degree distribution.

H_edge = -Σ_e p(e) log2(p(e))

where p(e) is the normalized weight of edge e defined as 1 / (deg(u) * deg(v)) divided by the sum of all such weights. Captures how “uniformly” connectivity is distributed across edges.

§Examples

use rust_igraph::{Graph, edge_entropy};

// Star graph: heterogeneous edge weights → lower entropy than regular
let star = Graph::from_edges(&[(0,1),(0,2),(0,3)], false, Some(4)).unwrap();
let h = edge_entropy(&star).unwrap();
assert!(h > 0.0);