TrophicChains {cheddar}R Documentation

Trophic chains


Enumerates every trophic chain in a food web.


TrophicChains(community, = NULL, = NULL)



an object of class Community.

the names of the node properties to return. Should meet the criteria of the properties parameter of NPS.

the names of chain properties to return.


Enumerates every trophic chain in the food-web and returns a data.frame containing any requested node and trophic-link columns.

Some network properties and analyses require knowledge of every unique path - ‘trophic chain’ - through the food-web. A trophic chain starts at a basal node (BasalNodes) and ends when it is not possible to add nodes that are not already in the chain, so loops and cannibalism are ignored. For communities that have one or more top-level nodes (TopLevelNodes) each trophic chain will end with a top-level node.

If your analysis requires only simple statistics about trophic chains, the TrophicChainsStats function is more suitable as it is much faster and requires less memory than TrophicChains. This is particularly true for communities that contain a large number of trophic chains, such as the SkipwithPond dataset, which has more than $10^5$ unique chains.

It will not be possible to compute, within reasonable time and available system memory, trophic chains for food webs with a large number of nodes and/or trophic links. TrophicChains will raises an error 'Unable to compute paths' for these food webs. The ‘Large numbers of trophic chains’ section of the ‘Community’ vignette explains this in more detail.


A data.frame.


Lawrence Hudson

See Also

BasalNodes, TopLevelNodes, TLPS, ThreeNodeChains, TrophicChainsStats, SkipwithPond



tc <- TrophicChains(TL84)

# Every chain starts with a basal node
first <- tc[,1]

# TL84 has a single top-level consumer - every trophic chain ends with this 
# consumer
# Get the last node in each chain
last <- apply(tc, 1, function(row) row[max(which(""!=row))])

# M of nodes

# M and N of nodes

# Skipwith Pond has more than 10e5 unique chains
# Not all systems will be able to allocate the memory required to hold the 
# chains
## Not run: dim(TrophicChains(SkipwithPond))

[Package cheddar version 0.1-636 Index]