Topics

How to know which points form some bar code

zhanghon@...
 

Hi,

 

For a bar code, is it possible to know which points form this bar code? For example, if I use a distance matrix to create a filtration and then a reduced matrix, then I generate the bar code graph for the first dimension. If I have a bar code that lasts for an interval [a, b) in the first dimension, could I know which data points form this loop (a 1-dimensional bar code represents a loop)? Could I know the indices of the points in the distance matrix?

 

Thank you,

 

Hongyuan

Dmitriy Morozov
 

It's not possible to pick a unique 1-cycle; there are many cycles in a homology class. But it's possible to extract one of them, the one that the matrix reduction chose as a representative. Each column in the reduced matrix represents such a cycle, so you could pick the one that corresponds to the point of the persistence diagram you are interested in. From the documentation:

 >>> m = d.homology_persistence(f)
 >>> for i,c in enumerate(m):
 ...     print(i, c)
 0
 1
 2 1*0 + 1*1
 3
 4 1*1 + 1*3
 5

The 1*1 + 1*3 is one such cycle. You could iterate over it, and use the indices (1 and 3 in this case) to access the corresponding simplices in the filtration.

Dmitriy 

On Tue, Jul 24, 2018 at 11:08 AM, Hongyuan <zhanghon@...> wrote:

Hi,

 

For a bar code, is it possible to know which points form this bar code? For example, if I use a distance matrix to create a filtration and then a reduced matrix, then I generate the bar code graph for the first dimension. If I have a bar code that lasts for an interval [a, b) in the first dimension, could I know which data points form this loop (a 1-dimensional bar code represents a loop)? Could I know the indices of the points in the distance matrix?

 

Thank you,

 

Hongyuan


nchristianson@...
 

Is there any way of determining whether two cycles belong to the same homology class? For example, suppose I have some sequence f_1 -> f_2 (where f1 is a subcomplex of f2) and I run zigzag persistence on the filtration f_1 -> f_2, as well as f_2 <- f_1 (by adjusting times accordingly). In some cases, when there is a persistent cycle, the representative cycle that is output is different, based on the ordering of the sequence. Is there some way to computationally check whether two cycles are in the same homology class, relative to a complex? (say, within f_2)

Dmitriy Morozov
 

The functionality is there, but it's not exposed to Python. Can you file this as an issue on GitHub? It's been requested before, and I should really add it to the Python bindings.

On Thu, Jul 26, 2018 at 12:23 PM, <nchristianson@...> wrote:
Is there any way of determining whether two cycles belong to the same homology class? For example, suppose I have some sequence f_1 -> f_2 (where f1 is a subcomplex of f2) and I run zigzag persistence on the filtration f_1 -> f_2, as well as f_2 <- f_1 (by adjusting times accordingly). In some cases, when there is a persistent cycle, the representative cycle that is output is different, based on the ordering of the sequence. Is there some way to computationally check whether two cycles are in the same homology class, relative to a complex? (say, within f_2)


nchristianson@...
 

Done - out of curiosity, where within the codebase is this functionality?

Dmitriy Morozov
 

Thanks. Given two cycles z1 and z2, to decide if they are homologous, you need to check if (z1 - z2) is a boundary. If you have a ReducedMatrix m (from include/dionysus/reduced-matrix.h), you can check if a cycle is a boundary, by checking if m.reduce(z) == m.unpaired(). To compute the difference, (z1 - z2), you need Chain<...>::addto(...) (from include/dionysus/chain.h).

On Thu, Jul 26, 2018 at 3:48 PM, <nchristianson@...> wrote:
Done - out of curiosity, where within the codebase is this functionality?


nchristianson@...
 

I'm not super familiar with C++ (and not at all with PyBind), so I haven't quite been able to figure out how to implement this. Do you have any idea when this might be exposed to Python?