|
template<class FilteredEdgeRange > |
auto | Gudhi::collapse::flag_complex_collapse_edges (const FilteredEdgeRange &edges) |
| Implicitly constructs a flag complex from edges as an input, collapses edges while preserving the persistent homology and returns the remaining edges as a range. The filtration value of vertices is irrelevant to this function. More...
|
|
- Author
- Siddharth Pritam and Marc Glisse
This module implements edge collapse of a filtered flag complex as described in [34], in particular it reduces a filtration of Vietoris-Rips complex represented by a graph to a smaller flag filtration with the same persistent homology.
Edge collapse definition
An edge in a simplicial complex is called a dominated edge if the link of in , is a simplicial cone, that is, there exists a vertex and a subcomplex in , such that . We say that the vertex dominates and is dominated by . An elementary edge collapse is the removal of a dominated edge from (the cofaces of are implicitly removed as well). Domination is used as a simple sufficient condition that ensures that this removal is a homotopy preserving operation.
The dominated edges can be easily characterized as follows:
– For a general simplicial complex: an edge is dominated by another vertex , if and only if all the maximal simplices of that contain also contain .
– For a flag complex: an edge is dominated by another vertex , if and only if all the vertices in that have an edge with both vertices of also have an edge with . Notice that this only depends on the graph.
In the context of a filtration, an edge collapse may translate into an increase of the filtration value of an edge, or its removal if it already had the largest filtration value. The algorithm to compute the smaller induced filtration is described in [34]. Edge collapse can be successfully employed to reduce any input filtration of flag complexes to a smaller induced filtration which preserves the persistent homology of the original filtration and is a flag complex as well.
The algorithm implemented here does not produce a minimal filtration. Taking its output and applying the algorithm a second time may further simplify the filtration.
Basic edge collapse
This example calls Gudhi::collapse::flag_complex_collapse_edges()
from a proximity graph represented as a list of Filtered_edge
. Then it collapses edges and displays a new list of Filtered_edge
(with fewer edges) that will preserve the persistence homology computation.
#include <gudhi/Flag_complex_edge_collapser.h>
#include <iostream>
#include <vector>
#include <tuple>
int main() {
using Filtered_edge = std::tuple<Vertex_handle, Vertex_handle, Filtration_value>;
using Filtered_edge_list = std::vector<Filtered_edge>;
Filtered_edge_list graph = {{0, 1, 1.},
{1, 2, 1.},
{2, 3, 1.},
{3, 0, 1.},
{0, 2, 2.},
{1, 3, 2.}};
for (auto filtered_edge_from_collapse : remaining_edges) {
std::cout << "fn[" << std::get<0>(filtered_edge_from_collapse) << ", " << std::get<1>(filtered_edge_from_collapse)
<< "] = " << std::get<2>(filtered_edge_from_collapse) << std::endl;
}
return 0;
}
auto flag_complex_collapse_edges(const FilteredEdgeRange &edges)
Implicitly constructs a flag complex from edges as an input, collapses edges while preserving the per...
Definition: Flag_complex_edge_collapser.h:329
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:15
When launching the example:
$> ./Edge_collapse_example_basic
the program output could be:
fn[0, 1] = 1
fn[1, 2] = 1
fn[2, 3] = 1
fn[3, 0] = 1
fn[0, 2] = 2
◆ flag_complex_collapse_edges()
template<class FilteredEdgeRange >
auto Gudhi::collapse::flag_complex_collapse_edges |
( |
const FilteredEdgeRange & |
edges | ) |
|
Implicitly constructs a flag complex from edges as an input, collapses edges while preserving the persistent homology and returns the remaining edges as a range. The filtration value of vertices is irrelevant to this function.
- Parameters
-
[in] | edges | Range of Filtered edges. There is no need for the range to be sorted, as it will be done internally. |
- Template Parameters
-
FilteredEdgeRange | Range of std::tuple<Vertex_handle, Vertex_handle, Filtration_value> where Vertex_handle is the type of a vertex index. |
- Returns
- Remaining edges after collapse as a range of
std::tuple<Vertex_handle, Vertex_handle, Filtration_value>
.
- Note
- Advanced: Defining the macro GUDHI_COLLAPSE_USE_DENSE_ARRAY tells gudhi to allocate a square table of size the maximum vertex index. This usually speeds up the computation for dense graphs. However, for sparse graphs, the memory use may be problematic and initializing this large table may be slow.
- Examples
- distance_matrix_edge_collapse_rips_persistence.cpp, edge_collapse_basic_example.cpp, edge_collapse_conserve_persistence.cpp, and point_cloud_edge_collapse_rips_persistence.cpp.