vr_complex: Generates a Vietoris-Rips complex from a distance matrix.

Description Usage Arguments Value Examples

View source: R/vr_complex.R

Description

Takes a distance matrix and returns its Vietoris-Rips complex at a given level. The output is a clique complex that can be used by other functions in the RayleighSelection package.

Usage

1
vr_complex(dist, epsilon, clique = TRUE)

Arguments

dist

a distance matrix.

epsilon

filtration distance at which the complex is generated

clique

if set to FALSE the computation of 2-simplices is skipped.

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
library(RayleighSelection)
# Load MNIST example dataset
data("mnist")

# Compute a distance matrix for a subset of the MNIST dataset using only pixels with high variance
mnist_test <- mnist[,1:800]
mnist_test_top <- mnist_test[apply(mnist_test, 1, var) > 0.9,]
mnist_test_distances <- (1.0 - cor(mnist_test_top))

# Compute Vietoris-Rips complex at filtration distance 0.5
gg <- vr_complex(mnist_test_distances, 0.5)

# Plot the skeleton of the Vietoris-Rips complex colored by the intensity of the 500th pixel
plot_skeleton(gg, k=as.numeric(mnist_test[500,]))

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