Skip to main content

multiplicative_abc

Function multiplicative_abc 

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

Compute the multiplicative atom-bond connectivity index.

Πabc(G) = Π_{(u,v)∈E} √((du+dv-2)/(du·dv))

Edges where du+dv-2 ≤ 0 or du·dv == 0 are skipped. Self-loops are skipped. Returns 1.0 for edgeless graphs.

§Examples

use rust_igraph::{Graph, multiplicative_abc};

// K_3: 3 edges, d=(2,2), each √(2/4) = 1/√2 → (1/√2)³
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let expected = (1.0 / 2.0_f64.sqrt()).powi(3);
assert!((multiplicative_abc(&g).unwrap() - expected).abs() < 1e-10);