Skip to main content

infomap_weighted

Function infomap_weighted 

Source
pub fn infomap_weighted(
    graph: &Graph,
    weights: &[f64],
) -> IgraphResult<InfomapResult>
Expand description

Run Infomap with per-edge weights (1 trial).

§Errors

§Examples

use rust_igraph::{Graph, infomap_weighted};

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 w = vec![10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 0.01];
let r = infomap_weighted(&g, &w).unwrap();
assert_eq!(r.membership[0], r.membership[1]);
assert_ne!(r.membership[0], r.membership[3]);