Learn R Programming

SimplicialComplex (version 0.1.0)

faces: Generate all unique faces of a given dimension from simplices

Description

Generate all unique faces of a given dimension from simplices

Usage

faces(simplices, target_dim)

Value

A list of faces (each a numeric vector) of dimension target_dim.

Arguments

simplices

A list of simplices (each a numeric vector).

target_dim

The target dimension \(k\) for the faces (e.g., 0 for vertices, 1 for edges, etc.).

Details

The function generates all possible subsets (combinations) of each simplex, removes duplicates, and filters them to only include those of length target_dim + 1.

For example, a 2-simplex c(1, 2, 3) has three 1-dimensional faces (edges): c(1,2), c(1,3), and c(2,3), and three 0-dimensional faces (vertices): 1, 2, and 3.

Examples

Run this code
simplices <- list(c(1, 2), c(3, 4), c(2, 1, 3), c(4, 2))
faces(simplices, target_dim=0)

Run the code above in your browser using DataLab