Forest Fires, Epidemics and Models
What can forest fires tell us about epidemic modelling?
Using code, we can simulate forest fires. This is often an introductory lesson in programming languages.
This simple model of a forest fire can inform us about the epidemic spread of diseases.
Setting up the lattice
In R, there is the igraphs package. This package can make lattice graphs.
The basic lattice sets up a grid where each vertex connects to its four adjacent neighbours. Mathematicians call that central vertex and those four neighbours the von Neumann neighbourhood.
test_lattice <- make_lattice(length = 5, dim = 2, nei = 1)
test_lattice %>% plot(layout = layout_on_grid)
For forest fires, diagonal connections to each vertex are important too.
There is no setting in the make_lattice function for these extra connections. We need to create the extra edges, and add them.
extra_edges_df <- tibble(x = as.numeric(1:20,
w = case_when(x %% forest_length == 1 ~ NA_real_,
TRUE ~ x + forest_length - 1),
z = case_when(x %% forest_length == 0 ~ NA_real_,
TRUE ~ x + forest_length + 1)) %>%
pivot_longer(cols = 2:3,
names_to = "column",
values_to = "y",
values_drop_na = TRUE) %>%
The add_edges function takes matrices in a counter-intuitive way.
extra_edges_v <- cbind(extra_edges_df$x, extra_edges_df$y)
%>% t() %>% c()
We can then add these edges on.
test_lattice_added <- test_lattice %>% add_edges(edges = extra_edges_v)
test_lattice_added %>% plot(layout = layout_on_grid)
Mathematicians call a vertex and its eight neighbours the Moore neighbourhood.
We can then set up fixed or probabilistic rules for the three different states:
- Alive: the tree is green, and could be set on fire by neighbouring trees.
- On fire: the tree is on…