Barcode with Vietoris Rips Filtration

179 views Asked by At

I want to get the barcode of a dataset with Vietoris Rips filtration, as you know from this filtration where the connections are made as the radius increases, the barcode first starts with the isolated points, in this case it is 10 , but it should also create bars for the "gaps" created by the radius increment, if I explain myself? because here this code only plots the initial points until they "die" or connect, but it doesn't plot the bars of the holes created when the radius increases.

import numpy as np
import gudhi
import matplotlib.pyplot as plt

data = np.array([[5.1, 3.5], [4.9, 3], [4.7, 3.2], [4.6, 3.1], [5., 3.6], [5.4, 3.9], [4.6, 3.4], [5., 3.4], [4.4, 2.9], [4.9, 3.1]])

# Crear el complejo de Vietoris-Rips
rips_complex = gudhi.RipsComplex(points=data)

simplex_tree = rips_complex.create_simplex_tree()

# Obtener el código de barras
barcode = simplex_tree.persistence()

# Graficar el código de barras
gudhi.plot_persistence_barcode(barcode)
plt.show()

enter image description here

In the image is the result of the code but it is not what I want, I would like to see the bars where the gaps are closed and then they are closed.

1

There are 1 answers

0
Marc Glisse On

In other words, by default, you are only getting H0 (homology of dimension 0, i.e. connected components), and you would like to get also H1 (i.e. loops), and maybe H2, etc. Several aspects are relevant.

  1. When calling create_simplex_tree, you can specify up to what dimension you want to construct cliques with max_dimension. By default it stops at dimension 1 (edges) and does not create any triangle.

  2. With a simplicial complex of dimension d, by default persistence only computes homology in dimension up to d-1. You can change that with persistence_dim_max, although the default was set precisely because it is sensible for the Rips.

  3. The Rips filtration of your point set indeed has no persistent feature in dimension other than 0.

  4. In dimension 2, using an AlphaComplex usually makes more sense than RipsComplex. And the alpha-complex filtration of your points indeed has a few H1 persistent features. (diagram)