Learn R Programming

simplextree (version 1.0.1)

contract: Edge contraction

Description

Performs an edge contraction.

Usage

contract(st, edge)

Arguments

st

a simplex tree.

edge

an edge to contract, as a 2-length vector.

Details

This function performs an edge contraction in the sense described by (1), which is summarized here. Given an edge \( {va, vb}\), \(vb\) is contracted to \(va\) if \(vb\) is removed from the complex and the link of \(va\) is augmented with the link of \(vb\). This may be thought as applying the mapping: $$f(u) = va$$ if \(u = vb\) and identity otherwise, to all simplices in the complex. edge is not sorted prior to contraction: the second vertex of the edge is always contracted to the first. Note that edge contraction is not symmetric.

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.

Examples

Run this code
# NOT RUN {
st <- simplex_tree(1:3) 
st %>% print_simplices()
# 1, 2, 3, 1 2, 1 3, 2 3, 1 2 3
st %>% contract(c(1, 3)) %>% print_simplices()
# 1, 2, 1 2
# }

Run the code above in your browser using DataLab