pub fn louvain(graph: &Graph) -> IgraphResult<LouvainResult>Expand description
Run Louvain with the default options (γ = 1, unweighted,
deterministic seed 0).
§Errors
IgraphError::Unsupportedifgraphis directed.
§Examples
use rust_igraph::{Graph, louvain};
// Two triangles joined by a bridge edge form 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 result = louvain(&g).unwrap();
assert_eq!(result.membership[0], result.membership[1]);
assert_eq!(result.membership[3], result.membership[4]);
assert_ne!(result.membership[0], result.membership[3]);
assert!(result.modularity > 0.35);