Skip to main content

degree_sum_index

Function degree_sum_index 

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

Compute the degree-sum index.

DS(G) = Σ_{(u,v)∈E} √(d(u) + d(v))

Self-loops are skipped.

§Examples

use rust_igraph::{Graph, degree_sum_index};

// K_3: each edge √(2+2) = 2, 3 edges → DS = 6
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!((degree_sum_index(&g).unwrap() - 6.0).abs() < 1e-10);