diagRips: Compute Vietoris-Rips Complex for Persistent Homology

Description Usage Arguments Value References See Also Examples

View source: R/homology_diagRips.R

Description

diagRips computes the persistent diagram of the Vietoris-Rips filtration constructed on a point cloud represented as matrix or dist object. This function is a second-hand wrapper to TDAstats's wrapping for Ripser library.

Usage

1
diagRips(data, maxdim = 1, threshold = Inf)

Arguments

data

a 'matrix' or a S3 'dist' object.

maxdim

maximum dimension of the computed homological features (default: 1).

threshold

maximum value of the filtration (default: Inf).

Value

a dataframe object of S3 class "homology" with following columns

Dimension

dimension corresponding to a feature.

Birth

birth of a feature.

Death

death of a feature.

References

\insertRef

wadhwa_tdastats_2018TDAkit

Ulrich Bauer (2019). “Ripser: Efficient Computation of Vietoris-Rips Persistence Barcodes.” arXiv:1908.02518.

See Also

calculate_homology

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# ---------------------------------------------------------------------------
# Check consistency of two types of inputs : 'matrix' and 'dist' objects
# ---------------------------------------------------------------------------
# Use 'iris' data and compute its distance matrix
XX = as.matrix(iris[,1:4])
DX = stats::dist(XX)

# Compute VR Diagram with two inputs
vr.mat = diagRips(XX)
vr.dis = diagRips(DX)

col1 = as.factor(vr.mat$Dimension)
col2 = as.factor(vr.dis$Dimension)

# Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
plot(vr.mat$Birth, vr.mat$Death, pch=19, col=col1, main="from 'matrix'")
plot(vr.dis$Birth, vr.dis$Death, pch=19, col=col2, main="from 'dist'")
par(opar)

kyoustat/TDAkit documentation built on Sept. 1, 2021, 7:22 a.m.