Skip to main content

Module epidemics

Module epidemics 

Source
Expand description

Epidemics models on graphs.

Currently provides the SIR (susceptible–infected–recovered) stochastic model, a direct translation of igraph_sir (references/igraph/src/misc/sir.c).

The simulation is a continuous-time Gillespie process. Every individual is in one of three states:

  • S — susceptible (can catch the disease),
  • I — infected (spreads the disease and may recover),
  • R — recovered (immune, inert).

A susceptible vertex with k infected neighbours becomes infected at rate k · beta; an infected vertex recovers at rate gamma. Each run starts from a single, uniformly random infected vertex and stops when no infected individuals remain. Event times and the S/I/R population sizes are recorded after every state transition.

Determinism: randomness comes from the project’s SplitMix64 PRNG seeded by the caller, so a given seed reproduces the same trajectory bit-for-bit. (This means trajectories will not coincide with upstream igraph, which uses a different RNG — only the statistical behaviour matches.)

Structs§

Sir
Result of a single SIR simulation run.

Functions§

sir
Runs no_sim independent SIR epidemic simulations on graph.