Learn R Programming

loop (version 1.1)

pathways: enumerate all food chains that are linked to a given species/node

Description

the food chains can allow circles/loop. This function will return all possible food chains, and some duplicated chains are generated as well. If you want to get unique food chains, try the function 'uniquepaths'

Usage

pathways(gemat, bsp)

Arguments

gemat
standard square graph matrix
bsp
the species/node you want to search. If input is a vector, then the function will return the food chains for each element species in the vector. Please note that all pathways/chains are started with the focused vertext/node/species, ended by a circle/loop; or upto the top of the network without a circle/loop.

Value

return a list showing all food chains by presenting each node in that chain. Also, the weights for each link will be returned as well.

References

Chen Y (2012) loop: an R package for performing decomposition of weighted directed graphs, food web analysis and flexible network plotting. Submitted.

See Also

uniquepaths, loop.forward, loop.random

Examples

Run this code
mat=matrix(c(0,5,3,7,0,5,0,8,0,4,3,8,0,1,6,7,0,1,0,2,0,4,6,2,0),5,5)
pathways(mat,bsp=2)
#a vector of species
pathways(mat,bsp=c(1,3,5))

Run the code above in your browser using DataLab