Loading [MathJax]/extensions/TeX/AMSsymbols.js
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Cech_complex.h
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Vincent Rouvreau
4 *
5 * Copyright (C) 2018 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef CECH_COMPLEX_H_
12#define CECH_COMPLEX_H_
13
14#include <gudhi/distance_functions.h> // for Gudhi::Minimal_enclosing_ball_radius
15#include <gudhi/graph_simplicial_complex.h> // for Gudhi::Proximity_graph
16#include <gudhi/Debug_utils.h> // for GUDHI_CHECK
17#include <gudhi/Cech_complex_blocker.h> // for Gudhi::cech_complex::Cech_blocker
18
19#include <iostream>
20#include <stdexcept> // for exception management
21#include <vector>
22
23namespace Gudhi {
24
25namespace cech_complex {
26
43template <typename SimplicialComplexForProximityGraph, typename ForwardPointRange>
45 private:
46 // Required by compute_proximity_graph
47 using Vertex_handle = typename SimplicialComplexForProximityGraph::Vertex_handle;
48 using Filtration_value = typename SimplicialComplexForProximityGraph::Filtration_value;
50
51 // Retrieve Coordinate type from ForwardPointRange
52 using Point_from_range_iterator = typename boost::range_const_iterator<ForwardPointRange>::type;
53 using Point_from_range = typename std::iterator_traits<Point_from_range_iterator>::value_type;
54 using Coordinate_iterator = typename boost::range_const_iterator<Point_from_range>::type;
55 using Coordinate = typename std::iterator_traits<Coordinate_iterator>::value_type;
56
57 public:
58 // Point and Point_cloud type definition
59 using Point = std::vector<Coordinate>;
60 using Point_cloud = std::vector<Point>;
61
62 public:
71 Cech_complex(const ForwardPointRange& points, Filtration_value max_radius) : max_radius_(max_radius) {
72 // Point cloud deep copy
73 point_cloud_.reserve(boost::size(points));
74 for (auto&& point : points) point_cloud_.emplace_back(std::begin(point), std::end(point));
75
76 cech_skeleton_graph_ = Gudhi::compute_proximity_graph<SimplicialComplexForProximityGraph>(
77 point_cloud_, max_radius_, Gudhi::Minimal_enclosing_ball_radius());
78 }
79
88 template <typename SimplicialComplexForCechComplex>
89 void create_complex(SimplicialComplexForCechComplex& complex, int dim_max) {
90 GUDHI_CHECK(complex.num_vertices() == 0,
91 std::invalid_argument("Cech_complex::create_complex - simplicial complex is not empty"));
92
93 // insert the proximity graph in the simplicial complex
94 complex.insert_graph(cech_skeleton_graph_);
95 // expand the graph until dimension dim_max
96 complex.expansion_with_blockers(dim_max,
97 Cech_blocker<SimplicialComplexForCechComplex, Cech_complex>(&complex, this));
98 }
99
101 Filtration_value max_radius() const { return max_radius_; }
102
106 const Point& get_point(Vertex_handle vertex) const { return point_cloud_[vertex]; }
107
108 private:
109 Proximity_graph cech_skeleton_graph_;
110 Filtration_value max_radius_;
111 Point_cloud point_cloud_;
112};
113
114} // namespace cech_complex
115
116} // namespace Gudhi
117
118#endif // CECH_COMPLEX_H_
Compute the radius of the minimal enclosing ball between Points given by a range of coordinates....
Definition: distance_functions.h:64
Cech complex data structure.
Definition: Cech_complex.h:44
Cech_complex(const ForwardPointRange &points, Filtration_value max_radius)
Cech_complex constructor from a list of points.
Definition: Cech_complex.h:71
void create_complex(SimplicialComplexForCechComplex &complex, int dim_max)
Initializes the simplicial complex from the proximity graph and expands it until a given maximal dime...
Definition: Cech_complex.h:89
Filtration_value max_radius() const
Definition: Cech_complex.h:101
const Point & get_point(Vertex_handle vertex) const
Definition: Cech_complex.h:106
Global distance functions.
Graph simplicial complex methods.
typename boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property< vertex_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value >, boost::property< edge_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value > > Proximity_graph
Proximity_graph contains the vertices and edges with their filtration values in order to store the re...
Definition: graph_simplicial_complex.h:45
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
GUDHI  Version 3.5.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Thu Jan 13 2022 08:34:27 for GUDHI by Doxygen 1.9.2