Rips_complex_interface.h
1 /* This file is part of the Gudhi Library. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author(s): Vincent Rouvreau
6  *
7  * Copyright (C) 2016 Inria
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef INCLUDE_RIPS_COMPLEX_INTERFACE_H_
24 #define INCLUDE_RIPS_COMPLEX_INTERFACE_H_
25 
26 #include <gudhi/Simplex_tree.h>
27 #include <gudhi/Rips_complex.h>
29 
30 #include "Simplex_tree_interface.h"
31 
32 #include <iostream>
33 #include <vector>
34 #include <utility> // std::pair
35 #include <string>
36 
37 namespace Gudhi {
38 
39 namespace rips_complex {
40 
41 class Rips_complex_interface {
42  using Point_d = std::vector<double>;
43  using Distance_matrix = std::vector<std::vector<Simplex_tree_interface<>::Filtration_value>>;
44 
45  public:
46  Rips_complex_interface(const std::vector<std::vector<double>>& values, double threshold, bool euclidean) {
47  if (euclidean) {
48  // Rips construction where values is a vector of points
49  rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(values, threshold,
51  } else {
52  // Rips construction where values is a distance matrix
53  rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(values, threshold);
54  }
55  }
56 
57  ~Rips_complex_interface() {
58  delete rips_complex_;
59  }
60 
61  void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, int dim_max) {
62  rips_complex_->create_complex(*simplex_tree, dim_max);
63  simplex_tree->initialize_filtration();
64  }
65 
66  private:
68 };
69 
70 } // namespace rips_complex
71 
72 } // namespace Gudhi
73 
74 #endif // INCLUDE_RIPS_COMPLEX_INTERFACE_H_
void create_complex(SimplicialComplexForRips &complex, int dim_max)
Initializes the simplicial complex from the Rips graph and expands it until a given maximal dimension...
Definition: Rips_complex.h:113
Compute the Euclidean distance between two Points given by a range of coordinates. The points are assumed to have the same dimension.
Definition: distance_functions.h:46
Definition: SimplicialComplexForAlpha.h:26
Rips complex data structure.
Definition: Rips_complex.h:57
Global distance functions.
GUDHI  Version 2.2.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Tue Jul 17 2018 12:56:28 for GUDHI by Doxygen 1.8.13