Git Product home page Git Product logo

wcota / dynsis-py Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 4.0 33 KB

Implementation of SIS epidemic model for large and heterogeneous networks

Home Page: https://doi.org/10.1016/j.cpc.2017.06.007

License: GNU General Public License v3.0

Python 98.75% Shell 1.25%
complex-networks markovian-epidemic-processes markovian-processes gillespie-algorithm networkx epidemics computational-physics stochastic-processes stochastic-simulation-algorithm

dynsis-py's Introduction

Optimized Gillespie algorithms for the simulation of Markovian epidemic processes on large and heterogeneous networks: SIS-OGA

This code is part of the article "Optimized Gillespie algorithms for the simulation of Markovian epidemic processes on large and heterogeneous networks" [ArXiv].

license language

Python implementation

Versions

Fortran implementation - for performance

(this) Python implementation - learn and use

NetworkX Python implementation - range of options

GA Fortran implementation - Statistically exact, but NOT optimized

Citation

Full bibliographic details: Computer Physics Communications 219C (2017) pp. 303-312

DOI information: 10.1016/j.cpc.2017.06.007

@article{COTA2017303,
title = "Optimized Gillespie algorithms for the simulation of Markovian epidemic processes on large and heterogeneous networks",
journal = "Computer Physics Communications",
volume = "219",
number = "",
pages = "303 - 312",
year = "2017",
note = "",
issn = "0010-4655",
doi = "http://dx.doi.org/10.1016/j.cpc.2017.06.007",
url = "http://www.sciencedirect.com/science/article/pii/S0010465517301893",
author = "Wesley Cota and Silvio C. Ferreira",
keywords = "Complex networks",
keywords = "Markovian epidemic processes",
keywords = "Gillespie algorithm",
abstract = "Numerical simulation of continuous-time Markovian processes is an essential and widely applied tool in the investigation of epidemic spreading on complex networks. Due to the high heterogeneity of the connectivity structure through which epidemic is transmitted, efficient and accurate implementations of generic epidemic processes are not trivial and deviations from statistically exact prescriptions can lead to uncontrolled biases. Based on the Gillespie algorithm (GA), in which only steps that change the state are considered, we develop numerical recipes and describe their computer implementations for statistically exact and computationally efficient simulations of generic Markovian epidemic processes aiming at highly heterogeneous and large networks. The central point of the recipes investigated here is to include phantom processes, that do not change the states but do count for time increments. We compare the efficiencies for the susceptible–infected–susceptible, contact process and susceptible–infected–recovered models, that are particular cases of a generic model considered here. We numerically confirm that the simulation outcomes of the optimized algorithms are statistically indistinguishable from the original GA and can be several orders of magnitude more efficient."
}

Synopsis

This code is a implementation of the SIS-OGA algorithm, as detailed in our paper. It receives as input a network file, containing a list of edges and read, via terminal, the dynamical parameters.

For performance, see https://github.com/wcota/dynSIS (Fortran implementation)

Dataset input

You need to provide a file containing the list of edges (in and out, two collumns). ID of the vertices must be enumerated sequentially as 1, 2, 3,..., N, where N is the total number of vertices of the network. Here, we assume undirected and unweighted networks without multiple neither self connections.

Consider, for example, a network with N=5 vertices represented by:

1,2
1,3
2,4
2,5
3,4

Examples of datasets and their specifications are available at https://wcota.me/dynSISdatasets.

Installation

Python 3 is required, and also the NumPy library.

Use

If you want to manually input the dynamical parameters, just type:

python dynamics.py <edges_file> <output_file>

where <output_file> will be written with the average infected vertices density versus time.

Alternatively, use (Linux):

bash run.sh <edges_file> <output_file> <number of samples> <infection rate lambda> <maximum time steps> <fraction of infected vertices (initial condition)>

Example:

bash run.sh edges/s01.edges.dat "s01.lb0.002_100-samples.dat" 100 0.002 1000000 0.5

License

This code is under GNU General Public License v3.0.

dynsis-py's People

Contributors

wcota avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dynsis-py's Issues

Paper Access

Hello,

Thank you for providing such implementation, it's been very helpful. I'm however trying to access the paper without going through sciencedirect.com as I'm no longer a student or in academic, doing this for my friend... I would be very grateful if you could help send the paper to [email protected]. Cheers

Thanks,
Andy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.