
Last chance! 50% off unlimited learning
Sale ends in
Generates vertex ids representing 0-simplices not in the tree.
generate_ids(st, n)
a simplex tree.
the number of ids to generate.
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).
# NOT RUN {
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
# }
Run the code above in your browser using DataLab