Description Usage Arguments Details Value Examples
Traverses specific subsets of a simplicial complex.
1 2 3 4 5 |
traversal |
the type of traversal. |
f |
the function to apply to each simplex. |
... |
unused. |
traverse
allows for traversing ordered subsets of the simplex tree.
The specific subset and order are determined by the choice of traversal: examples include
the preorder
traversal, the cofaces
traversal, etc. See the links below.
Each simplex in the traversal is passed as the first and only argument to f
, one per simplex in the traversal.
traverse
does nothing with the result; if you want to collect the results of applying f
to each simplex
into a list, use ltraverse
(or straverse
), which are meant to be used like lapply
and sapply
, respectively.
NULL; for list or vector-valued returns, use ltraverse
and straverse
respectively.
1 2 3 4 5 6 7 8 9 | ## Starter example complex
st <- simplex_tree()
st %>% insert(list(1:3, 2:5))
## Print out complex using depth-first traversal.
st %>% preorder() %>% traverse(print)
## Collect the last labels of each simplex in the tree.
last_labels <- st %>% preorder() %>% straverse(function(simplex){ tail(simplex, 1) })
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.