Skip to main content

fourth_abc_index

Function fourth_abc_index 

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

Compute the fourth atom-bond connectivity index.

ABC₄(G) = Σ_{(u,v)∈E} √((ε(u)+ε(v)-2) / (ε(u)·ε(v)))

where ε(v) is the eccentricity of vertex v. Self-loops and edges where ε(u)·ε(v) = 0 are skipped.

§Examples

use rust_igraph::{Graph, fourth_abc_index};

// Path 0-1-2: eccentricities [2,1,2]
// (0,1): √((2+1-2)/(2·1)) = √(1/2) = 1/√2
// (1,2): √((1+2-2)/(1·2)) = √(1/2) = 1/√2
// ABC₄ = 2/√2 = √2
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert!((fourth_abc_index(&g).unwrap() - std::f64::consts::SQRT_2).abs() < 1e-10);