Skip to content

A GitHub repo for the generation of a network model to represent society with various components, the spread of the disease on this network, and the calculation of reproduction number on these simulation results.

License

parulm/spread_lockdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Network modeling for COVID-19 spread

This repository contains the python code for generating a real-world network and simulating the spread of an infectious disease in the network under different lockdown and transmission scenarios. The parameters and code blocks are modified for the case of COVID-19 but they can be edited to reflect the spread of any other infectious disease. Detailed methods are explained in arxiv preprint

Generating the network

The network generation method involves creating multiple layers each corresponding to cliques for families, scale-free network for workplace interaction, random network for interaction of the population with essential service providers, and social interaction of the population outside of homes and workplaces. A social network with all the layers for the default parameters can be generated by calling the constructor for the Social_Net class from generate_network.py with the parameter complete_net = True. Alternately, if you wish to modify some or all of the parameters for network generation, you can call the constructor for the Social_Net class with complete_net = False and then call set_parameters on the same object. The parameters, their significance and default values are detailed below. After setting the parameter, the network can be generated by calling start_network(). Once the network is generated, use return_graph to save an instance of the network. Please see the file test.py for an example.

Parameter Default value Description
workrate 0.7 fraction of the population that is working
essential 0.2 fraction of the working population employed in essential services
family sizes [0.3, 0.35, 0.18, 0.17] array for the fraction of population with family size of 1, 2, 3, and 4.
ba_degree 3 value of m for the BA graph; defines the density of the workplace interaction network
rand_degree 0.6 average degree of the random network of essential workers
interaction_prob 0.2 fraction of the general population that interacts with essential workers
social_prob 0.001 fraction of pairs of nodes that have social interaction outside of home and workplace

Simulation of disease spread

The network spread is implemented using the SIR model where the network is initialized with a certain number of infected nodes and the rest of the population is susceptible (referred in the code as healthy). These infected nodes then spread the infection along to their neighbors constrained by certain spread parameters (please see the arxiv preprint for more details). The spread can be initialized on any network loaded using networkx for default parameters by calling the constructor of the Spread_Net class with setval = True. If you wish to modify some or all of the parameters, the constructor should be called with setval = False and the parameters can be set thereafter by calling the function set_parameters(). The parameters, their default values and their description is listed below. The many_dayrun() function can be used to run the spread on the network for the number of days defined by the parameter num_days. The lockdown can be specified in this function by setting the parameters lockstart and lockend. The variable postlock = True means that there is gradual resumption to normalcy after the lockdown and this scenario needs you to set the parameter complete_norm as the timestep when population interaction resumes to complete normalcy. If the parameter curve is set to True, the function saves the simulation results as a plot in the specified image file (parameter: img_file). The default plot also plots the network calculated reproduction number for the disease spread. Alternately, you can call the draw_curve() function to draw the curve after the simulation has completed. Please see the file test.py for an example run.

Parameter Default value Description
trans_asymp 0.05 transmission rate for asymptomatic patients
trans_symp 0.00 transmission rate for symptomatic patients
death_rate 0.05 fraction of the patients that die from the disease
immune_rate 0.85 fraction of the patients that become immune to the disease after recovering
asymp_ratio 0.8 fraction of the patients that do not show any symptoms
trans_post 0.01 transmission rate for asymptomatic patients right after the end of the lockdown if postlock=True

Due to the stochasticity in the spread process and the high dependency on the network structure, it is better to run an ensemble of these generation and spread processes. Please see the file average_run.py for example. If you have any questions, please feel free to contact me.

About

A GitHub repo for the generation of a network model to represent society with various components, the spread of the disease on this network, and the calculation of reproduction number on these simulation results.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages