reindex: reindexes vertex ids

Description Usage Arguments Details Examples

View source: R/simplex_tree.R

Description

This function allows one to 'reorder' or 'reindex' vertex ids.

Usage

1
reindex(st, ids)

Arguments

st

a simplex tree.

ids

vector of new vertex ids. See details.

Details

The ids parameter must be a sorted integer vector of new ids with length matching the number of vertices. The simplex tree is modified to replace the vertex label at index i with ids[i]. See examples.

Examples

1
2
3
4
5
6
7
8
9
st <- simplex_tree()
st %>% insert(1:3) %>% print_simplices("tree")
# 1 (h = 2): .( 2 3 )..( 3 )
# 2 (h = 1): .( 3 )
# 3 (h = 0):
st %>% reindex(4:6) %>% print_simplices("tree")
# 4 (h = 2): .( 5 6 )..( 6 )
# 5 (h = 1): .( 6 )
# 6 (h = 0):

simplextree documentation built on Sept. 13, 2020, 5:06 p.m.