Skip to main content

degree_harmonic_mean_index

Function degree_harmonic_mean_index 

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

Compute the degree harmonic mean index.

DHM(G) = Σ_{(u,v)∈E} 2·d(u)·d(v)/(d(u)+d(v))

This is the sum of the harmonic means of endpoint degrees. For regular graphs with degree r: DHM(G) = m·r. Edges with a degree-0 endpoint are skipped. Self-loops are skipped.

§Examples

use rust_igraph::{Graph, degree_harmonic_mean_index};

// K_3: 3 edges, all (2,2) → 3·2 = 6
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((degree_harmonic_mean_index(&g).unwrap() - 6.0).abs() < 1e-10);