pub fn rich_club_sequence(
graph: &Graph,
weights: Option<&[f64]>,
vertex_order: &[VertexId],
normalized: bool,
loops: bool,
directed: bool,
) -> IgraphResult<Vec<f64>>Expand description
Per-vertex rich-club coefficient sequence for graph.
Returns a Vec<f64> of length graph.vcount() whose i-th entry is
the density (normalized = true) or raw edge count
(normalized = false) of the subgraph that survives after removing
the first i vertices of vertex_order from graph.
Counterpart of igraph_rich_club_sequence — see the module-level
docs for the full mapping of arguments and semantics.
§Arguments
graph— input graph.weights— optional per-edge weights of lengthecount(). WhenNone, every edge contributes1.0.vertex_order— permutation of0..vcount()giving the order in which vertices are peeled off.normalized— whentrue, divide the surviving edge count at each step by the total possible edges on the remaining vertices; whenfalse, return the raw remaining edge count (or summed weight).loops— whether self-loops are assumed possible (affects the normalization denominator only; ignored when!normalized).directed— whether to use the directed denominator when normalizing. Silently coerced tofalsewhengraphis undirected.
§Errors
IgraphError::InvalidArgument— when:vertex_order.len() != graph.vcount() as usize,weights.is_some()andweights.unwrap().len() != graph.ecount(),- any entry of
vertex_orderis>= graph.vcount()(i.e. it is not a valid permutation of0..vcount).
§Examples
use rust_igraph::{Graph, rich_club_sequence};
// Triangle K_3: after 0 removals → 3 edges, after 1 → 1, after 2 → 0.
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
let seq = rich_club_sequence(&g, None, &[0, 1, 2], false, false, false).unwrap();
assert_eq!(seq, vec![3.0, 1.0, 0.0]);