Skip to main content

degree_neighbor_min_sum

Function degree_neighbor_min_sum 

Source
pub fn degree_neighbor_min_sum(graph: &Graph) -> IgraphResult<u64>
Expand description

Compute the sum of minimum neighbor degrees.

Σ_{v: d(v)>0} min_{u ∈ N(v)} d(u)

For each non-isolated vertex, finds the lowest degree among its neighbors and sums these minima. Returns 0 for edgeless graphs.

§Examples

use rust_igraph::{Graph, degree_neighbor_min_sum};

// Star S_5: center min=1, 4 leaves min=4 → 1 + 4·4 = 17
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert_eq!(degree_neighbor_min_sum(&g).unwrap(), 17);