Skip to content

A simulation of the propagation of a virus using the Gillespie algorithm

Notifications You must be signed in to change notification settings

yannlelorier/Stochastic-processes-network-epidemic

Repository files navigation

Stochastic simulation of a network-based epidemic

Demo

1. Authors

Carlos García
Victor Coeto
Yann Le Lorier

2. Context

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.

3. Project Description

3. 1 The Gillespie algorithm

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)

3.1.1 Input/Output

  • 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.

3.1.2 Variables

  • 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 the at_risk_nodes group\
  • The total_recovery_rate is updated as γ*len(infected_nodes)
  • total_rate is updated as the total_transmission_rate + total_recovery_rate
  • time is updated as the exponential variation taking as argument the total_rate

3.1.3 explanation of an iteration

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 the infected_nodes group, and update its neghbors to at_risk_nodes group.
  • update times, S and I

  • update total recovery rate, total infection rate, and total rate

  • time is updated as time + exponential_variate(total rate)

4. Topics

  1. Pointers
    • To store the graph information in interconnected objects
  2. Threads
    • Graph creation
  3. Signals
    • To correctly pause or stop the simulation.
  4. Dynamic Memory
    • To store the graph information in an vector

5. Use Cases

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.

6. Dependencies

  • C++ environment (gpp 2.0+)
  • SFML library
  • cmake (3.1 minimum)

7. Running the program

Read the TemplateInstructions file to modify the Nodes file to your liking.

mkdir build && cd build
cmake ..
make
./program-name -i <inputFilename>

References

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

About

A simulation of the propagation of a virus using the Gillespie algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published