pub fn walktrap_with_options(
graph: &Graph,
weights: Option<&[f64]>,
opts: WalktrapOptions,
) -> IgraphResult<WalktrapResult>Expand description
Run Walktrap with a custom WalktrapOptions.
weights = None runs the unweighted variant; otherwise see
walktrap_weighted for the weight contract.
§Errors
IgraphError::Unsupportedifgraph.is_directed().IgraphError::InvalidArgumentforopts.steps == 0, weight length mismatch, negative / non-finite weights, or a vertex whose incident-edge total weight underflows to zero.
§Examples
use rust_igraph::{Graph, walktrap_with_options, WalktrapOptions};
let mut g = Graph::with_vertices(3);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 0).unwrap();
let opts = WalktrapOptions { steps: 6 };
let r = walktrap_with_options(&g, None, opts).unwrap();
assert_eq!(r.nb_clusters, 1);