# Control edge scenario and edge weight through rpa_control_scenario()
# and rpa_control_edgeweight(), respectively,
# while keeping rpa_control_newedge(),
# rpa_control_preference() and rpa_control_reciprocal() as default.
set.seed(123)
control <- rpa_control_scenario(alpha = 0.5, beta = 0.5) +
rpa_control_edgeweight(
sampler = function(n) rgamma(n, shape = 5, scale = 0.2)
)
ret1 <- rpanet(nstep = 1e3, control = control)
# In addition, set node groups and probability of creating reciprocal edges.
control <- control + rpa_control_reciprocal(
group.prob = c(0.4, 0.6),
recip.prob = matrix(runif(4), ncol = 2)
)
ret2 <- rpanet(nstep = 1e3, control = control)
# Further, set the number of new edges in each step as Poisson(2) + 1 and use
# ret2 as a seed network.
control <- control + rpa_control_newedge(
sampler = function(n) rpois(n, lambda = 2) + 1
)
ret3 <- rpanet(nstep = 1e3, initial.network = ret2, control = control)
Run the code above in your browser using DataLab