pub fn walktrap_weighted(
graph: &Graph,
weights: &[f64],
) -> IgraphResult<WalktrapResult>Expand description
Run Walktrap on a weighted, undirected graph with default steps = 4.
weights[i] is the weight of edge id i. Must be finite and
non-negative; length must equal graph.ecount().
§Errors
IgraphError::Unsupportedifgraph.is_directed().IgraphError::InvalidArgumentifweights.len() != ecountor any weight is negative or non-finite.
§Examples
use rust_igraph::{Graph, walktrap_weighted};
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 r = walktrap_weighted(&g, &[1.0, 2.0, 1.0]).unwrap();
assert_eq!(r.nb_clusters, 1);