View source: R/fw_generative_models.R
create_niche_model | R Documentation |
Function to generate a food web based on the niche model (Williams and Martinez, 2000) based on the number of species and connectance. Corrections from Allesina et al. (2008) are used.
create_niche_model(S, C)
S |
integer, number of species. |
C |
numeric, connectance i.e. the number of realized links over the all possible links. |
If at least one species has not resource or consumer (i.e. it is an isolated species), another food web is generated, until a maximum of 100 iterations.
A (square) matrix with zeros (no interaction) and ones (species j consume species i).
Williams, R. J., & Martinez, N. D. (2000). Simple rules yield complex food webs. Nature, 404(6774), 180-183.
Allesina, S., Alonso, D., & Pascual, M. (2008). A general model for food web structure. science, 320(5876), 658-661.
set.seed(123)
web_niche <- create_niche_model(30, .1)
image(t(web_niche))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.