Loading...
Searching...
No Matches
example_sparse_rips.cpp
#include <gudhi/Sparse_rips_complex.h>
#include <gudhi/Simplex_tree.h>
#include <gudhi/distance_functions.h>
#include <iostream>
#include <vector>
int main() {
using Point = std::vector<double>;
using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
using Filtration_value = Simplex_tree::Filtration_value;
using Sparse_rips = Gudhi::rips_complex::Sparse_rips_complex<Filtration_value>;
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;
}
Gudhi::Euclidean_distance
Compute the Euclidean distance between two Points given by a range of coordinates....
Definition distance_functions.h:32
Gudhi::Simplex_tree
Simplex Tree data structure for representing simplicial complexes.
Definition Simplex_tree.h:98
Gudhi::Simplex_tree< Gudhi::Simplex_tree_options_fast_persistence >::Filtration_value
Options::Filtration_value Filtration_value
Definition Simplex_tree.h:105
Gudhi::Simplex_tree::num_vertices
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition Simplex_tree.h:778
Gudhi::Simplex_tree::num_simplices
size_t num_simplices() const
Returns the number of simplices in the simplex_tree.
Definition Simplex_tree.h:791
Gudhi::rips_complex::Sparse_rips_complex
Sparse Rips complex data structure.
Definition Sparse_rips_complex.h:104
Gudhi::rips_complex::Sparse_rips_complex::create_complex
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
distance_functions.h
Global distance functions.