All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions > Class Template Reference

Class computing the zigzag persistent homology of a zigzag filtration. Algorithm based on [41]. More...

#include <include/gudhi/filtered_zigzag_persistence.h>

Public Types

using Options = FilteredZigzagOptions
 
using Internal_key = typename Options::Internal_key
 
using Cell_key = typename Options::Cell_key
 
using Filtration_value = typename Options::Filtration_value
 
using Dimension = typename Options::Dimension
 

Public Member Functions

template<typename F >
 Filtered_zigzag_persistence (F &&stream_interval, unsigned int preallocationSize=0)
 Constructor. More...
 
template<class BoundaryRange = std::initializer_list<Cell_key>>
Internal_key insert_cell (Cell_key cellID, const BoundaryRange &boundary, Dimension dimension, Filtration_value filtrationValue)
 Updates the zigzag persistence diagram after the insertion of the given cell. More...
 
Internal_key remove_cell (Cell_key cellID, Filtration_value filtrationValue)
 Updates the zigzag persistence diagram after the removal of the given cell. preallocationSize. More...
 
Internal_key apply_identity ()
 To use when a cell is neither inserted nor removed, but the filtration moves along the identity operator on homology level. Useful to keep the birth/death indices aligned when insertions/removals are purposely skipped to avoid useless computation.
 
template<typename F >
void get_current_infinite_intervals (F &&stream_infinite_interval)
 Outputs through the given callback method all current infinite bars. More...
 

Detailed Description

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
class Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >

Class computing the zigzag persistent homology of a zigzag filtration. Algorithm based on [41].

After construction of the class, the zigzag filtration should be given in a streaming like way, i.e., call insert_cell, remove_cell or apply_identity for each step of the filtration in order of the filtration. The bars of the diagram are retrieved via the given callback method every time a pair with non-zero length is closed. To retrieve the open/infinite bars, use get_current_infinite_intervals.

Minimalistic example of usage

Includes

Contains the implementation of the Gudhi::zigzag_persistence::Default_filtered_zigzag_options structu...

Useful aliases

using filtration_value_type = Filtered_zigzag_persistence::Filtration_value;
Class computing the zigzag persistent homology of a zigzag filtration. Algorithm based on .
Definition: filtered_zigzag_persistence.h:442
typename Options::Filtration_value Filtration_value
Definition: filtered_zigzag_persistence.h:447
typename Options::Dimension Dimension
Definition: filtered_zigzag_persistence.h:448
Filtered_zigzag_persistence(F &&stream_interval, unsigned int preallocationSize=0)
Constructor.
Definition: filtered_zigzag_persistence.h:468

Construction with default values

//Filtered_zigzag_persistence(callback) with for example callback method as a anonymous lambda
Filtered_zigzag_persistence zp([](Dimension dim, filtration_value_type birth, filtration_value_type death) {
std::cout << "[" << dim << "] " << birth << " - " << death << std::endl;
});

Input of the zigzag sequence/filtration

// In all cases, it is important that the operations of insertions and removals are made **in the same order**
// as in the zigzag filtration ones wants to compute the barcode from.
// A cell can be identified in the boundaries by any given numerical label, it is just important that the given
// filtration values are monotonous (ie., either only increasing or only decreasing).
//inserts vertex 2 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_cell(2, {}, 0, 0.1);
//inserts vertex 4 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_cell(4, {}, 0, 0.1);
//inserts edge 5 = (2,4) at filtration value 0.3 -> death at 0.3 -> outputs/stores (0, 0.1, 0.3)
zp.insert_cell(5, {2, 4}, 1, 0.3);
//inserts vertex 3 at filtration value 0.4 -> birth at 0.4 of 0-cycle
zp.insert_cell(3, {}, 0, 0.4);
//inserts edge 6 = (2,3) at filtration value 0.4 -> death at 0.4 of the cycle born at 0.4 -> outputs/stores nothing
zp.insert_cell(6, {2, 3}, 1, 0.4);
//inserts edge 9 = (3,4) at filtration value 1.2 -> birth at 1.2 of 1-cycle
zp.insert_cell(9, {4, 3}, 1, 1.2);
//removes edge 6 at filtration value 1.5 -> death at 1.5 -> outputs/stores (1, 1.2, 1.5)
zp.remove_cell(6, 1.5);
//removes edge 5 at filtration value 2.0 -> birth at 2.0 of 0-cycle
zp.remove_cell(5, 2.0);

