Skip to main content

fast_greedy_modularity_weighted

Function fast_greedy_modularity_weighted 

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

Run fast greedy modularity community detection on graph with edge weights.

weights[i] is the weight of edge id i; length must equal graph.ecount(). Weights must be finite and non-negative.

§Errors

§Examples

use rust_igraph::{Graph, fast_greedy_modularity_weighted};

let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
let r = fast_greedy_modularity_weighted(&g, &[1.0, 2.0, 1.0]).unwrap();
assert!(r.nb_clusters >= 1);