JingxinZhang

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Epidemic Modeling with Modified Small-World

Networks
Jingxin Zhang
May 13, 2020

Abstract
In order to simulate the heterogeneity of individual social patterns, randomness
may be added to the small-world model based on β-graphs by assigning each node
a normally-distributed degree. It turns out that, with our modified model, both the
growth rate and the final size of an epidemic are reduced.

1 Introduction
Due to the urgent and non-experimentable nature of epidemics, mathematical epidemiology
has always been an indispensable tool for us to study the spread and management of diseases.
For example, in response to the ongoing COVID-19 pandemic, many institutes have shared
their forecasts based on statistical or mathematical models with the Centers for Disease
Control and Prevention to help inform public health decisions [1].
The basic compartmental models to describe the transmission of communicable diseases
are first defined in a sequence of three papers by W.O. Kermack and A.G. McKendrick in
1927, 1932, and 1933 [2]. These models assume that each individual has an equal likelihood of
coming into contact with any other individual. However, in reality the patterns of contacts
between individuals are highly heterogeneous, and this heterogeneity can be a significant
factor in the early spread of a disease. When this is the case, the compartmental model can
be insufficient.
In the case of the 2002 SARS outbreak, for instance, the basic reproduction number R0 of
the disease, or the average number of secondary infections caused by an infected individual,
was estimated to be between 2.2 and 3.6. With these values, compartmental models predicted
that there should have been approximately between 30,000 and 10 million cases in the first
120 days of transmission in China. However, these predictions turned out to be inaccurate,
and only 782 case were reported during the initial three months [6].
In [6], L.A. Meyers and her team attribute this inaccuracy to the assumption of ho-
mogeneity of contacts between individuals in compartmental models. They point out that
there is an enormous epidemiological difference between a situation where all individuals
share similar contact patterns and a situation where most infected individuals pass the dis-
ease to only a few others but a small number pass it to dozens or even hundreds, even though
the mean value of R0 can be the same in both cases.
For this project, we will look into small-world network models for modeling epidemics,
apply them to diseases with different characteristics, and finally use them to examine how
individual social patterns may influence prediction results by adding a degree of randomness
when generating individual contact numbers.

2 Background
2.1 Compartmental Models
Compartmental models are perhaps the most widely-used tool in mathematical epidemiology.
A compartmental model analyzes an epidemic by dividing the host population into several
compartments, each containing individuals that are identical in terms of their status with
respect to the disease in question [2]. The most basic compartmental model is the SIR
model, where S stands for the susceptible, I the infectious, and R the removed. Their
relationship can be described by the following system of differential equations,
dS
= −βSI,
dt
dI
= βSI − αI,
dt
where the transmission rate is β and the recovery rate is α. The basic SIR model is used
when the disease in question confers immunity against re-infection. Many adjustments can
be made to adapt the basic SIR model to a specific disease. For example, we can add an E
class between the S class and the I class, forming a SEIR model which describes a disease
with an exposed period between becoming infected and becoming infectious.

Figure 1: SIR model and its basic variations [3]

Notice that S 0 < 0 at any time and I 0 > 0 if and only if S > α/β. If S(0) < α/β, I
decreases to zero and there is no epidemic. On the other hand, if S(0) > α/β, I first increases
to a maximum value and then decreases to zero, indicating the occurrence of an epidemic.
Therefore, the quantity βS(0)/α, called the basic reproduction number and denoted by R0 ,
is a crucial threshold quantity used to predict whether an epidemic will occur.

2
The compartmental models simplify the complicated reality by making assumptions that
allow us to examine an epidemic macroscopically. However, they don’t perform the best in all
the cases. The fact that compartmental models focus on compartments instead of individuals
indicates their assumption of random mixing of the population, meaning each individual has
an equal likelihood of coming into contact with any other individual. This is obviously not
the case in reality, and the error caused by this assumption could be non-negligible, especially
at the beginning stage of an epidemic where there are only a few infectives. Thus, network
models are introduced to solve this problem.

2.2 Networks
In network models, we refer to individuals of a population as nodes and their connections with
others as edges through which disease can spread. Also, the set of contacts of an individual
is called its neighborhood, and the size of this neighborhood is called its degree. There exist
many different network models, but we are going to only focus on random networks, lattices,
and small-world networks.

Figure 2: Visualization of random network, small-world network, and lattice


[4]

2.2.1 Random Networks


