Skip to main content

barabasi_game_psumtree

Function barabasi_game_psumtree 

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

PSUMTREE (simple) variant — no within-step multi-edges.

See module docs for the full contract.

§Errors

  • power or a is not finite (NaN / ±∞).
  • outpref = false and a <= 0 (would leave zero-degree vertices un-sampleable).
  • outpref = true and a < 0.
  • outseq.len() != nodes.

§Examples

use rust_igraph::barabasi_game_psumtree;

// 50-vertex directed BA graph with classical (power=1, A=1) kernel
// and m = 2 outgoing edges per new vertex. Total edge count is
// (n - 1) · m = 49 · 2 = 98. The simple variant emits NO
// within-step duplicates, so the graph is simple.
let g = barabasi_game_psumtree(50, 1.0, 2, None, false, 1.0, true, 0x42).unwrap();
assert_eq!(g.vcount(), 50);
assert_eq!(g.ecount(), 98);