Giter Club home page Giter Club logo

sir's Introduction

Fast SIR on networks

Pretty quick code for regular (continuous time, Markovian) SIR on simple graphs. I chatty intro to it here: https://petterhol.me/2018/02/07/fastest-network-sir-code-in-the-east/

To get it running you need:

  1. Make dictionary o (for complier object files)
  2. Compile it by make (it has some generic optimization flags now)
  3. Run it like

./sir nwk/iceland.lnk 1.5 11958364283164656333

The first argument is the file containing the network. The input format is an edge list assuming the vertex-id numbers are between 0 and N - 1. The program sets N as one plus the largest index observed, so if your network has isolates make sure at least the largest id has degree > 0. The example network comes from: Haraldsdottir S, Gupta S, Anderson RM, Preliminary studies of sexual networks in a male homosexual community in Iceland, J Acquir Immune Defic Syndr. 1992;5(4):374-81.

The second argument is the per-link infection rate. I assume the recovery rate is one (if some other rate is needed, you just have to divide the infection rate by the recovery rate and divide the output extinction time by the recovery rate).

The third argument is the seed for the RNG = a 64-bit unsigned decimal integer. Ideally this number should be as entropic as possible, i.e. itself generated by a random number generator. In practice sir should be run with a wrapper. A very simple (Python) such is supplied that could be run on the command line as:

python3 run_sir.py nwk/iceland.lnk

It generates: the average outbreak size, error in ditto, the average extinction time, error in ditto . . for seven exponentially increasing beta values.

For more comments, see the files.

sir's People

Contributors

pholme avatar

Watchers

James Cloos avatar

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.