generate_niche: Generate Niche Model Food Web(s)

View source: R/models.r

generate_nicheR Documentation

Generate Niche Model Food Web(s)

Description

This function generates one or multiple food webs using the Niche Model proposed by Williams & Martinez (2000). The model assumes that each species has a niche value and consumes resources within a defined range.

Usage

generate_niche(S, C, nsim = 1)

Arguments

S

Integer. The number of species in the community. Must be S > 1.

C

Numeric. The connectance (fraction of realized links). Must be ⁠0 < C ≤ 1⁠.

nsim

Integer. The number of networks to generate (⁠nsim ≥ 1⁠).

Value

If nsim = 1, returns a binary adjacency matrix (⁠S × S⁠). If nsim > 1, returns a list of igraph objects, each representing a food web.

References

Williams, R. J., and N. D. Martinez. 2000. Simple rules yield complex food webs. Nature 404:180–183.

Examples

generate_niche(20, 0.1)        # Single adjacency matrix
generate_niche(20, 0.1, nsim=5) # List of 5 food webs as igraph objects

lsaravia/EcoNetwork documentation built on April 5, 2025, 1:51 p.m.