example_sparse_rips.cpp
#include <gudhi/Sparse_rips_complex.h>
#include <gudhi/Simplex_tree.h>
#include <iostream>
#include <vector>
int main() {
using Point = std::vector<double>;
Point points[] = {{1.0, 1.0}, {7.0, 0.0}, {4.0, 6.0}, {9.0, 6.0}, {0.0, 14.0}, {2.0, 19.0}, {9.0, 17.0}};
// ----------------------------------------------------------------------------
// Init from Euclidean points
// ----------------------------------------------------------------------------
double epsilon = 2; // very rough, no guarantees
Sparse_rips sparse_rips(points, Gudhi::Euclidean_distance(), epsilon);
Simplex_tree stree;
sparse_rips.create_complex(stree, 10);
// ----------------------------------------------------------------------------
// Display information about the complex
// ----------------------------------------------------------------------------
std::clog << "Sparse Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices()
<< " simplices - " << stree.num_vertices() << " vertices." << std::endl;
}
Compute the Euclidean distance between two Points given by a range of coordinates....
Definition: distance_functions.h:32
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition: Simplex_tree.h:102
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition: Simplex_tree.h:651
size_t num_simplices()
Returns the number of simplices in the simplex_tree.
Definition: Simplex_tree.h:664
Sparse Rips complex data structure.
Definition: Sparse_rips_complex.h:104
void create_complex(SimplicialComplexForRips &complex, int const dim_max)
Fills the simplicial complex with the sparse Rips graph and expands it with all the cliques,...
Definition: Sparse_rips_complex.h:158
Global distance functions.
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20