Simulation#

Every simulator returns a SimulationResult (ag.sim).

Results#

SimulationResult

Frames of a simulation on a graph.

Result types#

EnsembleResult

Counts of each state across runs, on a common time grid.

Schedule results#

ScheduleResult

A simulated schedule: frames at every event time plus the task log.

MonteCarloResult

Distribution of the makespan over many simulated schedules.

TaskRun

One attempt of a task: which worker ran it, when, and how it ended ("done"/"failed").

Compartmental models#

CompartmentalModel

A network compartmental model.

SI

Susceptible → Infected at beta per infected neighbour; no recovery.

SIS

SI plus recovery back to susceptible at gamma (no immunity; endemic above threshold).

SIR

Susceptible → Infected (beta per infected neighbour) → Recovered (gamma).

SEIR

SIR with a latent Exposed state left at rate sigma (mean incubation 1/sigma).

SIRS

SIR whose immunity wanes at rate xi (R → S).

SEIRD

SEIR where infected nodes recover at gamma or die at mu (case fatality mu/(gamma+mu)).

One-call shortcuts#

aryagraph.sim.compartmental.si(g: Any, beta: float, **kwargs: Any) → SimulationResult[source]#

Simulate SI() on g; keyword arguments go to CompartmentalModel.simulate().

aryagraph.sim.compartmental.sis(g: Any, beta: float, gamma: float, **kwargs: Any) → SimulationResult[source]#

Simulate SIS() on g (see CompartmentalModel.simulate()).

aryagraph.sim.compartmental.sir(g: Any, beta: float, gamma: float, **kwargs: Any) → SimulationResult[source]#

Simulate SIR() on g (see CompartmentalModel.simulate()).

aryagraph.sim.compartmental.seir(g: Any, beta: float, sigma: float, gamma: float, **kwargs: Any) → SimulationResult[source]#

Simulate SEIR() on g (see CompartmentalModel.simulate()).

aryagraph.sim.compartmental.sirs(g: Any, beta: float, gamma: float, xi: float, **kwargs: Any) → SimulationResult[source]#

Simulate SIRS() on g (see CompartmentalModel.simulate()).

aryagraph.sim.compartmental.seird(g: Any, beta: float, sigma: float, gamma: float, mu: float, **kwargs: Any) → SimulationResult[source]#

Simulate SEIRD() on g (see CompartmentalModel.simulate()).

Cascades and influence#

independent_cascade

Simulate one independent cascade from seeds.

linear_threshold

Simulate the linear threshold model from seeds.

influence_spread

Expected final number of active nodes from seeds, by Monte Carlo.

greedy_influence_maximization

Pick k seeds greedily by marginal gain in expected spread (CELF).

Walks, opinions and diffusion#

random_walk

Simulate independent random walkers.

stationary_distribution

Exact stationary distribution π = πP of the random walk on g.

transition_matrix

Row-stochastic transition matrix of the walk (graph order; dangling rows uniform).

voter_model

Classic voter model with random-sequential updates.

majority_rule

Synchronous majority rule.

degroot

DeGroot averaging x(t+1) = W x(t).

bounded_confidence

Deffuant–Weisbuch bounded-confidence model on opinions in [0, 1].

heat_diffusion

Exact heat flow dx/dt = -rate · L x on the graph.

kuramoto

Kuramoto phase oscillators coupled along the graph.

Scheduling and ensembles#

simulate_schedule

Simulate running the tasks of dag on a pool of workers.

monte_carlo_schedule

Makespan distribution and task criticality by Monte Carlo.

run_ensemble

Run fn(**kwargs, seed=...) runs times and summarise the state counts.