In random networks, each individual has a fixed neighborhood of a fixed size but the con-
nections are generated randomly. Due to this randomness, there are no obvious clusters in
which individuals are mostly connected but isolated from the rest of the network. Also, indi-
viduals are no different from each other in terms of connections, which is the homogeneity of
individual-level network properties. And yet, however random they are, these networks are
still less random than the random-mixing models because the neighborhood of an individual
in a random network is fixed once the edges have been assigned. As a result, both the early
growth rate of the disease and the final epidemic size are reduced.

3
2.2.2 Lattices
Contrary to the random networks, the lattices are highly ordered based on different as-
sumptions. In lattices, connections exist only between adjacent individuals, emphasizing the
spatial position of individuals in a population. Thus, contacts are spatially localized, and it
requires a long chain of contacts for a disease to spread between two distant individuals. As
a result, more clustering is present and the spread of the disease is further slowed down.

2.2.3 Small-World Networks


In reality, both clustering of connections (featured in lattices) and long-range transmission
events (featured in random networks) are likely to be significant factors in an epidemic. It is
thus natural for us to look for a model in between complete order and complete randomness.
This is where small-world networks came into play.
Small-world networks can be formed by adding a small number of random connections
to a lattice in such a way that we may tune the degree of randomness of our model. In this
project, we focused on a type of small-world network known as the β-graph. To construct
a β-graph, we begin with a ring lattice where each node has precisely k neighbours, k/2
on either side. Then, we randomly rewire the edges with probability β. Here, β represents
the degree of randomness of our model and thus is different from the transmission rate β
defined above. When β = 0, the resulting graph remains precisely an ordered lattice, and
when β = 1, the resulting graph becomes approximately a random network. By adjusting
the value of β, we can control the randomness of our model [7].
In order to determine whether an epidemic will occur, percolation theory is applied to
calculate the threshold parameter values. Assuming each individual is connected with its
two nearest neighbors and on average with another φ random individuals, then the critical
bond percolation probability is [5]
p
1 + 12φ + 4φ2 − 1 − 2φ
pc = = 1 − 4φ + O(φ2 ).

If the transmission rate of the disease exceeds pc , then an epidemic will occur.

3 Methodology
For this project, we wrote a program which can create β-graphs with any given parameters
with the help of Python NetworkX package. This program then served as a base for later ap-
plications. Helper methods were fully utilized when programming to make this base program
easy to modify. The code is attached below along with a selection of β-graphs generated by
the program (see Figure 3).
1 import random
2 import networkx a s nx
3
4 # c r e a t e a beta−graph o f n k−d e g r e e nodes with p r o b a b i l i t y b e t a by f i r s t
c r e a t i n g a r i n g l a t t i c e o f n k−d e g r e e nodes and then r e w i r i n g a l l e d g e s
with p r o b a b i l i t y b e t a

4
Figure 3: A selection of beta-graphs with different probability produced by
our base program

5 def beta graph (n , k , beta ) :


6 beta graph = r ew ir e ( r i n g l a t t i c e (n , k ) , beta )
7 return beta graph
8
9 # c r e a t e a r i n g l a t t i c e o f n k−d e g r e e nodes
10 def r i n g l a t t i c e (n , k) :
11 r i n g l a t t i c e = nx . Graph ( )
12 r i n g l a t t i c e . add nodes from ( [ i f o r i in range (n) ] )
13 f o r i in range (n) :
14 f o r j in range ( i n t ( k /2) ) :
15 r i n g l a t t i c e . add edge ( i , ( i+j +1)%n )
16 return r i n g l a t t i c e
17
18 # r e w i r e a l l e d g e s o f t h e i n p u t graph with p r o b a b i l i t y b e t a
19 d e f r e w i r e ( graph , b e t a ) :
20 n = graph . n u m b e r o f n o d e s ( )
21 f o r edge i n l i s t ( graph . e d g e s ( ) ) :
22 i f random . random ( ) < b e t a :
23 i f edge [ 0 ] > edge [ 1 ] :
24 i f edge [ 0 ] − edge [ 1 ] < n / 2 :
25 node = edge [ 0 ]
26 else :
27 node = edge [ 1 ]
28 else :

5
29 i f edge [ 1 ] − edge [ 0 ] < n / 2 :
30 node = edge [ 1 ]
31 else :
32 node = edge [ 0 ]
33 c h o i c e s = l i s t ( nx . n o n n e i g h b o r s ( graph , node ) )
34 graph . remove edge ( edge [ 0 ] , edge [ 1 ] )
35 graph . add edge ( node , c h o i c e s [ random . r a n d i n t ( 0 , l e n ( c h o i c e s ) −1)
])
36 r e t u r n graph
37

