pub fn forest_fire_game(
n: u32,
fw_prob: f64,
bw_factor: f64,
ambs: u32,
directed: bool,
seed: u64,
) -> IgraphResult<Graph>Expand description
Generate a forest-fire-model random graph on n vertices.
n— vertex count.n = 0returns an empty graph;n = 1returns a single isolated vertex.fw_prob— forward burning probabilityp ∈ [0, 1). The number of outgoing neighbours a burn picks from each ambassador followsGeom(1 − p).bw_factor— backward burning ratior ≥ 0. The number of incoming neighbours followsGeom(1 − r·p); the productr · pmust also stay in[0, 1).ambs— number of ambassadors each new node connects to.ambs = 0shortcuts to an edgelessn-vertex graph.directed— whether to return a directed graph. The internal burn tracks in/out-neighbour lists regardless of this flag; only the finalGraphhonours it.seed— seeds the internalSplitMix64PRNG.
§Errors
Returns IgraphError::Internal if fw_prob falls outside
[0, 1), if bw_factor · fw_prob is outside [0, 1), or if
either parameter is non-finite.
§Examples
use rust_igraph::forest_fire_game;
// Light burn: small fw_prob keeps edges close to the ambassador count.
let g = forest_fire_game(100, 0.05, 0.3, 2, true, 0xF00D).unwrap();
assert_eq!(g.vcount(), 100);
assert!(g.is_directed());
// Each non-root vertex cites >= 1 ambassador, so at least n - 1 edges.
assert!(g.ecount() >= 99);