Skip to main content

general_zeroth_order_randic

Function general_zeroth_order_randic 

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

Compute the general zeroth-order Randić index.

⁰R_α(G) = Σ_v d(v)^α

For α = 2 this equals the first Zagreb index. For α = 3 this equals the forgotten index (F-index). For α = -1 this equals the inverse degree index. Vertices with degree 0 are skipped when α < 0.

§Examples

use rust_igraph::{Graph, general_zeroth_order_randic};

// K_3: d=(2,2,2), α=2 → 3·4 = 12 (= first Zagreb index)
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((general_zeroth_order_randic(&g, 2.0).unwrap() - 12.0).abs() < 1e-10);