Modelling Disease Interactions with Networks

Published 03 Jun 2021

By Julian Garratt



As Covid-19 continues to remain in the zeitgeist (hello to everyone reading this in a post-covid world), the rising number of charts depicting infections and deaths over time continues to flood the media.

Yet, I find that charts and single statistics don’t bring to justice the magnitude and scale of disease transmission. More specifically, how can we better visualise the spread and scale of diseases?

So, to solve this problem what if we could directly see the connections that each citizen has in a community along with whether they were infected with the disease? This calls for graphs! And no, I don’t mean those square boxes with an x and a y-axis

Not this type of graph (Source: edrawmax)


I’m referring to networks, more specifically a network with citizens for vertices and connections as edges, something like what you see below…

I mean this type of graph (Source: mathinsight)


The Network


You may be wondering what you’re looking at above. If you guessed a network that models disease interactions where the red dots are citizens that have died and where green citizens are lucky enough to have not been infected, then you were correct!

Before reading on, I highly recommend playing around with the interactive graph. You can move the vertices around by clicking and dragging on them to get a better feel of the number of connections an individual citizen has. Also, if you hover over a vertex/dot, then you’ll see the number of connections a citizen has. Finally, it’s important to note that the bigger a vertex, the more times a citizen has been infected.

The Model

Now that you’ve seen the final product, what’s actually going on here? At a high level, you can think of the graph as a population or society with 100 citizens. At the beginning (i.e day 0 out of 100) only 1 citizen is infected. Then, over the course of each day, every citizen makes new friends at some specified probability which, if that citizen is infected, gives them the chance (or misfortune) of passing that disease onto someone else (again at some pre-specified probability). Unfortunately, those that have been infected for more than 1 day must roll the dice and either perish or are magically cured (at some pre-specified probability). This cycle continues for the next 99 days.

In the end, if you input the correct probabilities, then you end up with the graph above, or in other words, a state of equilibrium. In this case, to better represent what equilibrium means, here’s the chart that is produced at the end of 100 days.

State of equilibrium after 100 days


Yet, you may still be unsatisfied as I haven’t directly shown what’s going on each day. So, hopefully, the video below demonstrates the journey to equilibrium. Note that in the interactive graph we only saw green and red vertices, this time yellow vertices will also be featured which signify citizens that are infected.



Drawbacks & Benefits

Unfortunately, like any model or representation of real-world systems, assumptions are made and simplifications are added. For instance, the model assumes that people continue to socialise even after there is clearly some sort of disease outbreak. Likewise, there is no complex governmental structure that enforces lockdowns, masks or vaccines, hence, the disease only stops once the disease dies out, as seen above.

On the other hand, the model does represent the exponential speed of disease outbreaks as well as the chaotic nature of the system. For instance, changing the probability of a citizen connecting with another citizen results in a very different result. Furthermore, even running the model with the same parameters results in different results.

For this reason, no two graphs are rarely ever the same due to the entanglement with probability making a specific example extremely hard to replicate.

Conclusion

Developing models of real-world systems are extremely difficult problems which explains the simplicity of the model demonstrated in this blog post. Contrarily, networks/graphs are extremely convenient in representing interactions between individuals which further helps to reveal the magnitude and speed of disease transmission.

Nevertheless, it’s fascinating to dive into how diseases are transmitted over time which has personally allowed me to better understand disease outbreaks (although marginally).

Code

I highly recommend playing with the code and changing the probability of infection and death. Please post in the GitHub repo discussion section any issues you’re having with the code or if you want to raise any questions, comments or suggestions.

Link to the GitHub Repo to download the code: https://github.com/MillenniumForce/DataSoc-Projects


Tags: data science graph theory modelling python