vietoris_rips {ripserr}R Documentation

Calculate Persistent Homology of a Point Cloud

Description

Calculates the persistent homology of a point cloud, as represented by a Vietoris-Rips complex. This function is an R wrapper for Ulrich Bauer's Ripser C++ library for calculating persistent homology. For more information on the C++ library, see https://github.com/Ripser/ripser.

Usage

vietoris_rips(
  dataset,
  dim = 1,
  threshold = -1,
  p = 2L,
  format = "cloud",
  standardize = FALSE,
  return_format = "df"
)

Arguments

dataset

numeric matrix containing point cloud or distance matrix

dim

maximum dimension of features to calculate

threshold

maximum diameter for computation of Vietoris-Rips complexes

p

number of the prime field Z/pZ to compute the homology over

format

format of mat, either "cloud" for point cloud or "distmat" for distance matrix

standardize

boolean determining whether point cloud size should be standardized

return_format

defaults to "df", returning a data frame; if mat, returns a numeric matrix

Details

The mat parameter should be a numeric matrix with each row corresponding to a single point, and each column corresponding to a single dimension. Thus, if mat has 50 rows and 5 columns, it represents a point cloud with 50 points in 5 dimensions. The dim parameter should be a positive integer. Alternatively, the mat parameter could be a distance matrix (upper triangular half is ignored); note: format should be specified as "distmat".

Value

3-column matrix or data frame, with each row representing a TDA feature

Examples


# create a 2-d point cloud of a circle (100 points)
num.pts <- 100
rand.angle <- runif(num.pts, 0, 2*pi)
pt.cloud <- cbind(cos(rand.angle), sin(rand.angle))

# calculate persistent homology (num.pts by 3 numeric matrix)
pers.hom <- vietoris_rips(pt.cloud)

[Package ripserr version 0.1.1 Index]