Skip to main content

abc_entropy

Function abc_entropy 

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

Compute the ABC entropy.

ENT_ABC(G) = -Σ_e p_e·ln(p_e) where p_e = √((du+dv-2)/(du·dv)) / ABC(G).

Returns 0.0 for edgeless graphs.

§Examples

use rust_igraph::{Graph, abc_entropy};

// K_3: all weights equal → ln(3)
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((abc_entropy(&g).unwrap() - 3.0_f64.ln()).abs() < 1e-10);