Skip to main content

multiplicative_randic

Function multiplicative_randic 

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

Compute the multiplicative Randić index.

Πχ(G) = Π_{(u,v)∈E} 1/√(du·dv)

Edges with a degree-0 endpoint are skipped. Self-loops are skipped. Returns 1.0 for edgeless graphs (empty product).

§Examples

use rust_igraph::{Graph, multiplicative_randic};

// K_3: 3 edges, d=(2,2), each 1/2 → (1/2)³ = 1/8
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((multiplicative_randic(&g).unwrap() - 0.125).abs() < 1e-10);