pub fn ratio_cut(
graph: &Graph,
membership: &[u32],
weights: Option<&[f64]>,
) -> IgraphResult<f64>Expand description
Compute the ratio cut of a partition.
RatioCut = Σ_k cut(S_k, V\S_k) / |S_k|
where |S_k| is the number of vertices in cluster k.
Lower values indicate better balanced cuts.
§Examples
use rust_igraph::{Graph, ratio_cut};
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 rc = ratio_cut(&g, &membership, None).unwrap();
assert!(rc > 0.0);