Skip to contents

Simulatiojn objects represent a single simulation on a specific network and using specific tranmission and reset/recovery times. The network can be weighted and/or temporal, see network_types. To force a temporal network to be treated as a static network, set option static_network to TRUE.

Usage

simulation(nw, psi, rho = NULL, options = list(), method = "nextreaction")

Arguments

nw

network to simulate on

psi

infection time distribution

options

named list of algorithm options, see below

method

the simulation method to use, currently only 'nextreaction'

rhi

reset/recovery time distribution

Value

a simulation object. See simulation_run for how to run the simulation and simulation_functions for other functions that operate on simulations.

Details

Possible options are

  • SIR: Do not make recovered nodes susceptible again as in the SIR model. Default FALSE.

  • static_network: Treat network as static, even if it is a temporal network. Default FALSE.

  • shuffle_neighbours: Shuffle the neighbours upon infecting a node. Default TRUE.

  • edges_concurrent: Activate all outgoing edges simultaenously or sequentially. If set to true, neighbours are implicitly shuffled and shuffle_neighbours thus has no effect. Default FALSE.

Examples

# Create contact network network
nw <- erdos_renyi_network(1e5, 5)
# Create transmission and reset time distributions
psi <- lognormal_time(6, 30, 0.1)
rho <- weibull_time(shape=5, scale=50)
# Create simulation and specifiy initial set of infections
sim <- simulation(nw, psi, rho)
simulation_addinfections(sim, nodes=c(1), times=c(0.0))
# Run simulation until time t=100 or 200,000 infections have occured
r <- simulation_run(sim, stop=list(time=300, total_infected=300e3))
# Plot the number of infected nodes against time
plot(r$time, r$infected, type='l')