Skip to main content

simulate_sir

Function simulate_sir 

Source
pub fn simulate_sir(
    adjacency: &AdjList,
    num_nodes: usize,
    initial_infected: &[usize],
    beta: f64,
    gamma: f64,
) -> Result<SimulationResult>
Expand description

Simulate one run of the SIR epidemic model.

§Arguments

  • adjacency — (undirected) adjacency list; each undirected edge should appear in both directions.
  • num_nodes — total number of nodes.
  • initial_infected — nodes initially in the Infected state.
  • beta — infection probability per edge per time step.
  • gamma — recovery probability per time step.