Skip to main content

conductance

Function conductance 

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

Compute the conductance of a partition.

For a 2-way partition: cut(S, V\S) / min(vol(S), vol(V\S)). For k-way: the maximum conductance (worst cluster), defined as max_k cut(S_k, V\S_k) / vol(S_k) over clusters with vol > 0.

Lower conductance means better separation.

ยงExamples

use rust_igraph::{Graph, conductance};

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