pub fn shell_diversity(graph: &Graph) -> IgraphResult<f64>Expand description
Shannon entropy of the k-shell size distribution, normalised to [0, 1].
The k-shell of order k is the set of vertices with coreness exactly k.
This function computes the entropy of the distribution of shell sizes
and normalises by log(number_of_distinct_shells) so the result is in
[0, 1]. A value of 1 means all shells have equal size; a value near 0
means vertices are concentrated in one shell.
Returns 0.0 for empty or edgeless graphs (single shell).
§Examples
use rust_igraph::{Graph, shell_diversity};
// Path 0-1-2: coreness = [1, 1, 1], single shell → diversity = 0
let g = Graph::from_edges(&[(0, 1), (1, 2)], false, Some(3)).unwrap();
assert!(shell_diversity(&g).unwrap().abs() < 1e-10);