Skip to main content

degree_range

Function degree_range 

Source
pub fn degree_range(graph: &Graph) -> IgraphResult<usize>
Expand description

Compute the range of the degree sequence.

R(G) = d_max - d_min

Returns 0 for empty or single-vertex graphs. For regular graphs, the range is 0.

§Examples

use rust_igraph::{Graph, degree_range};

// Star S_5: d_max=4, d_min=1 → range=3
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert_eq!(degree_range(&g).unwrap(), 3);