Skip to main content

expansion

Function expansion 

Source
pub fn expansion(
    graph: &Graph,
    membership: &[u32],
    weights: Option<&[f64]>,
) -> IgraphResult<f64>
Expand description

Compute the expansion (isoperimetric number) of a partition.

For a 2-way partition: cut(S, V\S) / min(|S|, |V\S|). For k-way: the maximum expansion over all clusters.

ยงExamples

use rust_igraph::{Graph, expansion};

let g = Graph::from_edges(
    &[(0,1),(1,2),(2,3),(3,0)], false, Some(4)
).unwrap();
let membership = vec![0u32, 0, 1, 1];
let e = expansion(&g, &membership, None).unwrap();
assert!(e > 0.0);