Learn R Programming

ABM (version 0.4.1)

newConfigurationModel: Creates a random network using the configuration model

Description

Creates a random network using the configuration model

Value

an external pointer.

Arguments

rng

a function that generates random degrees

Details

The population must be an external pointer, not an R6 object To use an R6 object, we should use its pointer representation from its $get method.

The function rng should take exactly one argument n for the number of degrees to generate, and should return an integer vector of length n.

Examples

Run this code
# creates a simulation with 100 agents
sim = Simulation$new(100)
# add a Poisson network with a mean degree 5
sim$addContact(newConfigurationModel(function(n) rpois(n, 5)))

Run the code above in your browser using DataLab