Description Usage Arguments Details Value References Examples
View source: R/networkSimplifier.R
Threshold and simplify an input network.
1 | networkSimplifier(sub.graph, cutoff, conservative)
|
sub.graph |
An igraph-formatted network. |
cutoff |
The proportion of interactions a species needs to have won in order to be considered the winner. |
conservative |
TRUE or FALSE. Whether a tied interaction is set to a bidirectional edge or the edges are removed entirely. |
Takes a network and simplifies it according to a specified cutoff/threshold. Specifically, it checks for parallel edges between each species combination. If they exist, it calculates what proportion of interactions are A->B, and what proportion are B->A. If either of these proportions are at or above the cutoff, it sets that edge to 1, and the other edge to 0. If neither proportion is above the threshold, then it either sets both edges to 0, or both 1, depending on whether conservative is set to TRUE or FALSE.
A simplified/thresholded igraph network.
Miller, E. T., D. N. Bonter, C. Eldermire, B. G. Freeman, E. I. Greig, L. J. Harmon, C. Lisle, and W. M. Hochachka. 2017. Fighting over food unites the birds of North America in a continental dominance hierarchy. biorxiv https://doi.org/10.1101/104133
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #load in the example data
data(exInput)
#subset to interactions between three species.
three <- c("Red-breasted Nuthatch","Downy Woodpecker","White-breasted Nuthatch")
small <- exInput[exInput$source %in% three & exInput$target %in% three,]
#convert into igraph network
complexNetwork <- igraph::graph.data.frame(small)
#plot to see what it looks like
plot(complexNetwork)
#simplify with a 50% conservative threshold
simpleNetwork <- networkSimplifier(complexNetwork, 0.5, TRUE)
#plot to see what it looks like
plot(simpleNetwork)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.