-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hello! I use this package frequently, including as a dependency for others, and am very grateful for its maintenance.
Something pointed out to me years ago, and still noted on this worksheet by a colleague is that the alpha filtration–based engine alphaComplexDiag()
returns birth–death pairs that are squared from their associated radii. I understand that the squaring might done internally for efficiency, as in GUDHI. But it seems like the output should be in terms of the original distance. (Please see the example below, adjusted for the squaring but also to convert radii to ball diameters so that the outputs match.)
Thanks for any explanation or action! I'd be happy to submit a pull request if helpful.
library(TDA)
# regular pentagon
t <- seq(0, 4) * pi*2/5
x <- cbind(cos(t), sin(t))
# PH via Vietoris-Rips filtration
ph_r <- ripsDiag(x, maxdimension = 2, maxscale = 2)
# PH via alpha filtration
ph_a <- alphaComplexDiag(x, maxdimension = 1)
# Rips output in radii
ph_r$diagram[, seq(2,3)] <- ph_r$diagram[, seq(2,3)] / 2
print(ph_r)
#> $diagram
#> dimension Birth Death
#> [1,] 0 0.0000000 1.0000000
#> [2,] 0 0.0000000 0.5877853
#> [3,] 0 0.0000000 0.5877853
#> [4,] 0 0.0000000 0.5877853
#> [5,] 0 0.0000000 0.5877853
#> [6,] 1 0.5877853 0.9510565
# raw alpha output
print(ph_a)
#> $diagram
#> dimension Birth Death
#> [1,] 0 0.0000000 Inf
#> [2,] 0 0.0000000 0.3454915
#> [3,] 0 0.0000000 0.3454915
#> [4,] 0 0.0000000 0.3454915
#> [5,] 0 0.0000000 0.3454915
#> [6,] 1 0.3454915 1.0000000
# alpha output transformed to radii
ph_a$diagram[, seq(2,3)] <- sqrt( ph_a$diagram[, seq(2,3)] )
print(ph_a)
#> $diagram
#> dimension Birth Death
#> [1,] 0 0.0000000 Inf
#> [2,] 0 0.0000000 0.5877853
#> [3,] 0 0.0000000 0.5877853
#> [4,] 0 0.0000000 0.5877853
#> [5,] 0 0.0000000 0.5877853
#> [6,] 1 0.5877853 1.0000000
Created on 2025-01-27 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels