Skip to main content

structural_information_content

Function structural_information_content 

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

Compute the structural information content.

log2(k) / log2(n) where k is the number of distinct degree values in the graph. Measures the structural diversity of the vertex roles by degree. Returns 1.0 when every vertex has a unique degree (e.g. path graphs for n≥3). Returns 0.0 for regular graphs or trivial graphs.

§Examples

use rust_igraph::{Graph, structural_information_content};

// K_4: all degrees 3 → k=1 → log2(1)/log2(4) = 0
let g = Graph::from_edges(
    &[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
assert!(structural_information_content(&g).unwrap().abs() < 1e-10);