Finalizations

// Only the closed bars where output so far, so the open/infinite bars still need to be retrieved.
//in this example, outputs (0, 0.1) and (0, 2.0)
zp.get_current_infinite_intervals([](Dimension dim, filtration_value_type birth){
std::cout << "[" << dim << "] " << birth << " - inf" << std::endl;
});
Template Parameters
FilteredZigzagOptionsStructure following the FilteredZigzagOptions concept. Default value: Default_filtered_zigzag_options.
Examples
example_usage_filtered_zigzag_persistence.cpp, example_usage_filtered_zigzag_persistence_with_storage.cpp, example_usage_zigzag_persistence.cpp, and example_zzfiltration_from_file.cpp.

Member Typedef Documentation

◆ Cell_key

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
using Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::Cell_key = typename Options::Cell_key

Cell ID type from external inputs.

◆ Dimension

◆ Filtration_value

◆ Internal_key

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
using Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::Internal_key = typename Options::Internal_key

Key and index type, has to be signed.

◆ Options

Zigzag options.

Constructor & Destructor Documentation

◆ Filtered_zigzag_persistence()

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
template<typename F >
Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::Filtered_zigzag_persistence ( F &&  stream_interval,
unsigned int  preallocationSize = 0 
)
inline

Constructor.

After construction of the class, the zigzag filtration should be given in a streaming like way, i.e., call insert_cell, remove_cell or apply_identity for each step of the filtration in order of the filtration. The bars of the diagram are retrieved via the given callback method every time a pair with non-zero length is closed. To retrieve the open/infinite bars, use get_current_infinite_intervals.

Parameters
stream_intervalCallback method to process the birth and death values of a persistence bar. Has to take three arguments as input: first the dimension of the cycle, then the birth value of the cycle and third the death value of the cycle. The values corresponds to the filtration values which were given at insertions or removals. Note that bars of length 0 will not be token into account.
preallocationSizeReserves space for preallocationSize cells in the internal data structure. This is optional and just helps skip a few reallocations. The optimal value (no reallocation, no wasted space) is the number of cells in the biggest complex of the filtration. Default value: 0.
Template Parameters
FType of callback method.

Member Function Documentation

◆ get_current_infinite_intervals()

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
template<typename F >
void Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::get_current_infinite_intervals ( F &&  stream_infinite_interval)
inline

Outputs through the given callback method all current infinite bars.

Template Parameters
FType of the callback method. Takes two arguments: the dimension of the cycle and the birth value of the cycle.
Parameters
stream_infinite_intervalMethod processing the unpaired birth values.

◆ insert_cell()

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
template<class BoundaryRange = std::initializer_list<Cell_key>>
Internal_key Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::insert_cell ( Cell_key  cellID,
const BoundaryRange &  boundary,
Dimension  dimension,
Filtration_value  filtrationValue 
)
inline

Updates the zigzag persistence diagram after the insertion of the given cell.

Template Parameters
BoundaryRangeRange type needing size, begin and end members.
Parameters
cellIDID representing the inserted cell.
boundaryBoundary of the inserted cell. The range should be composed of the IDs of all cells contained in the boundary (i.e. with non-zero coefficients), using the ID specified as cellID when the corresponding cell was previously inserted (recall that the cells should be inserted in order of filtration).
dimensionDimension of the inserted cell.
filtrationValueFiltration value associated to the cell. Assumed to be always larger or equal to previously used filtration values or always smaller or equal than previous values, ie. the changes are monotonous.
Examples
example_usage_filtered_zigzag_persistence.cpp, example_usage_filtered_zigzag_persistence_with_storage.cpp, and example_usage_zigzag_persistence.cpp.

◆ remove_cell()

template<class FilteredZigzagOptions = Default_filtered_zigzag_options>
Internal_key Gudhi::zigzag_persistence::Filtered_zigzag_persistence< FilteredZigzagOptions >::remove_cell ( Cell_key  cellID,
Filtration_value  filtrationValue 
)
inline

Updates the zigzag persistence diagram after the removal of the given cell. preallocationSize.

Parameters
cellIDID representing the cell to remove. Should be the same than the one used to insert it.
filtrationValueFiltration value associated to the removal. Assumed to be always larger or equal to previously used filtration values or always smaller or equal than previous values, ie. the changes are monotonous.
Examples
example_usage_filtered_zigzag_persistence_with_storage.cpp.

The documentation for this class was generated from the following file: