# Using cellular automata to see how diseases spread

Writer: Dan Jacobson
Editor: Karolay Lorenty

John Horton Conway, the renowned English mathematician and philosopher, died at the age of 82 on 11th April 2020, following complications with COVID-19. Among a plethora of significant contributions in the fields of group theory, number theory, and game theory, he is perhaps best remembered as a recreational mathematician. Possibly to his chagrin, his most significant contribution comes in the form of “Conway’s Game of Life”, which has captured the hearts and minds of mathematicians and mathematical enthusiasts since its creation in 1970.

“Life” is an incredibly simple game that simulates a “population of cells” interacting with each other. The “world” is a 2D array of cells, each of which is set either to 0 (dead) or 1 (alive). The cells interact with their eight adjacent neighbours, and their state in the next iteration of the simulation (or “generation”) is determined via a set of three rules:

1. A dead cell comes to life only if it is surrounded by exactly three living cells.
2. A living cell stays alive if it is surrounded by either two or three living cells.
3. A living cell dies if it is surrounded by more than three living cells (lack of resources) or fewer than two living cells (loneliness).

These rules were selected by Conway in order to ensure unpredictable patterns, and the results are startling.

Life is part of a larger family of models known as cellular automaton models – mostly deterministic models consisting of cells in an array interacting with their neighbours via a predetermined set of rules. The applications of these models are endless. Indeed, my own introduction to cellular automata came from a third-year project using them to model the spread of forest fires. As an example, here is how cellular automata could be utilised to visualise how a hypothetical disease unfolds in a population.

Of course, it must be clarified that these are not predictions of any kind. This is an incredibly simplified model of disease spread, one where each person is identical in virtually every way, from susceptibility to the disease to approach to social interactions. However, as an education tool, these cellular automaton models can be useful for a general, visual demonstration of how diseases unfold, and how a change in conditions, such as an intervention measure like vaccination or social distancing, can affect how a disease spreads throughout a population. You can find another example of this here.

Let’s start with a susceptible population. Here, this takes the form of a 51×51 array, chosen in order to provide initial symmetry. A single infected individual is placed at the very centre of the population. We then let the simulation proceed, with each iteration of the model representing a day.

Here are my rules:

1. If a susceptible and an infected individual meet (i.e. are neighbouring each other – diagonals do not count), the probability of an infection occurring is 0.2.
2. On average, an individual will stay infected for 10 days. Alternatively, we say that, on any given day, the probability of an infected individual ceasing to be infected is 0.1.
3. If an individual stops being infected, they either die or become immune. The probability of an individual dying after infection is 0.05.

According to a single application of this model, 2,578, of the initial 2,601 individuals, experienced infection at some point, with 125 fatalities.

However, we can extend the model in order to answer additional questions we might have about the disease by adding further rules. For example, say we are interested in what happens if immunity to the disease is not permanent. We add a fourth rule:

4. On average, an individual is immune to the disease for 50 days. Alternatively, we say that, on any given day, the probability of an immune individual becoming susceptible is 0.02.

Of course, when we add this rule to the model, the number of fatalities shoots up, in this case to 473 over the 500 iterations forming this simulation. Interestingly, infections also occur periodically. However, these waves in infections will gradually reduce to zero, as with each wave there are additional deaths.

Finally, let us say we want to see how the disease would spread in a population that is, even partially, vaccinated. We can assume permanent immunity, by replacing the fourth rule with:

4. If an individual is vaccinated, they stay vaccinated. And that is that.

We then run the same model as before, however, instead of our initial population being entirely susceptible, the probability of an individual initially being vaccinated is 0.3.

In this case, we report a grand total of 15 cases and no fatalities.

The code used to generate the visuals in this article was written using Wolfram Mathematica; it can be found below in PDF format and as an executable .nb file here.