Carlos García
Victor Coeto
Yann Le Lorier
As of June 2020, the COVID-19 pandemic is rapidly spreading through the world. With this in view, it may be relevant to study how a disease spreads through a population, using the classic Gillespie algorithm found here.
The Gillespie algorithm is a methodology that aims to track Markovian processes where objects change status. In this case, we wish to use this algorithm in a given starting graph, see the end graph, and the changes over time. It is based on the SIS model (Susceptible, Infected, Susceptible)
- Input Network graph G, a transmission rate τ, a recovery rate γ, a set of index node(s) of
initial_infections
, maximum time tmax
Output The Network graph G after it goes through the Gillespie function.
- The infected nodes are updated. In the very first iteration, the infected nodes are the
initial_infections
\ - The
at_risk_nodes
are updated as the nodes which are direct neighbors of infected nodes\ - The infection rate in the at_risk_nodes is updated as τ*
len(infected_neighbors)
\ - The
total_infection_rate
is updated as the sum of all the infection rates in theat_risk_nodes
group\ - The
total_recovery_rate
is updated as γ*len(infected_nodes)
total_rate
is updated as thetotal_transmission_rate + total_recovery_rate
time
is updated as the exponential variation taking as argument thetotal_rate
The main loop iterating, until time
< tmax and the total_rate
< 0
-
r is updated as a uniform random distribution taking 0 and
total_rate
, then- if r <
total_recovery_rate
then remove one node from the infected nodes, and reduce infection rate - if not, then add one node in the
at_risk_nodes
to put it in theinfected_nodes
group, and update its neghbors toat_risk_nodes
group.
- if r <
-
update
times
, S and I -
update total recovery rate, total infection rate, and total rate
-
time
is updated astime + exponential_variate(total rate)
- Pointers
- To store the graph information in interconnected objects
- Threads
- Graph creation
- Signals
- To correctly pause or stop the simulation.
- Dynamic Memory
- To store the graph information in an vector
The programs serves the pupose of being a close representation of a virus outburst in a static network environment. It is quite useful because it allows for different snapshots to be analyzed at different points in time.
- C++ environment (gpp 2.0+)
- SFML library
- cmake (3.1 minimum)
Read the TemplateInstructions file to modify the Nodes file to your liking.
mkdir build && cd build
cmake ..
make
./program-name -i <inputFilename>
Stochastic simulations of Epidemics, I.Z. Kiss et al., Mathematics of Epidemics on Networks, Interdisciplinary Applied Mathematics 46, DOI 10.1007/978-3-319-50806-1