NEXTNetR (Next-reaction-based Epidemics eXtended to Temporal Networks) is an R package for the efficient simulation of epidemics on complex networks (including weighted and temporal networks) with arbitrary transmission and recovery time distributions. NEXTNetR is an R wrapper around the C++ library NEXTNet. For those who prefer to user Python, NEXTNetPy offers a similar wrapper for Python.
Installation
If Git is available, the latest released version of NEXTNetR can be installed directly from Github by executing the following in R:
Alternatively, download the latest released version of NEXTNetR-v<version>-pkg.tar.gz. Then make sure all required dependencies are installed with install.packages(c("BH", "cpp11", "rappdirs"))
and install NEXTNetR on the command line (not within R) with
Since NEXT-Net is implemented in C++, a C++ compiler is required to install NEXTNetR. On Linux a compiler should typically be already available, on Mac OS R a suitable compiler is provided by XCode or the XCode Command Line Tools, and on Windows by RTools.
Synopsis
The following minimal example simulated an epidemic on an Erdős–Rényi network with lognormally distributed transmission time
library(NEXTNetR)
sim <- simulation(
erdos_renyi_network(1e5, 5),
lognormal_time(6, 30, 0.1))
simulation_addinfections(sim, 1, 0.0)
r <- simulation_run(sim, stop=list(total_infected=300e3))
plot(r$time, r$infected, type='l')
See Getting Started for stey-by-step instructions on how to use NEXTNetR.
Supported Features
NEXTNetR offers a range of common types of artifical networks such as erdos_renyi()
, see help(network_types)
for a full list. adjacencylist_network()
and adjacencylist_weightednetwork()
allow arbitrary unweighted and weighted networks to be used for simulations. Transmission and recovery times can likewise be arbitrary probability distributions, see help(time_distributions)
.
NEXTNetR also allows simulations on temporal networks, i.e. networks which change over time, possibly in response to epidemic events. Amongst the temporal networks currently supported by NEXTNetR are empirical_contact_temporalnetwork()
and activity_driven_temporalnetwork()
, see help(network_types)
for a full list.