Skip to main content

barabasi_game_psumtree_multiple

Function barabasi_game_psumtree_multiple 

Source
pub fn barabasi_game_psumtree_multiple(
    nodes: u32,
    power: f64,
    m: u32,
    outseq: Option<&[u32]>,
    outpref: bool,
    a: f64,
    directed: bool,
    seed: u64,
) -> IgraphResult<Graph>
Expand description

PSUMTREE_MULTIPLE variant — within-step multi-edges allowed.

See module docs for the full contract.

§Errors

Same as barabasi_game_psumtree.

§Examples

use rust_igraph::barabasi_game_psumtree_multiple;

// 50-vertex directed BA graph with classical (power=1, A=1) kernel
// and m = 3. The early-cite saturation branch fires for steps where
// `m >= i` (steps 1..=3 here, emitting 1+2+3 = 6 instead of
// 3+3+3 = 9), so the total edge count is
// `(n-1)*m - m*(m-1)/2 = 49*3 - 3 = 144`. The multiple variant
// MAY produce within-step duplicates.
let g = barabasi_game_psumtree_multiple(50, 1.0, 3, None, false, 1.0, true, 0x42).unwrap();
assert_eq!(g.vcount(), 50);
assert_eq!(g.ecount(), 49 * 3 - 3 * 2 / 2);