Randomly generate a wide range of interaction networks
netgen(net_size = 50, ave_module_size = 10, min_module_size = 6,
min_submod_size = 1, net_type = c("mixed", "random", "scalefree",
"nested", "bi-partite nested", "bi-partite random",
"tri-trophic bipartite nested-random",
"tri-trophic bipartite nested-bipartite nested", "bn", "br", "tt-bn-r",
"tt-bn-bn"), ave_degree = 5, rewire_prob_global = 0.2,
rewire_prob_local = 0, mixing_probs = c(0.2, 0.2, 0.2, 0.2, 0.2, 0,
0), verbose = FALSE)
an igraph
object
network size (number of nodes)
average module size
cutoff for the minimum modules size
cutoff for submodules, used only for bipartite and tripartite networks
network type, see details
average degree of connection
probability any given edge should be rewired
probability that edges within a module should be rewire locally (within the module)
module probabilities for first 7 types, used for constructing mixed networks
logical, default TRUE. Should a message report summary statistics?
network type is one of
mixed
random
scalefree
nested
bi-partite nested (or short-hand "bn")
bi-partite random (or short-hand "br")
tri-trophic bipartite nested-random. (Can use short-hand "ttbnr")
tri-trophic bipartite nested-bipartite nested (Can use short-hand "ttbnbn")
Valid Parameter Ranges
Please note that not all combinations of parameters will create valid networks.
If an invalid combination is requested, netgen()
will error with an informative
message. A list of these constraints is provided below for reference.
net_size >= ave_module_size
. If `net_size = ave_module_size`` the program
generates a network with a single module.
ave_module_size > min_module_size
ave_degree >= 1
. Preferably larger than 4, to ensure single component modules.
rewire_prob_global = 0
produces completely uncoupled modules. To ensure a single
component network use rewire_prob_global > 0
and sufficiently large.
rewire_prob_local = 0
produces idealized modules.
Use rewire_prob_local > 0
to add stochasticity to the modules.
For tripartite networks min_module_size > min_submod_size
.
This also implies min_module_size >= 2
.
For scalefree networks (or mixed networks involving scalefree modules)
ave_degree < min_module_size
For mixed networks mixing_probs
need to sum to 1
. If the sum is larger
than one, only the first types, corresponding to sum <=1
, will be sampled.
library(EcoNetGen)
# \donttest{
set.seed(12345)
net <- netgen()
adj_plot(net)
# }
Run the code above in your browser using DataLab