Note: Development of this package has been discontinued. A convenient, elegant, and compact R package for analyzing simplicial complexes can be found in Matt Piekenbrock’s simplextree.
sc is a convenience package for encoding simplicial complexes in R as bipartite graphs using the igraph package. It is intended for temporary use, until superior functionality and perforance are achieved by other medium-level packages, for example an R interface to the GUDHI C++ library — or until i become aware of them!
Install the package from GitHub using the remotes package:
remotes::install_github("corybrunson/sc")
A popular illustration from Wikimedia Commons provides an illustration:
library(sc)
#> Loading required package: igraph
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
# load data
data(wiki_sc)
# inspection and visualization
print(wiki_sc)
#> # A simplicial complex of 12 faces on 18 vertices
#> #
#> # Vertex data: 18 x 2
#> .id name
#> <int> <chr>
#> 1 1 1
#> 2 2 3
#> 3 3 4
#> 4 4 2
#> 5 5 5
#> # … with 13 more rows
#> #
#> # Face data: 12 x 2
#> .id name
#> <int> <chr>
#> 1 19 a
#> 2 20 b
#> 3 21 c
#> 4 22 d
#> 5 23 e
#> # … with 7 more rows
plot(wiki_sc, vertex.label = NA)
# vertices and simplices
sc_vertices(wiki_sc)
#> + 18/30 vertices, named, from 734dc45:
#> [1] 1 3 4 2 5 6 7 8 9 10 11 12 13 14 15 16 17 18
sc_simplices(wiki_sc)
#> + 12/30 vertices, named, from 734dc45:
#> [1] a b c d e f g h i j k l
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.