aryagraph.sim.independent_cascade#
- aryagraph.sim.independent_cascade(g: Any, seeds: Any, p: float | str | Callable = 0.1, *, seed: int | Generator | None = None, max_steps: int | None = None) SimulationResult[source]#
Simulate one independent cascade from seeds.
- Parameters:
seeds – A node or an iterable of nodes, active at step 0.
p – Activation probability: a number for every arc, an edge-attribute name (every edge must carry it) or a callable
f(u, v, attrs).max_steps – Stop after this many steps (default: until no new activation).
- Returns:
SimulationResult – One frame per step;
edge_activity[t]holds the arc that activated each node newly active at stept(when several attempts succeed, the first newly-active parent in graph order gets the credit).meta["newly_active"]lists the nodes activated at each step andmeta["spread"]the final number of active nodes.
Notes
Every arc’s coin is flipped up front from seed (the live-edge representation), so for a fixed seed the active set grows monotonically with the seed set.