generate_ids: Generates vertex ids.

Description Usage Arguments Details Examples

View source: R/simplex_tree.R

Description

Generates vertex ids representing 0-simplices not in the tree.

Usage

1
generate_ids(st, n)

Arguments

st

a simplex tree.

n

the number of ids to generate.

Details

This function generates new vertex ids for use in situations which involve generating new new 0-simplices, e.g. insertions, contractions, collapses, etc. There are two 'policies' which designate the generating mechanism of these ids: 'compressed' and 'unique'. 'compressed' generates vertex ids sequentially, starting at 0. 'unique' tracks an incremental internal counter, which is updated on every call to generate_ids. The new ids under the 'unique' policy generates the first sequential n ids that are strictly greater max(counter, max vertex id).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
st <- simplex_tree()
print(st$id_policy)
## "compressed"
st %>% generate_ids(3) 
## 0 1 2
st %>% generate_ids(3) 
## 0 1 2
st %>% insert(list(1,2,3))
print(st$vertices) 
## 1 2 3
st %>% insert(as.list(st %>% generate_ids(2)))
st %>% print_simplices() 
# 0, 1, 2, 3, 4
st %>% remove(4)
st %>% generate_ids(1) 
# 4

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