Epidemics on Networks

Modeling the spread of epidemics on networks provides a realistic representation of how diseases propagate in populations, as networks help us capture and account for real-world contact patterns. This enables us to analyze epidemic dynamics at both the individual and group levels, allowing researchers and public health officials to better understand, predict, and generate more effective disease management and prevention strategies.

There are two primary ways to model the spread of infectious diseases on networks: differential equations and agent-based simulations. Each approach has its advantages and is suited for different types of research questions and scenarios. In this presentation, we will explore both of them to help us model epidemics on networked communities and individuals.

Epidemic Models

When it comes to studying epidemics, various models have been developed. These models  are mathematically formalized as systems of partial differential equations and they offer different perspectives on disease dynamics, allowing us to study various aspects of epidemics such as recovery, reinfection, and persistent states of infection. In this section, we will explore the SI, SIR, and SIS model.

SI

The SI (Susceptible-Infectious) model is one of the simplest epidemic models used to study the spread of infectious diseases within a population. In this model, individuals in the population can be classified into two groups:

Susceptible (s): These are individuals who can become infected if they come into contact with an infectious individual.

Infectious (x): These are individuals who are already infected and can transmit the disease to susceptible individuals. This transmission is governed by the transmission or contagious rate β, which represents the probability of disease transmission during contact

Consequently, the equations for this model are:

(ds/dt) = −βsx, 
(dx/dt) = βsx.

Here, once an individual becomes infected, they remain infectious indefinitely. Since we consider that the number of individuals is constant, over time, the fraction of the population in the infectious state (x) increases, while the fraction in the susceptible state (s) decreases. This fraction of infected individuals follows an S-shaped curve known as the “logistic growth curve,” which increases exponentially at the beginning. This initial phase represents when most of the population is susceptible, and then it saturates as it becomes harder for the disease to find new victims.

b=.9;solution=NDSolve[{s'[t]==-b s[t] x[t],x'[t]==b s[t]x[t],s[0]==0.9,x[0]==0.02},{s,x},{t,100}];solutionS=First[s/.solution];
solutionI=First[x/.solution];
Plot[{solutionI[t],solutionS[t]},{t,0,10},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Green},PlotLegends->{"s","x"}]

Certainly, this model simplifies many biological details, but it captures some of the fundamental features of disease dynamics. Specifically, this model can be helpful in understanding and modeling the spread of diseases like cytomegalovirus (CMV) or herpes, which are characterized by lifelong infectiousness.

SIR

The SIR (Susceptible-Infectious-Recovered) model is another important epidemiological model used to study the spread of infectious diseases within a population. It builds upon the SI model by introducing a new disease state: “Recovered” (R). In the SIR model, individuals can exist in one of three states:

Susceptible (S): These are individuals who can become infected if they come into contact with an infectious individual.

Infectious (x): These are individuals who are already infected and can transmit the disease to susceptible individuals. This transmission is governed by the transmission or contagious rate β, which represents the probability of disease transmission during contact

Recovered (R):  These are individuals who have been infected in the past but have recovered and are now immune to reinfection, so they cannot transmit the disease to others. This recovery is governed by the recovery rate γ.

Consequently, the equations for this model are:

(ds/dt) = −βsx, 
(dx/dt) = βsx - γx,
(dr/dt) = γx

Based on the relationship between the transmission rate and recovery rate, an important parameter in epidemiology arises: the basic reproduction number, denoted as R0 and defined as R0=β/γ. This parameter holds a critical role in understanding the dynamics of disease spread within a population. Specifically:

When R0 is greater than 1, it indicates that, each infected individual is infecting more than one other person. This situation leads to an epidemic outbreak where as time progresses, the infected population increases, it  continues to rise until it reaches a peak value. After reaching the peak, the infected population starts to decline, as infected individuals recover from the disease. Simultaneously, the susceptible population may also decrease as more individuals become infected.

b=.3;γ=1/40;solution=NDSolve[{s'[t]==-b s[t] x[t],x'[t]==b s[t]x[t]-γ x[t],r'[t]==γ x[t],s[0]==0.9,x[0]==0.1,r[0]==0.0000},{s,r,x},{t,100}];solutionS=First[s/.solution];
solutionI=First[x/.solution];
solutionR=First[r/.solution];Plot[{solutionS[t],solutionI[t],solutionR[t]},{t,0,100},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Green},PlotLegends->{"s","x","r"}]

When R0 is less than 1, each infected individual is, on average, infecting fewer than one other person. In this scenario, the disease does not result in a major outbreak and may even die out over time, not infecting all the population.

b=.1;γ=.11;solution=NDSolve[{s'[t]==-b s[t] x[t],x'[t]==b s[t]x[t]-γ x[t],r'[t]==γ x[t],s[0]==0.7,x[0]==0.3,r[0]==0.00},{s,r,x},{t,100}];solutionS=First[s/.solution];
solutionI=First[x/.solution];
solutionR=First[r/.solution];Plot[{solutionS[t],solutionI[t],solutionR[t]},{t,0,100},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Green},PlotLegends->{"s","x","r"}]

When R0 equals 1, the disease is neither spreading rapidly nor dying out. It can persist at a constant level in the population but does not cause a major outbreak.

This model also simplifies many biological details, but it captures some of the fundamental features of disease dynamics. Specifically, this model can be helpful in understanding and modeling the spread of diseases like Measles, Hepatitis A and Chickenpox (Varicella), which are characterized by lifelong immunity after the recover from the infection.

SIS

The SIS (Susceptible-Infectious-Susceptible) model is another crucial epidemiological model used to study the transmission of infectious diseases. Unlike the SIR model, the SIS model does not assume that individuals who recover from the infection gain immunity. Instead, individuals who recover from the infection return to the susceptible state and can potentially become infected again. Similar to the SI model, the SIS model comprises two primary states:

Susceptible (S): These are individuals who can become infected if they come into contact with an infectious individual.

Infectious (x): These are individuals who are already infected and can transmit the disease to susceptible individuals. This transmission is governed by the transmission or contagious rate β, which represents the probability of disease transmission during contact. These individuals recover and become susceptible again at the recovery rate γ.

Consequently, the equations for this model are:

(ds/dt) = −βsx + γx, 
(dx/dt) = βsx - γx,

In this case R0 its also important as:

When R0 is greater than 1, the epidemic reaches a steady state. In this state, the rate of new infections is balanced by the rate of recoveries, leading to a constant fraction of the population being infected. This is known as the endemic state, where the disease can persist in the population indefinitely. The disease continues to circulate, and individuals move in and out of the infected state over time in such a way that the fraction of the population that remains infected stabilizes at a non-zero value.

b=.2;γ=.1;solution=NDSolve[{s'[t]==-b s[t] x[t]+γ x[t],x'[t]==b s[t]x[t]-γ x[t],s[0]==0.9,x[0]==0.02},{s,x},{t,100}];solutionS=First[s/.solution];
solutionI=First[x/.solution];
Plot[{solutionS[t],solutionI[t]},{t,0,100},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Green},PlotLegends->{"s","x"}]

When R0 is less than 1, the disease cannot persist in the population in the long term. It eventually dies out, and the fraction of infected individuals approaches zero.

b=.1;γ=.12;solution=NDSolve[{s'[t]==-b s[t] x[t]+γ x[t],x'[t]==b s[t]x[t]-γ x[t],s[0]==0.7,x[0]==0.3},{s,x},{t,100}];solutionS=First[s/.solution];
solutionI=First[x/.solution];
Plot[{solutionS[t],solutionI[t]},{t,0,100},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Green},PlotLegends->{"s","x"}]

