nerve_complex: Generates the nerve complex of an open cover.

Description Usage Arguments Value Examples

View source: R/nerve_complex.R

Description

Takes the open cover of a finite set and returns its nerve complex. The output is a nerve complex that can be used by other functions in the RayleighSelection package. The orientation of simplices is based on the order of the points in the point cloud.

Usage

1
nerve_complex(open_cover)

Arguments

open_cover

a list of open sets with open_cover[[i]] a vector of indices of points corresponding to the i-th open set in the open cover.

Value

An object of the class simplicial. The class simplicial inherits from the class igraph.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Example 1
library(RayleighSelection)
gy <- nerve_complex(list(c(1,4,6,10), c(1,2,7), c(2,3,8), c(3,4,9,10), c(4,5)))
plot_skeleton(gy,k=c(0,1,1,0,0,0,0,0,0,1))


# Example 2: MNIST dataset
data("mnist")

# Compute reduced representation using Laplacian eigenmap of pixels with high variance
library(dimRed)
leim <- LaplacianEigenmaps()
mnist_top <- mnist[apply(mnist, 1, var) > 10000,]
emb <- leim@fun(as(t(mnist_top), "dimRedData"), leim@stdpars)

# Compute Mapper representation using the Laplacian eigenmap as an auxiliary function and correlation
# distance as metric
library(TDAmapper)
mnist_distances <- (1.0 - cor(mnist_top))
m2 <- mapper2D(distance_matrix = mnist_distances,
               filter_values = list(emb@data@data[,1], emb@data@data[,2]),
               num_intervals = c(30,30),
               percent_overlap = 35,
               num_bins_when_clustering = 10);

# Compute the nerve complex
gg <- nerve_complex(m2$points_in_vertex)

# Plots simplicial complex colored by the value of the 301th pixel
plot_skeleton(gg, k=mnist[301,])

CamaraLab/RayleighSelection documentation built on Aug. 16, 2021, 12:01 p.m.