pub fn label_propagation_with_options(
graph: &Graph,
weights: Option<&[f64]>,
opts: &LpaOptions,
) -> IgraphResult<LpaResult>Expand description
Run label propagation with the full option bag.
§Errors
IgraphError::Unsupportedifgraphis directed.IgraphError::InvalidArgumentfor malformed weights/initial/fixed inputs as documented onLpaOptions.
§Examples
use rust_igraph::{Graph, LpaOptions, LpaVariant, label_propagation_with_options};
// Same partition every time for a fixed seed.
let mut g = Graph::with_vertices(6);
for &(u, v) in &[(0, 1), (0, 2), (1, 2), (3, 4), (3, 5), (4, 5), (2, 3)] {
g.add_edge(u, v).unwrap();
}
let opts = LpaOptions {
variant: LpaVariant::Dominance,
seed: 42,
..LpaOptions::default()
};
let a = label_propagation_with_options(&g, None, &opts).unwrap();
let b = label_propagation_with_options(&g, None, &opts).unwrap();
assert_eq!(a.membership, b.membership);