When R0 equals 1, the disease can persist at a constant level in the population, but it doesn’t cause a major epidemic. The fraction of infected individuals remains constant, and the disease is considered endemic but not causing widespread outbreaks.

The SIS model describes cyclical patterns of infection, where individuals move back and forth between the susceptible and infectious states. It helps researchers understand how diseases persist in populations when there is no permanent immunity and individuals can be infected multiple times. This model is often used to simulate diseases like the common cold, gonorrhea, and syphilis, as people who contract these diseases do not typically develop lasting immunity after treatment or recovery.

Contact networks

Diseases can spread through various modes of transmission. For example, diseases like influenza or tuberculosis are transmitted when individuals share enclosed spaces and breathe the same air. Others, like contagious diseases and parasites, can spread through direct physical contact, while HIV and various sexually transmitted diseases are primarily communicated through sexual contact. These different patterns of contact can be effectively represented using various types of networks, such as physical contact networks, sexual contact networks, and shared-room networks, all encompassed within the broader concept of social networks.

Understanding  how  epidemics spread on these social networks is crucial as they enable the development of various intervention strategies and appropriate plans to mitigate disease outbreaks. Furthermore, epidemic models can be applied to other types of networks, like the spatial networks and technological networks, to study a wide range of phenomena beyond diseases, such as government stability, crime rates, poverty, inequality, and even the spread of computer viruses.

Networks

Networks are used to represent relationships and interactions among various entities. They consist of a collection of objects, known as vertices, connected by edges. These networks can be used to analyze a wide range of relationships, including connections between objects, information diffusion, and resource allocation.

Key components of a network include:

Vertices: These are the individual entities within the network, such as people in a social network, computers in a computer network, or cities in a transportation network.

Edges: These represent the connections or relationships between vertices. For example, in a social network, edges may represent friendships between individuals, while in a computer network, edges represent physical or logical connections between devices. We say that vertices A and B are adjacent if they are joined by an edge (A<->B).

Graph: The combination of nodes and edges forms a graph, which is the mathematical structure used to represent a network.

Graph[{A\[UndirectedEdge]B,A\[UndirectedEdge]D , B\[UndirectedEdge]C,D\[UndirectedEdge]C}]

g=Graph[{A\[UndirectedEdge]B,A\[UndirectedEdge]D , B\[UndirectedEdge]C,D\[UndirectedEdge]C}, VertexLabels->Placed[Automatic,Center],VertexSize->.1,PlotTheme->"Monochrome"]

Contact Networks

Contact networks are networks in which the vertices represent individuals, and the edges symbolize connections or contact between them, which can include friendships, professional relationships, or competition in a game.  We will run the simulations for the spread of epidemics on network on different contact networks.

Partial Differential Equations

Now lets see what happens when we consider the spread of epidemics on networks. To provide some interpretation, we can visualize the vertices as different groups of populations, and the edges as the interactions or contacts between these population groups. For example, consider the Florence Families’ Social Network, where the vertices represent families, and the edges represent marriages between members of the two linked families.

FFN=ResourceData["Florentine Families Network"]

It can also apply to scenarios like the contiguous states network, where the vertices represent different states and the edges represent the states adjacency between them.

