Skip to main content

infomap

Function infomap 

Source
pub fn infomap(graph: &Graph) -> IgraphResult<InfomapResult>
Expand description

Run Infomap with the default options (unweighted, 1 trial).

§Examples

use rust_igraph::{Graph, infomap};

// Two triangles connected by a bridge — two obvious communities.
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 r = infomap(&g).unwrap();
assert_eq!(r.membership[0], r.membership[1]);
assert_eq!(r.membership[3], r.membership[4]);
assert_ne!(r.membership[0], r.membership[3]);