collapse: Elementary collapse

Description Usage Arguments Details Value References Examples

View source: R/simplex_tree.R

Description

Performs an elementary collapse.

Usage

1
collapse(st, pair, w = NULL)

Arguments

st

a simplex tree.

pair

list of simplices to collapse.

w

vertex to collapse to, if performing a vertex collapse.

Details

This function provides two types of elementary collapses.

The first type of collapse is in the sense described by (1), which is summarized here. A simplex σ is said to be collapsible through one of its faces τ if σ is the only coface of τ (excluding τ itself). This function checks whether its possible to collapse σ through τ, (if τ has σ as its only coface), and if so, both simplices are removed. tau and sigma are sorted before comparison. To perform this kind of elementary collapse, call collapse with two simplices as arguments, i.e. tau before sigma.

Alternatively, this method supports another type of elementary collapse, also called a vertex collapse, as described in (2). This type of collapse maps a pair of vertices into a single vertex. To use this collapse, specify three vertex ids, the first two representing the free pair, and the last representing the target vertex to collapse to.

Value

boolean indicating whether the collapse was performed.

References

1. Boissonnat, Jean-Daniel, and Clement Maria. "The simplex tree: An efficient data structure for general simplicial complexes." Algorithmica 70.3 (2014): 406-427.

2. Dey, Tamal K., Fengtao Fan, and Yusu Wang. "Computing topological persistence for simplicial maps." Proceedings of the thirtieth annual symposium on Computational geometry. ACM, 2014.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
st <- simplextree::simplex_tree(1:3)
st %>% print_simplices()
# 1, 2, 3, 1 2, 1 3, 2 3, 1 2 3
st %>% collapse(list(1:2, 1:3))
# 1, 2, 3, 1 3, 2 3=

st %>% insert(list(1:3, 2:5))
st %>% print_simplices("column")
# 1 2 3 4 5 1 1 2 2 2 3 3 4 1 2 2 2 3 2
#           2 3 3 4 5 4 5 5 2 3 3 4 4 3
#                           3 4 5 5 5 4
#                                     5

st %>% collapse(list(2:4, 2:5))
st %>% print_simplices("column") 
# 1 2 3 4 5 1 1 2 2 2 3 3 4 1 2 2 3
#           2 3 3 4 5 4 5 5 2 3 4 4
#                           3 5 5 5

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