Skip to main content

randic_entropy

Function randic_entropy 

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

Compute the Randić entropy.

ENT_R(G) = -Σ_e p_e·ln(p_e) where p_e = (1/√(du·dv))/R(G).

Returns 0.0 for edgeless graphs.

§Examples

use rust_igraph::{Graph, randic_entropy};

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