pub fn normalized_cut(
graph: &Graph,
membership: &[u32],
weights: Option<&[f64]>,
) -> IgraphResult<f64>Expand description
Compute the normalized cut (NCut) of a partition.
NCut = Σ_k cut(S_k, V\S_k) / vol(S_k)
where vol(S_k) is the sum of (weighted) degrees of vertices in cluster k.
Lower values indicate better balanced cuts.
§Examples
use rust_igraph::{Graph, normalized_cut};
let g = Graph::from_edges(
&[(0,1),(1,2),(2,3),(3,0)], false, Some(4)
).unwrap();
// Balanced partition: {0,1} vs {2,3}
let membership = vec![0u32, 0, 1, 1];
let nc = normalized_cut(&g, &membership, None).unwrap();
assert!(nc > 0.0);