View source: R/offspring-bulk.R
| offspring_bulk | R Documentation |
offspring() walks one subtree per call. Calling it once per node is
O(n^2): 1.3 s at 1000 tips and 3 s at 2000. This function computes the
descendants of every requested node in a single post-order pass, which is
about 50 times faster for that pattern.
offspring_bulk(tree, nodes = NULL, tips_only = FALSE)
tree |
a tree object: |
nodes |
node ids to compute descendants for. |
tips_only |
logical. If |
A named list, one element per node id. The descendants do not
include the node itself; add it with c(node, result[[node]]) if you
need it.
library(ape)
tr <- rtree(6)
x <- as_tibble(tr)
offspring_bulk(x, nodes = c(7, 8))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.