The NEXT-NET C++ library contains efficient algorithms for simulating epidemics with time-varying infectiousness (so-called "non-Markovian" epidemics) on complex networks. The main algorithm provided by NEXT-NET is based on the next reaction method and scales to networks with millions of nodes, see our preprint.
The recommended way of using NEXT-NET is through our wrappers for Python and R, which are nextnet (https://github.com/oist/NEXTNetPy) for Python and NEXTNetR (https://github.com/oist/NEXTNetR) for R. See these repositories for how to install and use those wrappers.
However, for quick experiments the C++ library includes a simply command-line interface for running simulations on a range of networks.
To download and install the NEXT-NET command-line tool do
git clone --recurse-submodules https://github.com/oist/NEXTNet.git
cd NEXTNet
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
make
To simulate an epidemic starting until time t=250 from node 1 of a Watts-Strogatz network of size N=10.000 nodes with parameters K=6 and beta=0.1, gamma distributed infection times with mean 8 and variance 1, and log-normally distributed recovery times with mean 50 and variance 20 run
./nextnet -n 'watts_strogatz(10000, 4, 0.2)' -p 'gamma(8,1)' -r 'lognormal(30,20)' -i 1 -t 250 > trajectory.txt
To plot the resulting number of currently infected nodes over time using gnuplot, run
set key autotitle columnhead
set log y
plot 'trajectory.txt' using 1:9 with lines
The available network types and infection time distributions can be listed with
./nextnet --list-networks
./nextnet --list-times
The NEXT-NET library offers various epidemic models, static and dynamic networks, transmission time distributions, and simulation algorithms.
- SI (Susceptible Infected). Individuals start out susceptible and become infected upon transmission of the disease.
- SIS (Susceptible Infected Susceptible). Individuals start out susceptible, become infected upon transmission of the disease, and eventually recover and become susceptible again.
- SIR (Susceptible Infected Recovered). Individuals start out susceptible, become infected upon transmission of the disease, and eventually recover. Recovered individuals do not become susceptible agian.
- Erdős–Rényi. Random networks in two nodes are connected by an edge with a certian probabilitz. These networks exhibit no clustering or hubs.
- Watts-Strogatz. Random small-world networks exhibiting clustering and hubs.
- Barabási-Albert. Random preferential attachment networks exhibiting hubs and scale-free degree distributions.
- Acyclic networks. Random tree-like networks with Poissonian distribution of number of offsprings
- Configuration model. Random networks with given degree distributions
- Clustered configuration model. Random networks with given degree distribution and clustering coefficients.
- Lattice. Regular spatial networks.
- Empirical networks. Networks defined by an adjacency list, i.e. a list of neighbours of each node.
- Temporal Erdös-Réyni. Temporal networks that at any instant resembles an Erdős–Rényi networks, but in which nodes randomly detach from a currently neighbour and reattach to a new, randomly chosen neighbour.
- SIRX network. A network version of the SIRX model in nodes stochastically deactivate, i.e. remove their links, in response to an epidemic outbreak.
- Activity-driven network. A temporal network in which nodes stochastically detatch from their current neighbour and reattach elsewhere.
- Brownian proximity network. A temporal network with spatial structure in which nodes move randomly in two dimensions and links represent spatial proximity between nodes.
- Epirical contact networks. Networks defined a list (t,i,j) of contact times t between individuals i and j.
Time distributions define (a) the time it takes from the infection of a node until it transmits the disease across a specific link, and (b) the time it takes for a node to recover. NEXT-NET offers the following pre-defined distributions, and allows users to easily implement additional distributions.
- Exponential.
- Deterministic.
- Gamma.
- Lognormal
- Weibull
- Polynomial rate.
- Next reaction method. The most efficient algorithm available, in which the runtime to find the next infection depends only weakly on the number of infected nodes. Scales to networks with millions of nodes.
- REGIR (Rejection Gillespie algorithm for non-Markovian Reactions *). Based on a similar approximation as nGMA, but removes the quadratic growth of the time it takes to find the next infection. Typically slower than the next reaction method but scales similarly with network size.
- nMGA (non-Markovian Gillespie Algorithm). An approximate algorithms which works well on small networks. However, the runtime to find the next infection grows quadratically with the number of infected nodes, which limits the scalability to large networks.
TBD