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.
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
#> IGRAPH 39e4fcb D--- 20 53 --
#> + edges from 39e4fcb:
#> [1] 1-> 3 1-> 5 1->19 1->20 2-> 3 2-> 5 2->19 2->20 3->10 3->13
#> [11] 3->15 3->18 3->20 4->10 4->13 4->15 4->18 4->20 5->10 5->13
#> [21] 5->15 5->18 5->20 6->10 6->13 6->15 6->18 6->20 7->10 7->12
#> [31] 7->13 7->15 7->20 8->12 8->13 8->15 8->20 9->12 9->13 9->15
#> [41] 9->20 10->12 10->13 10->15 10->20 11->15 11->16 11->17 12->16 12->17
#> [51] 13->14 13->17 14->17
generate_niche(20, 0.1, nsim=5) # List of 5 food webs as igraph objects
#> [[1]]
#> IGRAPH fe545c9 D--- 20 53 --
#> + edges from fe545c9:
#> [1] 1-> 3 1-> 4 1->11 2-> 3 2-> 4 2-> 8 2->10 3-> 8 4-> 7 4-> 8
#> [11] 5-> 7 6-> 9 6->13 7->13 10->18 10->19 11->18 11->19 12->15 12->18
#> [21] 12->19 13->15 13->18 13->19 13->20 14->15 14->17 14->18 14->19 14->20
#> [31] 15->15 15->17 15->18 15->19 15->20 16->15 16->17 16->18 16->19 16->20
#> [41] 17->15 17->17 17->18 17->19 17->20 18->17 18->18 18->19 18->20 19->17
#> [51] 19->18 19->20 20->17
#>
#> [[2]]
#> IGRAPH fca9dd7 D--- 20 50 --
#> + edges from fca9dd7:
#> [1] 1->11 2-> 4 2-> 6 2->16 2->18 3-> 4 3->16 3->18 4-> 5 4-> 7
#> [11] 4-> 9 4->15 5-> 5 5-> 7 5-> 9 5->15 6-> 7 6->15 7->12 7->15
#> [21] 8->12 8->15 8->17 9->12 9->15 9->17 10->12 10->13 10->14 11->12
#> [31] 11->13 11->14 12->14 12->19 13->19 13->20 14->19 14->20 15->19 15->20
#> [41] 16->19 16->20 17->19 17->20 18->19 18->20 19->19 19->20 20->19 20->20
#>
#> [[3]]
#> IGRAPH c430743 D--- 20 49 --
#> + edges from c430743:
#> [1] 1-> 2 1-> 6 1-> 9 1->14 1->15 2-> 2 2-> 6 2-> 9 2->14 2->15
#> [11] 3-> 8 3->14 3->15 3->16 4-> 8 4->14 4->15 4->16 5-> 8 5->14
#> [21] 5->15 5->16 6-> 7 6->15 6->16 6->19 7-> 7 7->16 7->19 8-> 7
#> [31] 8->10 8->16 8->19 9-> 7 9->10 9->13 9->16 9->19 10->17 10->18
#> [41] 11->17 12->17 13->17 14->17 15->17 16->20 17->20 18->20 19->20
#>
#> [[4]]
#> IGRAPH 85fd121 D--- 20 49 --
#> + edges from 85fd121:
#> [1] 1->12 2-> 6 2-> 8 2->13 3-> 7 3-> 8 3->13 3->17 4-> 7 4-> 8
#> [11] 4->13 4->17 5-> 8 5->13 5->14 5->17 6-> 8 6->13 6->14 6->17
#> [21] 7->14 7->16 7->19 8->14 8->16 8->19 9->14 9->16 9->19 10->14
#> [31] 10->15 10->16 11->14 11->15 11->16 12->15 12->16 13->15 13->16 13->20
#> [41] 14->16 14->20 15->16 15->20 16->20 17->20 18->20 19->20 20->20
#>
#> [[5]]
#> IGRAPH 290c877 D--- 20 56 --
#> + edges from 290c877:
#> [1] 1-> 2 1-> 6 1-> 8 1-> 9 2-> 3 2->12 3->12 4->12 5->12 5->17
#> [11] 5->18 5->19 6->12 6->17 6->18 6->19 7->10 7->11 7->13 7->16
#> [21] 7->18 7->19 8->10 8->11 8->13 8->16 8->18 8->19 9->10 9->13
#> [31] 9->16 9->18 9->19 10->16 10->19 11->16 11->19 12->14 12->15 12->19
#> [41] 12->20 13->14 13->15 13->19 13->20 14->14 14->15 14->19 14->20 15->14
#> [51] 15->15 15->19 15->20 16->20 17->20 18->20
#>