23 #ifndef GRAPH_SIMPLICIAL_COMPLEX_H_ 24 #define GRAPH_SIMPLICIAL_COMPLEX_H_ 26 #include <boost/graph/adjacency_list.hpp> 36 struct edge_filtration_t {
37 typedef boost::edge_property_tag kind;
41 struct vertex_filtration_t {
42 typedef boost::vertex_property_tag kind;
51 template <
typename SimplicialComplexForProximityGraph>
52 using Proximity_graph =
typename boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS
53 , boost::property < vertex_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value >
54 , boost::property < edge_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value >>;
66 template<
typename SimplicialComplexForProximityGraph
67 ,
typename ForwardPointRange
70 const ForwardPointRange& points,
71 typename SimplicialComplexForProximityGraph::Filtration_value threshold,
73 using Vertex_handle =
typename SimplicialComplexForProximityGraph::Vertex_handle;
74 using Filtration_value =
typename SimplicialComplexForProximityGraph::Filtration_value;
76 std::vector<std::pair< Vertex_handle, Vertex_handle >> edges;
77 std::vector< Filtration_value > edges_fil;
78 std::map< Vertex_handle, Filtration_value > vertices;
80 Vertex_handle idx_u, idx_v;
83 for (
auto it_u = points.begin(); it_u != points.end(); ++it_u) {
85 for (
auto it_v = it_u + 1; it_v != points.end(); ++it_v, ++idx_v) {
86 fil = distance(*it_u, *it_v);
87 if (fil <= threshold) {
88 edges.emplace_back(idx_u, idx_v);
89 edges_fil.push_back(fil);
98 auto vertex_prop = boost::get(vertex_filtration_t(), skel_graph);
100 typename boost::graph_traits<Proximity_graph<SimplicialComplexForProximityGraph>>::vertex_iterator vi, vi_end;
101 for (std::tie(vi, vi_end) = boost::vertices(skel_graph);
102 vi != vi_end; ++vi) {
103 boost::put(vertex_prop, *vi, 0.);
111 #endif // GRAPH_SIMPLICIAL_COMPLEX_H_ Definition: SimplicialComplexForAlpha.h:26
Proximity_graph< SimplicialComplexForProximityGraph > compute_proximity_graph(const ForwardPointRange &points, typename SimplicialComplexForProximityGraph::Filtration_value threshold, Distance distance)
Computes the proximity graph of the points.
Definition: graph_simplicial_complex.h:69
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:32
typename boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, 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:54