4 Applications
4.1 Applying to Epidemic Simulation
The β-graphs simulate a more realistic social pattern of the population. Therefore, we
can use them to replace the random-mixing pattern in traditional compartmental models so
that a disease can then only be transmitted through connecting edges with the corresponding
transmission rate. Furthermore, they may be used to model infectious diseases with a variety
of different characteristics.
For example, if we are dealing with an SIR disease that involves three states, Susceptible,
Infectious, and Removed, we tag 0 to susceptible nodes, 1 to infectious nodes, and 2 to
removed nodes. Similarly, for an SEIR disease that involves four states, Susceptible, Exposed,
Infectious and Removed, we only need to add a number, tagging 0 to susceptible nodes, 1
to exposed nodes, 2 to infectious nodes, and 3 to removed nodes. By tagging, we can easily
track the status of each node as well as modify our model for various diseases.
Below are two sample Python functions that can run epidemic simulations on a given
population for SIR diseases and SIER diseases respectively. Here, we track the total number
of individuals who are or have been infected to demonstrate the spread of the disease.
1 # apply beta−g r a p h s t o an SIR d i s e a s e with t r a n s m i s s i o n r a t e p and
i n f e c t i o n p e r i o d T, s t a r t i n g with k i n f e c t e d i n d i v i d u a l s
2 d e f s i m u l a t e S I R ( graph , k , p , T) :
3 n = graph . n u m b e r o f n o d e s ( )
4

5 status = [0]∗ n
6 days = [ 0 ] ∗ n
7 infected = [ ]
8 data = [ 0 ]
9
10 i n f e c t e d = random . sample ( l i s t ( graph . nodes ( ) ) , k )
11 for v in infected :
12 status [ v ] = 1
13 days [ v ] = T
14 data [ −1] = data [ −1] + 1/n
15
16 while len ( infected ) > 0:
17 data . append ( data [ − 1 ] )
18 new infected = [ ]

6
Figure 4: A sample plot representing the spread of an SIR disease and an
SIER disease produced by our algorithm. The β-graphs have 10000 6-degree
nodes and a rewiring probability of 0.01. The SIR disease has a transmission
rate of 0.1 and an infection period of 14 days, starting with 3 infected individ-
uals. The SIER disease has an exposed period transmission rate of 0.05, an
infection period transmission rate of 0.1, an exposed period of 7 days, and an
infection period of 7 days, starting with 3 infected individuals.

19 f o r node i n i n f e c t e d :
20 f o r v i n l i s t ( nx . a l l n e i g h b o r s ( graph , node ) ) :
21 i f s t a t u s [ v ] == 0 and random . random ( ) < p :
22 n e w i n f e c t e d . append ( v )
23 status [ v ] = 1
24 days [ v ] = T
25 data [ −1] = data [ −1] + 1/n
26 days [ node ] = days [ node ] − 1
27 i f days [ node ] < 1 :
28 i n f e c t e d . remove ( node )
29 s t a t u s [ node ] = 2
30 infected = infected + new infected
31
32 r e t u r n data
33
34 # apply beta−g r a p h s t o an SIER d i s e a s e with exposed p e r i o d t r a n s m i s s i o n
r a t e p1 , i n f e c t i o n p e r i o d t r a n s m i s s i o n r a t e p2 , exposed p e r i o d T1 and
i n f e c t i o n p e r i o d T2 , s t a r t i n g with k i n f e c t e d i n d i v i d u a l s
35 d e f run model SEIR ( graph , k , p1 , p2 , T1 , T2) :
36 n = graph . n u m b e r o f n o d e s ( )
37
38 status = [0]∗ n
39 days = [ 0 ] ∗ n
40 exposed = [ ]
41 infected = [ ]

7
42 data = [ 0 ]
43

44 exposed = random . sample ( l i s t ( graph . nodes ( ) ) , k )


45 f o r v i n exposed :
46 status [ v ] = 1
47 days [ v ] = T1
48 data [ −1] = data [ −1] + 1/n
49

50 w h i l e l e n ( exposed ) > 0 o r l e n ( i n f e c t e d ) > 0 :


