Skip to main content

infomap_with_options

Function infomap_with_options 

Source
pub fn infomap_with_options(
    graph: &Graph,
    edge_weights: Option<&[f64]>,
    vertex_weights: Option<&[f64]>,
    nb_trials: u32,
    seed: u64,
) -> IgraphResult<InfomapResult>
Expand description

Run Infomap with full control over parameters.

  • edge_weights: per-edge weights; None for unit weights. Must be non-negative and finite.
  • vertex_weights: teleportation target weights; None for uniform. Must be non-negative and finite; at least one must be positive.
  • nb_trials: number of independent optimisation attempts (≥ 1).
  • seed: PRNG seed for the node-order shuffle.

§Errors

§Examples

use rust_igraph::{Graph, infomap_with_options};

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 a = infomap_with_options(&g, None, None, 3, 42).unwrap();
let b = infomap_with_options(&g, None, None, 3, 42).unwrap();
assert_eq!(a.membership, b.membership);