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;
45 template <
typename SimplicialComplexForProximityGraph>
46 using Proximity_graph =
typename boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS
47 , boost::property < vertex_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value >
48 , boost::property < edge_filtration_t, typename SimplicialComplexForProximityGraph::Filtration_value >>;
60 template<
typename SimplicialComplexForProximityGraph
61 ,
typename ForwardPointRange
64 const ForwardPointRange& points,
65 typename SimplicialComplexForProximityGraph::Filtration_value threshold,
67 using Vertex_handle =
typename SimplicialComplexForProximityGraph::Vertex_handle;
68 using Filtration_value =
typename SimplicialComplexForProximityGraph::Filtration_value;
70 std::vector<std::pair< Vertex_handle, Vertex_handle >> edges;
71 std::vector< Filtration_value > edges_fil;
72 std::map< Vertex_handle, Filtration_value > vertices;
74 Vertex_handle idx_u, idx_v;
77 for (
auto it_u = points.begin(); it_u != points.end(); ++it_u) {
79 for (
auto it_v = it_u + 1; it_v != points.end(); ++it_v, ++idx_v) {
80 fil = distance(*it_u, *it_v);
81 if (fil <= threshold) {
82 edges.emplace_back(idx_u, idx_v);
83 edges_fil.push_back(fil);
90 Proximity_graph<SimplicialComplexForProximityGraph> skel_graph(edges.begin(), edges.end(), edges_fil.begin(), idx_u);
92 auto vertex_prop = boost::get(vertex_filtration_t(), skel_graph);
94 typename boost::graph_traits<Proximity_graph<SimplicialComplexForProximityGraph>>::vertex_iterator vi, vi_end;
95 for (std::tie(vi, vi_end) = boost::vertices(skel_graph);
97 boost::put(vertex_prop, *vi, 0.);
105 #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:63
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:32