51 data . append ( data [ − 1 ] )
52 new exposed = [ ]
53 new infected = [ ]
54 f o r node i n exposed :
55 f o r v i n l i s t ( nx . a l l n e i g h b o r s ( graph , node ) ) :
56 i f s t a t u s [ v ] == 0 and random . random ( ) < p1 :
57 new exposed . append ( v )
58 status [ v ] = 1
59 days [ v ] = T1
60 data [ −1] = data [ −1] + 1/n
61 days [ node ] = days [ node ] − 1
62 i f days [ node ] < 1 :
63 exposed . remove ( node )
64 n e w i n f e c t e d . append ( node )
65 s t a t u s [ node ] = 2
66 days [ node ] = T2
67 f o r node i n i n f e c t e d :
68 f o r v i n l i s t ( nx . a l l n e i g h b o r s ( graph , node ) ) :
69 i f s t a t u s [ v ] == 0 and random . random ( ) < p2 :
70 new exposed . append ( v )
71 status [ v ] = 1
72 days [ v ] = T1
73 data [ −1] = data [ −1] + 1/n
74 days [ node ] = days [ node ] − 1
75 i f days [ node ] < 1 :
76 i n f e c t e d . remove ( node )
77 s t a t u s [ node ] = 3
78 exposed = exposed + new exposed
79 infected = infected + new infected
80
81 r e t u r n data
82

4.2 Introducing a New Noise


An important feature to note in β-graphs is that every node is assigned the same degree
value. In other words, it is assumed that everyone in the population is in contact with the
same number of people. However, in reality, we all have social circles of different sizes. There
are people who are sociable and enjoy hanging out with others, and there are people who
are shy and prefer staying alone. In a large population, this would suggest a spread in the
numbers of individual contacts that the standard β-graph does not include.
The small-world models, compared to the compartmental models, have already intro-

8
duced a degree of randomness in space which turns out to have a great influence on the
results. It is then natural to think about further introducing a noise for individual social
patterns in order to investigate whether or not it will have a great influence on our model
as well.
In order to look into this problem, we modified the β-graphs in our base program, assign-
ing each node a normally-distributed degree instead of a fixed one. Then, we ran experiments
with populations of different sizes using the algorithm for SIR diseases and compared the
results with the original β-graphs.

Figure 5: Experiment results. Here, we ran 100 experiments respectively


for three populations of different sizes. For each day, we took the average of
cumulative infections, and plotted the results. The original β-graphs have a
fixed degree of 6 for every node and a rewiring probability of 0.01. The modified
β-graphs have a normally-distributed degree for every node with µ = 6 and
σ = 3 and a rewiring probability of 0.01. The SIR disease has a transmission
rate of 0.1 and an infection period of 7 days, starting with 3 infected individuals.

From the results above in Figure 5, we observe that, after introducing the new noise
to individual social patterns, the epidemic proceeds more slowly and ends with fewer total
infections, even though the average degree of the nodes is the same as the original fixed
degree. Also, the difference is more significant with larger populations. In the case of 10000

9
people, the difference reaches as high as about 15% of the whole population. This experiment
reveals that the heterogeneity in individual social patterns has a considerable impact in the
course of an epidemic, and it may suggest that including this heterogeneity in our future
models can help us make predictions closer to reality.

5 Conclusions
Traditional compartmental models largely simplify problems in real world, allowing them
to become widely-used tools for modeling epidemics. However, they assume an unrealistic
random-mixing of the population, often leading to overly pessimistic predictions. The small-
world models, on the other hand, simulate social patterns more realistically by emphasizing
the effects of both the spacial positions of individuals and the possibility of long-range
transmission events, thus potentially improving the accuracy of their predictions. In this
project, we added random noise to the degree of individual nodes in small-world models
and found compelling evidence that the heterogeneity in individual social patterns further
reduces the growth rate and the final size of an epidemic in prediction results. We may
manage to perform better predictions with our modified small-world model, and our next
question will be how to obtain a good enough estimation of the rewiring probability β and
the mean degree k of a given population.

References
[1] Covid-19 forecasts, May 2020.

[2] L. J. Allen, F. Brauer, P. Van den Driessche, and J. Wu, Mathematical epi-
demiology, vol. 1945, Springer, 2008.

[3] F. C. Coelho, Epidemic models. https://pythonhosted.org/epigrass/intromodels.html.


Last updated on May 06, 2014.

[4] M. Javaheripi, B. D. Rouhani, and F. Koushanfar, Swnet: Small-world neural


networks and rapid convergence, arXiv preprint arXiv:1904.04862, (2019).

[5] M. J. Keeling and K. T. Eames, Networks and epidemic models, Journal of the
Royal Society Interface, 2 (2005), pp. 295–307.

[6] L. A. Meyers, B. Pourbohloul, M. E. Newman, D. M. Skowronski, and R. C.


Brunham, Network theory and sars: predicting outbreak diversity, Journal of theoretical
biology, 232 (2005), pp. 71–81.

[7] D. J. Watts, Small worlds: the dynamics of networks between order and randomness,
vol. 9, Princeton university press, 2004.

10

You might also like