Imagine a virus outbreak starting in the Hague (Netherlands) where you might live. It might be a seasonal flu, it might be the Zika virus, it mights be any other virus. How do you predict whether this virus outbreak will start an epidemy covering your whole country or it will be localised? The answer is to run an epidemic simulation of the virus outbreak and play with different scenarios.

Where it all started

It started at the gym when talking to Rory de Vries who is a Taekwondo teacher and has a PhD in virology. Rory is working at the Erasmus MC doing research on vaccins for the influenza virus. With Rory’s feedback we thought of a simulation model that should be more realistic than existing models.


The first thing we did is to download the data from OpenStreetMap. Basically it is a list of nodes, ways and relations. We have downloaded the map of the Netherlands (which is about 1 GB, for the whole world is about 30 GB). Then the list of nodes was decimated to get about 15 million nodes (about the same number as the population in the Netherlands). The assumption is that the node density of the map is the same as the population density, meaning that areas with high population will also have high node density.

Epidemic model

We start with the discretization of the map. For this we define mobility as the average distance that a person travels per day. This is one of the parameters that you can easily modify in the user interface. As an example and default value we took 10 km. The mobility defines the size of the discretization cell: the larger mobility the larger the cell size. The cell size is calculated as a product of the mobility and the time step, which is set by the user.

The next step is to define a contact rate, we denote is C, which means how many contacts on average has a person during infectious time. It is assumed to be constant over the population.

Another parameter is the probability (P) that this person will infect its contacts. For example, in case of the influenza 1 person infects on average 3 other persons. Here we assume a uniform probability function for the population.

Now that we have defined the global parameters for the epidemic simulation, let us have a look at the infection stages per person. We distinguish the following stages:

  • period before infection
  • infectious period
  • sickness
  • recovery and immunity

Actually we combined some of the infection stages compared to the medical definition (here), for simplicity of the simulation and notations.

Basically, the disease development can be described with the following function  y = e^{-(a \cdot \ time - b)^2} , where a, \ b can be modified for a specific virus and time is expressed in days.

Disease development

 Epidemic Simulation

At the beginning of the epidemic simulation we see a map of the population distribution in the Netherlands (people are represented by white dots).  On the right hand site you see a panel with the simulation time, transparency slider, plot options and global parameters that we described above. The plot options are infection stage (blue colour means infectious period and red colour means recovered people that are immune to the disease) or sickness (front of the spreading of the disease). The disease outbreak starts in the Hague. By clicking on the map we have added another disease source in Groningen.


The Netherlands is a very densely populated country. Therefore, it is almost impossible to avoid an epidemic. We also have seen it in the movie above. The idea of this post is that we can model almost anything, whether it will reflect the truth, the history will tell us.

Let’s connect

If you liked this article, let’s connect on LinkedIn, Facebook or by subscribing to the bi-weekly EZNumeric’s newsletter.