G2={"Alabama"\[UndirectedEdge]"Florida","Alabama"\[UndirectedEdge]"Georgia","Alabama"\[UndirectedEdge]"Mississippi","Alabama"\[UndirectedEdge]"Tennessee","Arkansas"\[UndirectedEdge]"Louisiana","Arkansas"\[UndirectedEdge]"Missouri","Arkansas"\[UndirectedEdge]"Mississippi","Arkansas"\[UndirectedEdge]"Oklahoma","Arkansas"\[UndirectedEdge]"Tennessee","Arkansas"\[UndirectedEdge]"Texas","Arizona"\[UndirectedEdge]"California","Arizona"\[UndirectedEdge]"Colorado","Arizona"\[UndirectedEdge]"NewMexico","Arizona"\[UndirectedEdge]"Nevada","Arizona"\[UndirectedEdge]"Utah","California"\[UndirectedEdge]"Nevada","California"\[UndirectedEdge]"Oregon","Colorado"\[UndirectedEdge]"Kansas","Colorado"\[UndirectedEdge]"Nebraska","Colorado"\[UndirectedEdge]"NewMexico","Colorado"\[UndirectedEdge]"Oklahoma","Colorado"\[UndirectedEdge]"Utah","Colorado"\[UndirectedEdge]"Wyoming","Connecticut"\[UndirectedEdge]"Massachusetts","Connecticut"\[UndirectedEdge]"NewYork","Connecticut"\[UndirectedEdge]"RhodeIsland","Delaware"\[UndirectedEdge]"Maryland","Delaware"\[UndirectedEdge]"NewJersey","Delaware"\[UndirectedEdge]"Pennsylvania","Florida"\[UndirectedEdge]"Georgia","Georgia"\[UndirectedEdge]"NorthCarolina","Georgia"\[UndirectedEdge]"SouthCarolina","Georgia"\[UndirectedEdge]"Tennessee","Iowa"\[UndirectedEdge]"Illinois","Iowa"\[UndirectedEdge]"Minnesota","Iowa"\[UndirectedEdge]"Missouri","Iowa"\[UndirectedEdge]"Nebraska","Iowa"\[UndirectedEdge]"SouthDakota","Iowa"\[UndirectedEdge]"Wisconsin","Idaho"\[UndirectedEdge]"Montana","Idaho"\[UndirectedEdge]"Nevada","Idaho"\[UndirectedEdge]"Oregon","Idaho"\[UndirectedEdge]"Utah","Idaho"\[UndirectedEdge]"Washington","Idaho"\[UndirectedEdge]"Wyoming","Illinois"\[UndirectedEdge]"Indiana","Illinois"\[UndirectedEdge]"Kentucky","Illinois"\[UndirectedEdge]"Missouri","Illinois"\[UndirectedEdge]"Wisconsin","Indiana"\[UndirectedEdge]"Kentucky","Indiana"\[UndirectedEdge]"Michigan","Indiana"\[UndirectedEdge]"Ohio","Kansas"\[UndirectedEdge]"Missouri","Kansas"\[UndirectedEdge]"Nebraska","Kansas"\[UndirectedEdge]"Oklahoma","Kentucky"\[UndirectedEdge]"Missouri","Kentucky"\[UndirectedEdge]"Ohio","Kentucky"\[UndirectedEdge]"Tennessee","Kentucky"\[UndirectedEdge]"Virginia","Kentucky"\[UndirectedEdge]"WestVirginia","Louisiana"\[UndirectedEdge]"Mississippi","Louisiana"\[UndirectedEdge]"Texas","Massachusetts"\[UndirectedEdge]"NewHampshire","Massachusetts"\[UndirectedEdge]"NewYork","Massachusetts"\[UndirectedEdge]"RhodeIsland","Massachusetts"\[UndirectedEdge]"Vermont","Maryland"\[UndirectedEdge]"Pennsylvania","Maryland"\[UndirectedEdge]"Virginia","Maryland"\[UndirectedEdge]"WestVirginia","Maine"\[UndirectedEdge]"NewHampshire","Michigan"\[UndirectedEdge]"Ohio","Michigan"\[UndirectedEdge]"Wisconsin","Minnesota"\[UndirectedEdge]"NorthDakota","Minnesota"\[UndirectedEdge]"SouthDakota","Minnesota"\[UndirectedEdge]"Wisconsin","Missouri"\[UndirectedEdge]"Nebraska","Missouri"\[UndirectedEdge]"Oklahoma","Missouri"\[UndirectedEdge]"Tennessee","Mississippi"\[UndirectedEdge]"Tennessee","Montana"\[UndirectedEdge]"NorthDakota","Montana"\[UndirectedEdge]"SouthDakota","Montana"\[UndirectedEdge]"Wyoming","NorthCarolina"\[UndirectedEdge]"SouthCarolina","NorthCarolina"\[UndirectedEdge]"Tennessee","NorthCarolina"\[UndirectedEdge]"Virginia","NorthDakota"\[UndirectedEdge]"SouthDakota","Nebraska"\[UndirectedEdge]"SouthDakota","Nebraska"\[UndirectedEdge]"Wyoming","NewHampshire"\[UndirectedEdge]"Vermont","NewJersey"\[UndirectedEdge]"NewYork","NewJersey"\[UndirectedEdge]"Pennsylvania","NewMexico"\[UndirectedEdge]"Oklahoma","NewMexico"\[UndirectedEdge]"Texas","NewMexico"\[UndirectedEdge]"Utah","Nevada"\[UndirectedEdge]"Oregon","Nevada"\[UndirectedEdge]"Utah","NewYork"\[UndirectedEdge]"Pennsylvania","NewYork"\[UndirectedEdge]"Vermont","Ohio"\[UndirectedEdge]"Pennsylvania","Ohio"\[UndirectedEdge]"WestVirginia","Oklahoma"\[UndirectedEdge]"Texas","Oregon"\[UndirectedEdge]"Washington","Pennsylvania"\[UndirectedEdge]"WestVirginia","SouthDakota"\[UndirectedEdge]"Wyoming","Tennessee"\[UndirectedEdge]"Virginia","Utah"\[UndirectedEdge]"Wyoming","Virginia"\[UndirectedEdge]"WestVirginia"}/.{"Alabama"->(Entity["Alabama, United States", Entity["AdministrativeDivision",{"Alabama","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Alabama\", \"UnitedStates\"}]", "administrative division"]),"Alaska"->(Entity["Alaska, United States", Entity["AdministrativeDivision",{"Alaska","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Alaska\", \"UnitedStates\"}]", "administrative division"]),"Arizona"->(Entity["Arizona, United States", Entity["AdministrativeDivision",{"Arizona","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Arizona\", \"UnitedStates\"}]", "administrative division"]),"Arkansas"->(Entity["Arkansas, United States", Entity["AdministrativeDivision",{"Arkansas","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Arkansas\", \"UnitedStates\"}]", "administrative division"]),"California"->(Entity["California, United States", Entity["AdministrativeDivision",{"California","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"California\", \"UnitedStates\"}]", "administrative division"]),"Colorado"->(Entity["Colorado, United States", Entity["AdministrativeDivision",{"Colorado","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Colorado\", \"UnitedStates\"}]", "administrative division"]),"Connecticut"->(Entity["Connecticut, United States", Entity["AdministrativeDivision",{"Connecticut","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Connecticut\", \"UnitedStates\"}]", "administrative division"]),"Delaware"->(Entity["Delaware, United States", Entity["AdministrativeDivision",{"Delaware","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Delaware\", \"UnitedStates\"}]", "administrative division"]),"Florida"->(Entity["Florida, United States", Entity["AdministrativeDivision",{"Florida","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Florida\", \"UnitedStates\"}]", "administrative division"]),"Georgia"->(Entity["Georgia, United States", Entity["AdministrativeDivision",{"Georgia","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Georgia\", \"UnitedStates\"}]", "administrative division"]),"Idaho"->(Entity["Idaho, United States", Entity["AdministrativeDivision",{"Idaho","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Idaho\", \"UnitedStates\"}]", "administrative division"]),"Illinois"->(Entity["Illinois, United States", Entity["AdministrativeDivision",{"Illinois","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Illinois\", \"UnitedStates\"}]", "administrative division"]),"Indiana"->(Entity["Indiana, United States", Entity["AdministrativeDivision",{"Indiana","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Indiana\", \"UnitedStates\"}]", "administrative division"]),"Iowa"->(Entity["Iowa, United States", Entity["AdministrativeDivision",{"Iowa","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Iowa\", \"UnitedStates\"}]", "administrative division"]),"Kansas"->(Entity["Kansas, United States", Entity["AdministrativeDivision",{"Kansas","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Kansas\", \"UnitedStates\"}]", "administrative division"]),"Kentucky"->(Entity["Kentucky, United States", Entity["AdministrativeDivision",{"Kentucky","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Kentucky\", \"UnitedStates\"}]", "administrative division"]),"Louisiana"->(Entity["Louisiana, United States", Entity["AdministrativeDivision",{"Louisiana","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Louisiana\", \"UnitedStates\"}]", "administrative division"]),"Maine"->(Entity["Maine, United States", Entity["AdministrativeDivision",{"Maine","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Maine\", \"UnitedStates\"}]", "administrative division"]),"Maryland"->(Entity["Maryland, United States", Entity["AdministrativeDivision",{"Maryland","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Maryland\", \"UnitedStates\"}]", "administrative division"]),"Massachusetts"->(Entity["Massachusetts, United States", Entity["AdministrativeDivision",{"Massachusetts","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Massachusetts\", \"UnitedStates\"}]", "administrative division"]),"Michigan"->(Entity["Michigan, United States", Entity["AdministrativeDivision",{"Michigan","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Michigan\", \"UnitedStates\"}]", "administrative division"]),"Minnesota"->(Entity["Minnesota, United States", Entity["AdministrativeDivision",{"Minnesota","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Minnesota\", \"UnitedStates\"}]", "administrative division"]),"Mississippi"->(Entity["Mississippi, United States", Entity["AdministrativeDivision",{"Mississippi","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Mississippi\", \"UnitedStates\"}]", "administrative division"]),"Missouri"->(Entity["Missouri, United States", Entity["AdministrativeDivision",{"Missouri","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Missouri\", \"UnitedStates\"}]", "administrative division"]),"Montana"->(Entity["Montana, United States", Entity["AdministrativeDivision",{"Montana","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Montana\", \"UnitedStates\"}]", "administrative division"]),"Nebraska"->(Entity["Nebraska, United States", Entity["AdministrativeDivision",{"Nebraska","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Nebraska\", \"UnitedStates\"}]", "administrative division"]),"Nevada"->(Entity["Nevada, United States", Entity["AdministrativeDivision",{"Nevada","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Nevada\", \"UnitedStates\"}]", "administrative division"]),"NewHampshire"->(Entity["New Hampshire, United States", Entity["AdministrativeDivision",{"NewHampshire","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NewHampshire\", \"UnitedStates\"}]", "administrative division"]),"NewJersey"->(Entity["New Jersey, United States", Entity["AdministrativeDivision",{"NewJersey","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NewJersey\", \"UnitedStates\"}]", "administrative division"]),"NewMexico"->(Entity["New Mexico, United States", Entity["AdministrativeDivision",{"NewMexico","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NewMexico\", \"UnitedStates\"}]", "administrative division"]),"NewYork"->(Entity["New York, United States", Entity["AdministrativeDivision",{"NewYork","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NewYork\", \"UnitedStates\"}]", "administrative division"]),"NorthCarolina"->(Entity["North Carolina, United States", Entity["AdministrativeDivision",{"NorthCarolina","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NorthCarolina\", \"UnitedStates\"}]", "administrative division"]),"NorthDakota"->(Entity["North Dakota, United States", Entity["AdministrativeDivision",{"NorthDakota","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"NorthDakota\", \"UnitedStates\"}]", "administrative division"]),"Ohio"->(Entity["Ohio, United States", Entity["AdministrativeDivision",{"Ohio","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Ohio\", \"UnitedStates\"}]", "administrative division"]),"Oklahoma"->(Entity["Oklahoma, United States", Entity["AdministrativeDivision",{"Oklahoma","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Oklahoma\", \"UnitedStates\"}]", "administrative division"]),"Oregon"->(Entity["Oregon, United States", Entity["AdministrativeDivision",{"Oregon","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Oregon\", \"UnitedStates\"}]", "administrative division"]),"Pennsylvania"->(Entity["Pennsylvania, United States", Entity["AdministrativeDivision",{"Pennsylvania","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Pennsylvania\", \"UnitedStates\"}]", "administrative division"]),"RhodeIsland"->(Entity["Rhode Island, United States", Entity["AdministrativeDivision",{"RhodeIsland","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"RhodeIsland\", \"UnitedStates\"}]", "administrative division"]),"SouthCarolina"->(Entity["South Carolina, United States", Entity["AdministrativeDivision",{"SouthCarolina","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"SouthCarolina\", \"UnitedStates\"}]", "administrative division"]),"SouthDakota"->(Entity["South Dakota, United States", Entity["AdministrativeDivision",{"SouthDakota","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"SouthDakota\", \"UnitedStates\"}]", "administrative division"]),"Tennessee"->(Entity["Tennessee, United States", Entity["AdministrativeDivision",{"Tennessee","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Tennessee\", \"UnitedStates\"}]", "administrative division"]),"Texas"->(Entity["Texas, United States", Entity["AdministrativeDivision",{"Texas","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Texas\", \"UnitedStates\"}]", "administrative division"]),"Utah"->(Entity["Utah, United States", Entity["AdministrativeDivision",{"Utah","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Utah\", \"UnitedStates\"}]", "administrative division"]),"Vermont"->(Entity["Vermont, United States", Entity["AdministrativeDivision",{"Vermont","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Vermont\", \"UnitedStates\"}]", "administrative division"]),"Virginia"->(Entity["Virginia, United States", Entity["AdministrativeDivision",{"Virginia","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Virginia\", \"UnitedStates\"}]", "administrative division"]),"Washington"->(Entity["Washington, United States", Entity["AdministrativeDivision",{"Washington","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Washington\", \"UnitedStates\"}]", "administrative division"]),"WestVirginia"->(Entity["West Virginia, United States", Entity["AdministrativeDivision",{"WestVirginia","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"WestVirginia\", \"UnitedStates\"}]", "administrative division"]),"Wisconsin"->(Entity["Wisconsin, United States", Entity["AdministrativeDivision",{"Wisconsin","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Wisconsin\", \"UnitedStates\"}]", "administrative division"]),"Wyoming"->(Entity["Wyoming, United States", Entity["AdministrativeDivision",{"Wyoming","UnitedStates"}], "Entity[\"AdministrativeDivision\", {\"Wyoming\", \"UnitedStates\"}]", "administrative division"])};
GeoGraphPlot[G2]

This approach to modeling epidemics on networks acknowledges that, in reality, people don’t interact randomly with the entire population. Instead, they interact within their communities or social groups, and these groups also have interactions with each other to some extent.

In this section, we will delve into epidemic models on networks. The key difference from what we previously saw lies in adapting the equations to a vector format, where each vertex (population) within the network has its set of state equations. Additionally, transmission can only occur between connected vertices.

SI

As mentioned earlier, when modeling disease transmission on networks, the equations are adapted into a vector format. In this format, each i-vertex (population) within the network has its set of state equations. Specifically, each vertex is associated with two equations representing susceptible((Subscript[s, i])) and infected ((Subscript[x, i])) individuals within that vertex. However, instead of directly using the number of infected individuals ((Subscript[x, i])) we employ the expression (∑_j) (Subscript[A, ij]) (Subscript[x, j]). This modification is essential because it restricts the disease transmission to only the adjacent vertices. Here, the term (Subscript[A, ij]) refers to the adjacency matrix, which indicates the connections or edges between different vertices in the network.

Consequently, the equations for this model are:

((d(Subscript[s, i]))/dt) = −β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]), 
((d(Subscript[x, i]))/dt) = β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]).

Florentine Families Network

When running a simulation for a disease that follows the SI epidemic model on the Florentine families’ network. This network represents the relationships between families in Florence in the early 15th century. The vertices represent the families and the edges represent a marriage between members of the two linked families. To run the simulation we need to:

Define the network:

FFN=ResourceData["Florentine Families Network"]

Define parameters:

β=0.9 ;
A=AdjacencyMatrix[FFN];
SI[{S_,I_}]:={-β S (A. I),β S (A. I)}

Define the initial conditions:

x0=ReplacePart[ConstantArray[0,VertexCount[FFN]],1->.2];
s0=7-x0;

Find the solution for each vertex:

sol={S,X}={s,x}/.NDSolve[{{s'[t],x'[t]}==SI[{s[t],x[t]}],{s[0],x[0]}=={s0,x0}},{s,x},{t,0,10}][[1]];

Plot the solutions:

colors={ColorData[106,1],ColorData[106,3]};totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[comparment[t],{t,0,2.5},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can also observe the graph of the total infected population  to understand how the SI epidemic model operates on the Florentine families network and how quickly the disease spreads within this context.

colors={ColorData[106,1],ColorData[106,3]};totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[Total@comparment[t],{t,0,2.5},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotLabel->Style["SI Total", Bold,14],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can even visualize the graph showing the progression of the epidemic through a dynamic illustration, where the nodes are represented by pie charts depicting the percentage of infected individuals.

GIF=Table[Column@{shapes=PieChart[#,PerformanceGoal->"Speed",ChartStyle->colors]&/@Transpose@{S[t],X[t]};Graph[FFN,ImageSize->Large,PlotLabel->"SI Model-Florentine Families",VertexShape->Thread[VertexList[FFN]->shapes],GraphLayout->"SpringEmbedding",VertexSize->.5,EdgeStyle->Black]},{t,Range[0,1.1,.01]}];
ListAnimate[GIF,ControlPlacement->Bottom]

We can observe that, in this case, the more external nodes, the ones on the periphery, are the last ones to get completely infected. This is because they have fewer probabilities of getting their susceptible individuals infected by their adjacent infected neighbors, as they have fewer adjacency vertices.

Contiguous US-States Network

We can also run this simulation with the US-states network, where the vertices represent different states and the edges represent the states adjacency between them. For this simulation, instead of taking (Subscript[s, i]) and (Subscript[x, i]) as the numbers of susceptible and infected individuals, it will represent the percentage of the state’s population that is either susceptible or infected at any particular moment.

Define the network:

usaStates=Delete[EntityList[EntityClass["AdministrativeDivision","ContinentalUSStates"]],2];statePositions=Table[EntityValue[state,"Position"],{state,usaStates}];G=Graph[{"Alabama","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","NewHampshire","NewJersey","NewMexico","NewYork","NorthCarolina","NorthDakota","Ohio","Oklahoma","Oregon","Pennsylvania","RhodeIsland","SouthCarolina","SouthDakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","WestVirginia","Wisconsin","Wyoming"},{"Alabama"\[UndirectedEdge]"Florida","Alabama"\[UndirectedEdge]"Georgia","Alabama"\[UndirectedEdge]"Mississippi","Alabama"\[UndirectedEdge]"Tennessee","Arkansas"\[UndirectedEdge]"Louisiana","Arkansas"\[UndirectedEdge]"Missouri","Arkansas"\[UndirectedEdge]"Mississippi","Arkansas"\[UndirectedEdge]"Oklahoma","Arkansas"\[UndirectedEdge]"Tennessee","Arkansas"\[UndirectedEdge]"Texas","Arizona"\[UndirectedEdge]"California","Arizona"\[UndirectedEdge]"Colorado","Arizona"\[UndirectedEdge]"NewMexico","Arizona"\[UndirectedEdge]"Nevada","Arizona"\[UndirectedEdge]"Utah","California"\[UndirectedEdge]"Nevada","California"\[UndirectedEdge]"Oregon","Colorado"\[UndirectedEdge]"Kansas","Colorado"\[UndirectedEdge]"Nebraska","Colorado"\[UndirectedEdge]"NewMexico","Colorado"\[UndirectedEdge]"Oklahoma","Colorado"\[UndirectedEdge]"Utah","Colorado"\[UndirectedEdge]"Wyoming","Connecticut"\[UndirectedEdge]"Massachusetts","Connecticut"\[UndirectedEdge]"NewYork","Connecticut"\[UndirectedEdge]"RhodeIsland","Delaware"\[UndirectedEdge]"Maryland","Delaware"\[UndirectedEdge]"NewJersey","Delaware"\[UndirectedEdge]"Pennsylvania","Florida"\[UndirectedEdge]"Georgia","Georgia"\[UndirectedEdge]"NorthCarolina","Georgia"\[UndirectedEdge]"SouthCarolina","Georgia"\[UndirectedEdge]"Tennessee","Iowa"\[UndirectedEdge]"Illinois","Iowa"\[UndirectedEdge]"Minnesota","Iowa"\[UndirectedEdge]"Missouri","Iowa"\[UndirectedEdge]"Nebraska","Iowa"\[UndirectedEdge]"SouthDakota","Iowa"\[UndirectedEdge]"Wisconsin","Idaho"\[UndirectedEdge]"Montana","Idaho"\[UndirectedEdge]"Nevada","Idaho"\[UndirectedEdge]"Oregon","Idaho"\[UndirectedEdge]"Utah","Idaho"\[UndirectedEdge]"Washington","Idaho"\[UndirectedEdge]"Wyoming","Illinois"\[UndirectedEdge]"Indiana","Illinois"\[UndirectedEdge]"Kentucky","Illinois"\[UndirectedEdge]"Missouri","Illinois"\[UndirectedEdge]"Wisconsin","Indiana"\[UndirectedEdge]"Kentucky","Indiana"\[UndirectedEdge]"Michigan","Indiana"\[UndirectedEdge]"Ohio","Kansas"\[UndirectedEdge]"Missouri","Kansas"\[UndirectedEdge]"Nebraska","Kansas"\[UndirectedEdge]"Oklahoma","Kentucky"\[UndirectedEdge]"Missouri","Kentucky"\[UndirectedEdge]"Ohio","Kentucky"\[UndirectedEdge]"Tennessee","Kentucky"\[UndirectedEdge]"Virginia","Kentucky"\[UndirectedEdge]"WestVirginia","Louisiana"\[UndirectedEdge]"Mississippi","Louisiana"\[UndirectedEdge]"Texas","Massachusetts"\[UndirectedEdge]"NewHampshire","Massachusetts"\[UndirectedEdge]"NewYork","Massachusetts"\[UndirectedEdge]"RhodeIsland","Massachusetts"\[UndirectedEdge]"Vermont","Maryland"\[UndirectedEdge]"Pennsylvania","Maryland"\[UndirectedEdge]"Virginia","Maryland"\[UndirectedEdge]"WestVirginia","Maine"\[UndirectedEdge]"NewHampshire","Michigan"\[UndirectedEdge]"Ohio","Michigan"\[UndirectedEdge]"Wisconsin","Minnesota"\[UndirectedEdge]"NorthDakota","Minnesota"\[UndirectedEdge]"SouthDakota","Minnesota"\[UndirectedEdge]"Wisconsin","Missouri"\[UndirectedEdge]"Nebraska","Missouri"\[UndirectedEdge]"Oklahoma","Missouri"\[UndirectedEdge]"Tennessee","Mississippi"\[UndirectedEdge]"Tennessee","Montana"\[UndirectedEdge]"NorthDakota","Montana"\[UndirectedEdge]"SouthDakota","Montana"\[UndirectedEdge]"Wyoming","NorthCarolina"\[UndirectedEdge]"SouthCarolina","NorthCarolina"\[UndirectedEdge]"Tennessee","NorthCarolina"\[UndirectedEdge]"Virginia","NorthDakota"\[UndirectedEdge]"SouthDakota","Nebraska"\[UndirectedEdge]"SouthDakota","Nebraska"\[UndirectedEdge]"Wyoming","NewHampshire"\[UndirectedEdge]"Vermont","NewJersey"\[UndirectedEdge]"NewYork","NewJersey"\[UndirectedEdge]"Pennsylvania","NewMexico"\[UndirectedEdge]"Oklahoma","NewMexico"\[UndirectedEdge]"Texas","NewMexico"\[UndirectedEdge]"Utah","Nevada"\[UndirectedEdge]"Oregon","Nevada"\[UndirectedEdge]"Utah","NewYork"\[UndirectedEdge]"Pennsylvania","NewYork"\[UndirectedEdge]"Vermont","Ohio"\[UndirectedEdge]"Pennsylvania","Ohio"\[UndirectedEdge]"WestVirginia","Oklahoma"\[UndirectedEdge]"Texas","Oregon"\[UndirectedEdge]"Washington","Pennsylvania"\[UndirectedEdge]"WestVirginia","SouthDakota"\[UndirectedEdge]"Wyoming","Tennessee"\[UndirectedEdge]"Virginia","Utah"\[UndirectedEdge]"Wyoming","Virginia"\[UndirectedEdge]"WestVirginia"},VertexCoordinates->statePositions]

Define parameters:

β=0.9 ;
A=AdjacencyMatrix[G];
SI[{S_,I_}]:={-β S (A. I),β S (A. I)}

Define the initial conditions:

x0=ReplacePart[ConstantArray[0,VertexCount[G]],1->.02];
s0=1-x0;

Find the solution for each vertex:

sol={S,X}={s,x}/.NDSolve[{{s'[t],x'[t]}==SI[{s[t],x[t]}],{s[0],x[0]}=={s0,x0}},{s,x},{t,0,10}][[1]];

Plot the solutions:

colors={ColorData[106,1],ColorData[106,3]};totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[comparment[t],{t,0,10},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can also observe the graph of the total percentage of the infected population to understand how the SI epidemic model operates on the specific network. It’s noteworthy that if even a single vertex starts with a percentage of its population infected, the simulation will ultimately result in the infection spreading throughout the entire population, following a logistic curve pattern.

totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[Chop[(Total@comparment[t])/48],{t,0,10},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotLabel->Style["SI Total", Bold,14],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can observe the progression of the epidemic through the graph dynamical illustration, where the nodes are represented by pie charts depicting the percentage of infected individuals.

GIF=Table[Column@{shapes=PieChart[#,PerformanceGoal->"Speed",ChartStyle->colors]&/@Transpose@{S[t],X[t]};GeoGraphPlot[G2,ImageSize->Large,PlotLabel->"SI Model",VertexShape->Thread[usaStates->shapes],VertexSize->2.3,EdgeStyle->Black]},{t,Range[0,10,.15]}];
ListAnimate[GIF,ControlPlacement->Bottom]

SIR

Now, for the SIR epidemic model on a network, the equations will also be adapted into a vector format, and the infected individuals will be represented by (∑_j) (Subscript[A, ij]) (Subscript[x, j]), so we will have  the following equations for each vertex:

((d(Subscript[s, i]))/dt) = −β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]), (4)
((d(Subscript[x, i]))/dt) = β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]) - γ(Subscript[x, i]) (5)
((d(Subscript[r, i]))/dt) = γ(Subscript[x, i]) (6)

American College Football Network

We can run a simulation for a disease that follows the SIR epidemic model, such as a Measles epidemic on the American College Football Network, where the nodes represent college football teams and the edges indicate whether they competed in a game (representing contact and potential infections between teams),  as follows:

Define the network:

CF=ResourceData["American College Football Network"]

Define parameters:

β=.6 ;γ=.3;
A=AdjacencyMatrix[CF];
SIR[{S_,I_,R_}]:={-β S (A. I),β S (A. I)-γ I, γ I}

Define the initial conditions:

x0=ReplacePart[ConstantArray[0,VertexCount[CF]],1->.02];
s0=1-x0;
r0=Table[0,Length[x0]];

Find the solution for each vertex:

sol={S,X,R}={s,x,r}/.NDSolve[{{s'[t],x'[t],r'[t]}==SIR[{s[t],x[t],r[t]}],{s[0],x[0],r[0]}=={s0,x0,r0}},{s,x,r},{t,0,20}][[1]];

Plot the solutions:

colors={ColorData[106,1],ColorData[106,3],ColorData[106,4]};totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[comparment[t],{t,0,12},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X,R},colors}],PlotRange->All,ImageSize->Large],SwatchLegend[colors,{"S","X", "R"},LegendMarkerSize->20]]

We can also observe the graph of the total infected population to understand how the SIR Epidemic Model operates on this network:

totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[(Total@comparment[t])/115,{t,0,15},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X,R},colors}],PlotLabel->Style["SIR Total", Bold,14],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X","R"},LegendMarkerSize->20]]

Initially, the susceptible (S) population is high, while the infected (X) and recovered (R) populations are low. As time progresses, the infected population increases, indicating the spread of the epidemic. The infected population continues to rise until it reaches the peak of the epidemic, after reaching the peak, the infected population starts to decline. As the infected population decrease, the recovered population begins to rise.The susceptible population also decreases as more individuals become infected.

We can observe the progression of the epidemic through the graph dynamical illustration:

GIF=Table[Column@{shapes=PieChart[#,PerformanceGoal->"Speed",ChartStyle->colors]&/@Transpose@{S[t],X[t],R[t]};Graph[CF,ImageSize->Large,PlotLabel->"SIR Model-College Footbal",VertexShape->Thread[VertexList[CF]->shapes],GraphLayout->"SpringEmbedding",VertexSize->10,EdgeStyle->Black,GraphLayout->"SpringElectricalEmbedding"]},{t,Range[0,10,.5]}];
ListAnimate[GIF,ControlPlacement->Bottom]

In this case, since the network is more connected, we have more communication between the vertices, so in the end, all the vertices tend to follow the same dynamics.

SIS

Now, for the SIS epidemic model on a network, the equations will also be adapted into a vector format, and the infected individuals will be represented by (∑_j) (Subscript[A, ij]) (Subscript[x, j]), so we will have  the following equations for each vertex:

((d(Subscript[s, i]))/dt) = −β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]) + γ(Subscript[x, i]), 
((d(Subscript[x, i]))/dt)= β(Subscript[s, i]) (∑_j) (Subscript[A, ij]) (Subscript[x, j]) - γ(Subscript[x, i]).

Florentine Families Network

We can run a simulation for a disease that follows the SIS epidemic model, such as a common cold, on the Florentine Families Network, where the vertices represent the families and the edges represent a marriage between members, so constant contact and probable contagion, as follows:

Define the network:

g=ResourceData["Florentine Families Network"]

Define parameters:

β=0.3;γ=0.2;
A=AdjacencyMatrix[g];
SIS[{S_,I_}]:={-β S (A. I)+γ I,β S (A. I)-γ I}

Define the initial conditions:

x0=ReplacePart[ConstantArray[0,VertexCount[g]],1->.02];
s0=1-x0;

Find the solution for each vertex:

sol={S,X}={s,x}/.NDSolve[{{s'[t],x'[t]}==SIS[{s[t],x[t]}],{s[0],x[0]}=={s0,x0}},{s,x},{t,0,20}][[1]];

Plot the solutions:

colors={ColorData[106,1],ColorData[106,3]};totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[comparment[t],{t,0,20},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotRange->All,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can also observe the graph of the total infected population to understand how the SIS Epidemic Model operates on this network:

totalplot=Legended[Show[MapThread[Function[{comparment,color},Plot[(Total@comparment[t]/15),{t,0,20},ImageSize->Large,PlotStyle->color,PlotRange->Full]],{{S,X},colors}],PlotLabel->Style["SIS Total", Bold,14],PlotRange->Full,ImageSize->Large],SwatchLegend[colors,{"S","X"},LegendMarkerSize->20]]

We can observe how the number of infections initially rises, resulting in an upward trajectory on the plot. Eventually, the epidemic reaches a steady state. This steady state in the SIS model is known as an ‘endemic disease state.’ In this state, there is a persistent percentage of infection in the population, so the number of infected individuals remains relatively constant over time.

We can observe the progression of the epidemic through the graph dynamical illustration:

GIF=Table[Column@{shapes=PieChart[#,PerformanceGoal->"Speed",ChartStyle->colors]&/@Transpose@{S[t],X[t]};Graph[g,ImageSize->Large,PlotLabel->"SIS Model",VertexShape->Thread[VertexList[g]->shapes],VertexSize->.5,EdgeStyle->Black]},{t,Range[0,15,.5]}];
ListAnimate[GIF,ControlPlacement->Bottom]

Here, we can see the difference with the SIR model. In this model, the diseases do not naturally die out. Instead, they persist in the population at a certain level, with individuals moving between the susceptible and infectious states in an ongoing cycle.

Agent-Based Simulations

Agent-based simulations offer a detailed, individual-level model for the spread of epidemics on networks. In this approach, each vertex, or “agent,” represents an individual, and the edges represent interactions between them. This setup allows to capture the details of individual interactions and contact networks, making it a valuable tool for studying individual level- epidemics.

In this framework, vertices no longer possess all the distinct states, they just possess one of the states of the epidemic model. Additionally, as before, nodes can only become infected if they are susceptible and connected to an infected node, but in this case we utilize a random number generator to determine whether transmission occurs, that is the reason why we cannot just solve an equations; instead, we need to run the simulation, and sometimes this can be computationally intensive, especially when applied to large-scale networks, due to their high level of detail.

SI

Let’s take a look at how the simulation for the SI model works within the agent-based framework:

As previously mentioned, each vertex represents an individual agent, and each agent can have only one state at a time. Therefore, we need to specify which nodes (individuals) initially start in the “Infectious” state (i.e., they have the disease). Next, we define the behavior of the agents (individuals) in the simulation. This includes specifying that nodes can only become infected if they are susceptible and connected to an infected node. However, since the probability of transmission is determined by the disease’s transmission rate β, we can calculate a random number to represent this probability, helping us to determine whether transmission occurs. If transmission does occur, we change the state of the “Susceptible” agent to “Infectious.

Online Messaging Network

For example, let’s consider the Online Messaging Network where the vertices represent individuals, and the connections are established through the online messages they send to each other. If an individual is connected to another individual, it means that they have shared a message. Now, let’s imagine that one of these messages contains a virus. Anyone who opens it has a [Beta] probability of getting the virus on their computer. Once they get the virus, every message they send will also be sent with the virus. This can be modeled using the SI model on networks with the agent-based simulation in the following way:

Define the network:

G=UndirectedGraph[WeaklyConnectedGraphComponents[ResourceData["Online Social Network"]][[1]],GraphLayout->"SpringElectricalEmbedding",EdgeStyle->Thickness[0.001]]

Set simulation parameters:

β=0.1;
initialInfected=5;
timeSteps=35;

Define the initial states of the nodes:

initialInfectedNodes=RandomSample[VertexList[G],initialInfected];
statuses=ConstantArray["Susceptible",Length[VertexList[G]]];
statuses=ReplacePart[statuses,Thread[initialInfectedNodes->"Infected"]];

Define the behavior of the agents:

SIstep[G_,statuses_,β_]:=Module[{T,list},T=Position[Thread[β>RandomReal[1,Length[AdjacencyList[G,#]]]]&/@VertexList[G][[Flatten[Position[statuses,"Infected"]]]],True];
list=AdjacencyList[G,#]&/@(VertexList[G][[Flatten[Position[statuses,"Infected"]]]]);
ReplacePart[statuses,Thread[DeleteDuplicates[Extract[list,#]&/@T]->"Infected"]]]

Run the simulation:

sol=NestList[SIstep[G,#,β]&,statuses,timeSteps];

infectedCount=Count[#,"Infected"]&/@sol;
susceptibleCount=Count[#,"Susceptible"]&/@sol;

Plot the simulation:

ListLinePlot[{infectedCount,susceptibleCount},AxesLabel->{"Time Steps","Number of Nodes"},PlotLabel->"SI Model Simulation",PlotStyle->{ColorData[106,3],ColorData[106,1]},PlotLegends->{"Infected","Susceptible"}]

We can observe that it follows the same trend as the differential equation approach. Initially, the number of infected nodes is low, but as the simulation progresses, the disease spreads to neighboring nodes, resulting in an increase in the number of infected nodes. This growth in the number of infected nodes follows a logistic-like curve.

Additionally, we can visualize the progression of the epidemic through a dynamic illustration:

GIF=Table[color=sol[[t]]/.{"Infected"->ColorData[106,3],"Susceptible"->ColorData[106,1]};Graph[G,PlotLabel->"SI Model-Online Messaging",VertexStyle->Thread[VertexList[G]->color],GraphLayout->"SpringEmbedding"],{t,Range[1,10,1]}];

ListAnimate[GIF,ControlPlacement->Bottom]

We can observe that the more external nodes, those on the periphery, are the last ones to become completely infected. This is because they have fewer probabilities of getting their susceptible individuals infected by their adjacent infected neighbors, given their fewer adjacency vertices. However, in the long run, the disease will spread from every initial carrier to all reachable vertices.

SIR

In the SIR (Susceptible-Infectious-Recovered) model for agent-based simulation, the process follows a similar pattern to the SI model, with the introduction of an additional state, “Recovered.” In this model, infectious individuals recover at a constant rate γ and transition to the “Recovered” state. To determine whether recovery occurs, we calculate a random number that represents this probability, and if recovery does occur, we change the state from “Infected” to “Recovered”.

Social Network of Dolphins

For example, let’s consider the Social Network of Dolphins, where the vertices represent dolphins in a community living in Doubtful Sound, New Zealand, and the edges represent the frequent associations between them. Now, let’s imagine there is a disease that follows the SIR model, like the Morbillivirus Infection, in which dolphins that recover from Morbillivirus infection (similar to measles in humans) may develop immunity. This can be modeled using the SIR model on networks with agent-based simulation in the following way:

Define the network:

G=IndexGraph[ResourceData["Dolphin Social Network"]]

Set simulation parameters:

β=0.3;
γ=0.2;
initialInfected=5;
timeSteps=50;

Define the initial states of the nodes:

initialInfectedNodes=RandomSample[VertexList[G],initialInfected];
statuses=Table["Susceptible",{Length[VertexList[G]]}];
statuses=ReplacePart[statuses,Thread[initialInfectedNodes->"Infected"]];

Define the behavior of the agents:

SIRstep[G_,statuses_,β_,γ_]:=Module[{T,l,list,s,T2,s2},
T=Position[Thread[β>RandomReal[1,Length[AdjacencyList[G,#]]]]&/@(VertexList[G][[Flatten[Position[statuses,"Infected"]]]]),True];
l=AdjacencyList[G,#]&/@(VertexList[G][[Flatten[Position[statuses,"Infected"]]]]);
list=Replace[#,Flatten[Position[statuses,"Recovered"]]->Flatten[Position[statuses,"Infected"]][[1]]]&/@l;
s=ReplacePart[statuses,Thread[Flatten[Extract[list,#]&/@T]->"Infected"]];T2=Flatten[Position[statuses,"Infected"]][[Flatten[Position[Thread[γ>RandomReal[1,Length[Flatten[Position[statuses,"Infected"]]]]],True]]]];
s2=ReplacePart[s,Thread[T2->"Recovered"]];
ReplacePart[s2,Thread[Flatten[Position[statuses,"Recovered"]]->"Recovered"]]
]

Run the simulation:

sol=NestList[SIRstep[G,#,β,γ]&,statuses,40];

infectedCount=Count[#,"Infected"]&/@sol;
susceptibleCount=Count[#,"Susceptible"]&/@sol;
recoveredCount=Count[#,"Recovered"]&/@sol;

Plot the simulation:

ListLinePlot[{infectedCount,susceptibleCount,recoveredCount},AxesLabel->{"Time Steps","Number of Nodes"},PlotLabel->"SIR Model Simulation",PlotStyle->{ColorData[106,3],ColorData[106,1],ColorData[106,4]},PlotLegends->{"Infected","Susceptible","Recovered"}]

We can observe that it follows the same trend as the differential equation approach. Initially, the susceptible (S) population is high, while the infected (X) and recovered (R) populations are low. As time progresses, the infected population increases, indicating the spread of the epidemic. The infected population continues to rise until it reaches the peak of the epidemic. After reaching the peak, the infected population starts to decline, and as the infected population decreases, the recovered population begins to rise. Simultaneously, the susceptible population also decreases as more individuals become infected.

Additionally, we can visualize the progression of the epidemic through a dynamic illustration:

GIF=Table[color=sol[[t]]/.{"Infected"->ColorData[106,3],"Susceptible"->ColorData[106,1],"Recovered"->ColorData[106,4]};Graph[G,PlotLabel->"SIR Model-Dolphins Network",VertexStyle->Thread[VertexList[G]->color],GraphLayout->"SpringEmbedding",EdgeStyle->Gray,VertexSize->1],{t,Range[1,40,1]}];
ListAnimate[GIF,ControlPlacement->Bottom]

SIS

In the SIS (Susceptible-Infectious-Susceptible) model for agent-based simulation, susceptible individuals become infectious when they come into contact with infectious individuals, following a transmission rate β, similar to the SI model. However, in this model, they also have a recovery rate γ as the SIR model, but when infectious individuals recover from the disease, they return to the susceptible state, making them susceptible to infection again. To determine whether infection or recovery occurs, we calculate a random number that represents this probability, and if it occurs, we change the states accordingly.

Zachary’s Karate Club Network

For example, let’s consider the Zachary’s Karate Club Network, where nodes represent members of a karate club, and links between nodes signify social interactions between those members. Now, let’s imagine there is a disease that follows the SIS model, the common cold. This can be modeled using the SIS model on networks with agent-based simulation in the following way:

Define the network:

g=ResourceData["Zachary's Karate Club Network"]

Set simulation parameters:

β=0.3;
γ=0.2;
initialInfected=5;
timeSteps=50;

Define the initial states of the nodes:

initialInfectedNodes=RandomSample[VertexList[G],initialInfected];
statuses=Table["Susceptible",{Length[VertexList[G]]}];
statuses=ReplacePart[statuses,Thread[initialInfectedNodes->"Infected"]];

Define the behavior of the agents:

SISstep[G_,statuses_,β_,γ_]:=Module[{T,l,list,s,T2,s2},
T=Position[Thread[β>RandomReal[1,Length[AdjacencyList[G,#]]]]&/@(VertexList[G][[Flatten[Position[statuses,"Infected"]]]]),True];
list=AdjacencyList[G,#]&/@(VertexList[G][[Flatten[Position[statuses,"Infected"]]]]);
s=ReplacePart[statuses,Thread[Flatten[Extract[list,#]&/@T]->"Infected"]];T2=Flatten[Position[statuses,"Infected"]][[Flatten[Position[Thread[γ>RandomReal[1,Length[Flatten[Position[statuses,"Infected"]]]]],True]]]];
s2=ReplacePart[s,Thread[T2->"Susceptible"]]
]

Run the simulation:

sol=NestList[SISstep[G,#,β,γ]&,statuses,40];

infectedCount=Count[#,"Infected"]&/@sol;
susceptibleCount=Count[#,"Susceptible"]&/@sol;

Plot the simulation:

ListLinePlot[{infectedCount,susceptibleCount},AxesLabel->{"Time Steps","Number of Nodes"},PlotLabel->"SIS Model Simulation",PlotStyle->{ColorData[106,3],ColorData[106,1],ColorData[106,4]},PlotLegends->{"Infected","Susceptible"}]

We can observe that it follows the same trend as the differential equation approach. Initially, the number of infected individuals rises, resulting in an upward trajectory on the plot. Eventually, the epidemic reaches a steady state, the ‘endemic disease state.’ In this state, there is a persistent percentage of infection in the population, so the number of infected individuals remains relatively constant over time. We can also observe this  little  oscillatory behavior, where individuals repeatedly switch between the “Susceptible” and “Infectious” states, but maintaining a relatively persistent percentage.

Additionally, we can visualize the progression of the epidemic through a dynamic illustration:

GIF=Table[color=sol[[t]]/.{"Infected"->ColorData[106,3],"Susceptible"->ColorData[106,1],"Recovered"->ColorData[106,4]};Graph[G,PlotLabel->"SIS Model-Zachary's Karate Club",VertexStyle->Thread[VertexList[G]->color],GraphLayout->"SpringEmbedding",EdgeStyle->Gray,VertexSize->1],{t,Range[1,40,1]}];
ListAnimate[GIF,ControlPlacement->Bottom]

We can observe how the simulation settles into an endemic state, characterized by a constant fraction of the population remaining infectious. In this state, the epidemic persists as long as there is a balance between individuals becoming infected and recovering, with no definitive end.

Conclusions

We explore two of the primary ways to model the spread of infectious diseases on networks: differential equations and agent-based simulations for population and individual-level analysis of disease spread for the SI, SIR, and SIS models.

Both agent-based simulations and differential equation models are valuable tools in epidemiology and disease modeling on networks, and all the epidemic models are important and usable for different disease behaviors. The choice of which one to use depends on the research objectives, available data, computational resources, and the level of detail required to answer specific questions related to disease dynamics and control strategies. Some researchers even use a combination of both methods to gain a more comprehensive understanding of infectious disease spread in complex networks.