11 #ifndef RIPS_COMPLEX_H_    12 #define RIPS_COMPLEX_H_    14 #include <gudhi/Debug_utils.h>    15 #include <gudhi/graph_simplicial_complex.h>    17 #include <boost/graph/adjacency_list.hpp>    29 namespace rips_complex {
    44 template<
typename Filtration_value>
    50   typedef typename boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS
    51   , boost::property < vertex_filtration_t, Filtration_value >
    55   typedef int Vertex_handle;
    70   template<
typename ForwardPo
intRange, 
typename Distance >
    72     compute_proximity_graph(points, threshold, distance);
    84   template<
typename DistanceMatrix>
    86     compute_proximity_graph(boost::irange((
size_t)0, distance_matrix.size()), threshold,
    87                             [&](
size_t i, 
size_t j){
return distance_matrix[j][i];});
   100   template <
typename SimplicialComplexForRips>
   103                 std::invalid_argument(
"Rips_complex::create_complex - simplicial complex is not empty"));
   123   template< 
typename ForwardPo
intRange, 
typename Distance >
   124   void compute_proximity_graph(
const ForwardPointRange& points, 
Filtration_value threshold,
   126     std::vector< std::pair< Vertex_handle, Vertex_handle > > edges;
   127     std::vector< Filtration_value > edges_fil;
   134     Vertex_handle idx_u = 0;
   135     for (
auto it_u = std::begin(points); it_u != std::end(points); ++it_u, ++idx_u) {
   136       Vertex_handle idx_v = idx_u + 1;
   137       for (
auto it_v = it_u + 1; it_v != std::end(points); ++it_v, ++idx_v) {
   139         if (fil <= threshold) {
   140           edges.emplace_back(idx_u, idx_v);
   141           edges_fil.push_back(fil);
   152     rips_skeleton_graph_.~OneSkeletonGraph();
   153     new(&rips_skeleton_graph_)
OneSkeletonGraph(edges.begin(), edges.end(), edges_fil.begin(), idx_u);
   155     auto vertex_prop = boost::get(vertex_filtration_t(), rips_skeleton_graph_);
   157     using vertex_iterator = 
typename boost::graph_traits<OneSkeletonGraph>::vertex_iterator;
   158     vertex_iterator vi, vi_end;
   159     for (std::tie(vi, vi_end) = boost::vertices(rips_skeleton_graph_);
   160          vi != vi_end; ++vi) {
   161       boost::put(vertex_prop, *vi, 0.);
   166   OneSkeletonGraph rips_skeleton_graph_;
   173 #endif  // RIPS_COMPLEX_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:101
 
Rips_complex(const DistanceMatrix &distance_matrix, Filtration_value threshold)
Rips_complex constructor from a distance matrix. 
Definition: Rips_complex.h:85
 
void expansion(int max_dim)
Expands the simplicial complex containing only its one skeleton until a given maximal dimension as ex...
 
void insert_graph(const OneSkeletonGraph &skel_graph)
Inserts a given Gudhi::rips_complex::Rips_complex::OneSkeletonGraph in the simplicial complex...
 
The concept SimplicialComplexForRips describes the requirements for a type to implement a simplicial ...
Definition: SimplicialComplexForRips.h:21
 
Definition: SimplicialComplexForAlpha.h:14
 
Rips complex data structure. 
Definition: Rips_complex.h:45
 
Value type for a filtration function on a cell complex. 
Definition: FiltrationValue.h:20
 
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property< vertex_filtration_t, Filtration_value >, boost::property< edge_filtration_t, Filtration_value > > OneSkeletonGraph
Type of the one skeleton graph stored inside the Rips complex structure. 
Definition: Rips_complex.h:52
 
std::size_t num_vertices()
Returns the number of vertices in the simplicial complex. 
 
Rips_complex(const ForwardPointRange &points, Filtration_value threshold, Distance distance)
Rips_complex constructor from a list of points. 
Definition: Rips_complex.h:71