11 #ifndef SKELETON_BLOCKER_COMPLEX_H_ 12 #define SKELETON_BLOCKER_COMPLEX_H_ 14 #include <gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h> 15 #include <gudhi/Skeleton_blocker_link_complex.h> 16 #include <gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h> 17 #include <gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h> 18 #include <gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h> 19 #include <gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h> 20 #include <gudhi/Skeleton_blocker/internal/Top_faces.h> 21 #include <gudhi/Skeleton_blocker/internal/Trie.h> 22 #include <gudhi/Debug_utils.h> 24 #include <boost/graph/adjacency_list.hpp> 25 #include <boost/graph/connected_components.hpp> 26 #include <boost/iterator/transform_iterator.hpp> 27 #include <boost/range/adaptor/map.hpp> 43 namespace skeleton_blocker {
50 template<
class SkeletonBlockerDS>
53 template<
class ComplexType>
friend class Neighbors_vertices_iterator;
55 template<
class ComplexType>
friend class Edge_around_vertex_iterator;
78 typedef typename Root_vertex_handle::boost_vertex_handle boost_vertex_handle;
91 typedef typename Root_simplex_handle::Simplex_vertex_const_iterator Root_simplex_iterator;
92 typedef typename Simplex::Simplex_vertex_const_iterator Simplex_handle_iterator;
95 typedef typename boost::adjacency_list<boost::setS,
104 typedef typename boost::graph_traits<Graph>::vertex_iterator boost_vertex_iterator;
105 typedef typename boost::graph_traits<Graph>::edge_iterator boost_edge_iterator;
108 typedef typename boost::graph_traits<Graph>::adjacency_iterator boost_adjacency_iterator;
114 typedef typename boost::graph_traits<Graph>::edge_descriptor
Edge_handle;
117 typedef std::multimap<Vertex_handle, Simplex *> BlockerMap;
118 typedef typename std::multimap<Vertex_handle, Simplex *>::value_type BlockerPair;
119 typedef typename std::multimap<Vertex_handle, Simplex *>::iterator BlockerMapIterator;
120 typedef typename std::multimap<Vertex_handle, Simplex *>::const_iterator BlockerMapConstIterator;
123 size_t num_vertices_;
124 size_t num_blockers_;
138 std::vector<boost_vertex_handle> degree_;
142 BlockerMap blocker_map_;
154 : visitor(visitor_) {
156 for (
size_t i = 0; i < num_vertices_; ++i) {
163 typedef Trie<Simplex> STrie;
170 template<
typename SimpleHandleOutputIterator>
172 bool is_flag_complex =
false, Visitor* visitor_ = NULL)
176 add_vertices_and_edges(simplices_begin, simplices_end);
178 if (!is_flag_complex)
180 add_blockers(simplices_begin, simplices_end);
187 template<
typename SimpleHandleOutputIterator>
188 void add_vertices_and_edges(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end) {
189 std::vector<std::pair<Vertex_handle, Vertex_handle>> edges;
192 for (
auto s_it = simplices_begin; s_it != simplices_end; ++s_it) {
193 if (s_it->dimension() == 0) num_vertex = (std::max)(num_vertex, s_it->first_vertex().vertex);
194 if (s_it->dimension() == 1) edges.emplace_back(s_it->first_vertex(), s_it->last_vertex());
198 for (
const auto& e : edges)
202 template<
typename SimpleHandleOutputIterator>
203 void add_blockers(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end) {
204 Tries<Simplex> tries(num_vertices(), simplices_begin, simplices_end);
205 tries.init_next_dimension();
206 auto simplices(tries.next_dimension_simplices());
208 while (!simplices.empty()) {
209 simplices = tries.next_dimension_simplices();
210 for (
auto& sigma : simplices) {
213 Simplex common_positive_neighbors(tries.positive_neighbors(sigma.last_vertex()));
214 for (
auto sigma_it = sigma.rbegin(); sigma_it != sigma.rend(); ++sigma_it)
215 if (sigma_it != sigma.rbegin())
216 common_positive_neighbors.
intersection(tries.positive_neighbors(*sigma_it));
218 for (
auto x : common_positive_neighbors) {
220 bool all_edges_here =
true;
223 all_edges_here =
false;
226 if (!all_edges_here)
continue;
234 if (!tries.contains(sigma) && !blocks(sigma))
248 degree_ = copy.degree_;
249 skeleton = Graph(copy.skeleton);
250 num_vertices_ = copy.num_vertices_;
264 degree_ = copy.degree_;
265 skeleton = Graph(copy.skeleton);
266 num_vertices_ = copy.num_vertices_;
279 if (other.num_vertices() != num_vertices())
return false;
280 if (other.num_edges() != num_edges())
return false;
281 if (other.num_blockers() != num_blockers())
return false;
284 if (!other.contains_vertex(v))
return false;
296 return !(*
this == other);
328 visitor = other_visitor;
354 0 <= address.vertex && address.vertex < boost::num_vertices(skeleton));
355 return skeleton[address.vertex];
362 const Graph_vertex&
operator[](Vertex_handle address)
const {
364 0 <= address.vertex && address.vertex < boost::num_vertices(skeleton));
365 return skeleton[address.vertex];
373 Vertex_handle address(boost::add_vertex(skeleton));
375 (*this)[address].activate();
378 (*this)[address].set_id(Root_vertex_handle(address.vertex));
379 degree_.push_back(0);
381 visitor->on_add_vertex(address);
391 assert(contains_vertex(address));
393 boost::clear_vertex(address.vertex, skeleton);
394 (*this)[address].deactivate();
396 degree_[address.vertex] = -1;
398 visitor->on_remove_vertex(address);
403 bool contains_vertex(Vertex_handle u)
const {
404 Vertex_handle num_vertices(boost::num_vertices(skeleton));
405 if (u.vertex < 0 || u.vertex >= num_vertices)
407 return (*
this)[u].is_active();
412 bool contains_vertex(Root_vertex_handle u)
const {
413 boost::optional<Vertex_handle> address =
get_address(u);
414 return address && (*this)[*address].is_active();
422 for (
auto vertex : sigma)
423 if (!contains_vertex(vertex))
432 virtual boost::optional<Vertex_handle>
get_address(Root_vertex_handle
id)
const {
433 boost::optional<Vertex_handle> res;
434 int num_vertices = boost::num_vertices(skeleton);
435 if (
id.vertex < num_vertices)
443 Root_vertex_handle
get_id(Vertex_handle local)
const {
444 assert(0 <= local.vertex && local.vertex < boost::num_vertices(skeleton));
445 return (*
this)[local].get_id();
459 Vertex_handle vh_in_other)
const {
461 assert(vh_in_current_complex);
462 return *vh_in_current_complex;
469 assert(0 <= local.vertex && local.vertex < boost::num_vertices(skeleton));
470 return degree_[local.vertex];
485 const std::pair<Vertex_handle, Vertex_handle>& ab)
const {
486 boost::optional<Edge_handle> res;
487 std::pair<Edge_handle, bool> edge_pair(
488 boost::edge(ab.first.vertex, ab.second.vertex, skeleton));
489 if (edge_pair.second)
490 res = edge_pair.first;
498 return skeleton[edge_handle];
504 const Graph_edge&
operator[](Edge_handle edge_handle)
const {
505 return skeleton[edge_handle];
513 return static_cast<Vertex_handle
> (source(edge_handle, skeleton));
521 return static_cast<Vertex_handle
> (target(edge_handle, skeleton));
530 auto edge((*
this)[edge_handle]);
531 return Simplex((*
this)[edge.first()], (*this)[edge.second()]);
541 Edge_handle
add_edge(Vertex_handle a, Vertex_handle b) {
545 return *((*this)[std::make_pair(a, b)]);
547 add_blockers_after_simplex_insertion(
Simplex(a, b));
555 for (
auto i = s.begin(); i != s.end(); ++i)
556 for (
auto j = i; ++j != s.end(); )
567 assert(contains_vertex(a) && contains_vertex(b));
570 auto edge_handle((*
this)[std::make_pair(a, b)]);
572 edge_handle = boost::add_edge(a.vertex, b.vertex, skeleton).first;
577 visitor->on_add_edge_without_blockers(a, b);
586 for (
auto i = s.begin(); i != s.end(); ++i) {
587 for (
auto j = i; ++j != s.end(); )
596 virtual Edge_handle
remove_edge(Vertex_handle a, Vertex_handle b) {
599 tie(edge, found) = boost::edge(a.vertex, b.vertex, skeleton);
602 visitor->on_remove_edge(a, b);
603 boost::remove_edge(a.vertex, b.vertex, skeleton);
627 while (this->
degree(u) > 0) {
628 Vertex_handle v(*(adjacent_vertices(u.vertex, this->skeleton).first));
640 return boost::edge(a.vertex, b.vertex, skeleton).second;
648 for (
auto i = sigma.begin(); i != sigma.end(); ++i) {
649 if (!contains_vertex(*i))
651 for (
auto j = i; ++j != sigma.end();) {
675 visitor->on_add_blocker(blocker);
676 Blocker_handle blocker_pt =
new Simplex(blocker);
678 auto vertex = blocker_pt->begin();
679 while (vertex != blocker_pt->end()) {
680 blocker_map_.insert(BlockerPair(*vertex, blocker_pt));
697 visitor->on_add_blocker(*blocker);
699 auto vertex = blocker->begin();
700 while (vertex != blocker->end()) {
701 blocker_map_.insert(BlockerPair(*vertex, blocker));
711 void remove_blocker(
const Blocker_handle sigma, Vertex_handle v) {
715 if (*blocker == sigma)
718 if (*blocker != sigma) {
720 <<
"bug ((*blocker).second == sigma) ie try to remove a blocker not present\n";
723 blocker_map_.erase(blocker.current_position());
733 for (
auto vertex : *sigma)
734 remove_blocker(sigma, vertex);
744 while (!blocker_map_.empty()) {
748 blocker_map_.clear();
758 void remove_blocker(
const Simplex& sigma) {
760 for (
auto vertex : sigma)
761 remove_blocker(sigma, vertex);
772 visitor->on_delete_blocker(sigma);
773 remove_blocker(sigma);
814 bool blocks(
const Simplex & sigma)
const {
817 if (sigma.contains(*blocker))
829 virtual void add_neighbours(Vertex_handle v, Simplex & n,
830 bool keep_only_superior =
false)
const {
831 boost_adjacency_iterator ai, ai_end;
832 for (tie(ai, ai_end) = adjacent_vertices(v.vertex, skeleton); ai != ai_end;
834 Vertex_handle value(*ai);
835 if (keep_only_superior) {
836 if (value > v.vertex) {
853 virtual void add_neighbours(
const Simplex &alpha, Simplex & res,
854 bool keep_only_superior =
false)
const {
856 auto alpha_vertex = alpha.begin();
857 add_neighbours(*alpha_vertex, res, keep_only_superior);
858 for (alpha_vertex = (alpha.begin())++; alpha_vertex != alpha.end();
860 keep_neighbours(*alpha_vertex, res, keep_only_superior);
868 virtual void keep_neighbours(Vertex_handle v, Simplex& res,
869 bool keep_only_superior =
false)
const {
871 add_neighbours(v, nv, keep_only_superior);
880 virtual void remove_neighbours(Vertex_handle v, Simplex & res,
881 bool keep_only_superior =
false)
const {
883 add_neighbours(v, nv, keep_only_superior);
893 Link_complex
link(Vertex_handle v)
const {
894 return Link_complex(*
this,
Simplex(v));
900 Link_complex
link(Edge_handle edge)
const {
901 return Link_complex(*
this, edge);
907 Link_complex
link(
const Simplex& simplex)
const {
908 return Link_complex(*
this, simplex);
920 const Root_simplex_handle& s)
const {
921 boost::optional<Simplex> res;
925 for (
auto i = s.begin(); i != s.end(); ++i) {
926 boost::optional<Vertex_handle> address =
get_address(*i);
940 Root_simplex_handle
get_id(
const Simplex& local_simplex)
const {
941 Root_simplex_handle global_simplex;
942 for (
auto x = local_simplex.begin(); x != local_simplex.end(); ++x) {
945 return global_simplex;
966 return num_vertices() == 0;
972 int num_vertices()
const {
974 return num_vertices_;
983 int num_edges()
const {
984 return boost::num_edges(skeleton);
987 int num_triangles()
const {
989 return std::distance(triangles.begin(), triangles.end());
995 size_t num_simplices()
const {
997 return std::distance(simplices.begin(), simplices.end());
1003 size_t num_simplices(
int dimension)
const {
1007 if (s.dimension() == dimension)
1015 size_t num_blockers()
const {
1016 return num_blockers_;
1022 bool complete()
const {
1023 return (num_vertices() * (num_vertices() - 1)) / 2 == num_edges();
1030 int num_vert_collapsed = skeleton.vertex_set().size() - num_vertices();
1031 std::vector<int> component(skeleton.vertex_set().size());
1032 return boost::connected_components(this->skeleton, &component[0])
1033 - num_vert_collapsed;
1041 if (num_vertices() == 0)
1043 if (num_vertices() == 1)
1047 if (blocker_map_.find(vi) == blocker_map_.end()) {
1050 if (degree_[vi.vertex] == num_vertices() - 1)
1101 void update_blockers_after_remove_star_of_vertex_or_edge(
const Simplex& simplex_to_be_removed);
1108 void remove_star(Vertex_handle a, Vertex_handle b);
1127 void add_blockers_after_simplex_insertion(Simplex s);
1132 void remove_blocker_containing_simplex(
const Simplex& sigma);
1137 void remove_blocker_include_in_simplex(
const Simplex& sigma);
1140 enum simplifiable_status {
1141 NOT_HOMOTOPY_EQ, MAYBE_HOMOTOPY_EQ, HOMOTOPY_EQ
1144 simplifiable_status is_remove_star_homotopy_preserving(
const Simplex& simplex) {
1148 return MAYBE_HOMOTOPY_EQ;
1151 enum contractible_status {
1152 NOT_CONTRACTIBLE, MAYBE_CONTRACTIBLE, CONTRACTIBLE
1166 return CONTRACTIBLE;
1168 return MAYBE_CONTRACTIBLE;
1184 bool link_condition(Vertex_handle a, Vertex_handle b,
bool ignore_popable_blockers =
false)
const {
1202 const Graph_edge& edge = (*this)[e];
1205 Vertex_handle a(*this->
get_address(edge.first()));
1206 Vertex_handle b(*this->
get_address(edge.second()));
1216 void tip_blockers(Vertex_handle a, Vertex_handle b, std::vector<Simplex> & buffer)
const;
1227 void swap_edge(Vertex_handle a, Vertex_handle b, Vertex_handle x);
1233 void delete_blockers_around_vertex(Vertex_handle v);
1238 void delete_blockers_around_edge(Vertex_handle a, Vertex_handle b);
1258 void get_blockers_to_be_added_after_contraction(Vertex_handle a, Vertex_handle b,
1259 std::set<Simplex>& blockers_to_add);
1263 void delete_blockers_around_vertices(Vertex_handle a, Vertex_handle b);
1264 void update_edges_after_contraction(Vertex_handle a, Vertex_handle b);
1265 void notify_changed_edges(Vertex_handle a);
1279 typedef boost::iterator_range<Complex_vertex_iterator> Complex_vertex_range;
1285 auto begin = Complex_vertex_iterator(
this);
1286 auto end = Complex_vertex_iterator(
this, 0);
1287 return Complex_vertex_range(begin, end);
1290 typedef Neighbors_vertices_iterator<Skeleton_blocker_complex> Complex_neighbors_vertices_iterator;
1293 typedef boost::iterator_range<Complex_neighbors_vertices_iterator> Complex_neighbors_vertices_range;
1299 auto begin = Complex_neighbors_vertices_iterator(
this, v);
1300 auto end = Complex_neighbors_vertices_iterator(
this, v, 0);
1301 return Complex_neighbors_vertices_range(begin, end);
1313 typedef boost::iterator_range<Complex_edge_iterator> Complex_edge_range;
1319 auto begin = Complex_edge_iterator(
this);
1320 auto end = Complex_edge_iterator(
this, 0);
1321 return Complex_edge_range(begin, end);
1325 typedef Edge_around_vertex_iterator<Skeleton_blocker_complex> Complex_edge_around_vertex_iterator;
1328 typedef boost::iterator_range <Complex_edge_around_vertex_iterator> Complex_edge_around_vertex_range;
1334 Complex_edge_around_vertex_range
edge_range(Vertex_handle v)
const {
1335 auto begin = Complex_edge_around_vertex_iterator(
this, v);
1336 auto end = Complex_edge_around_vertex_iterator(
this, v, 0);
1337 return Complex_edge_around_vertex_range(begin, end);
1352 typedef boost::iterator_range < Triangle_around_vertex_iterator<Skeleton_blocker_complex, Link> >
1353 Complex_triangle_around_vertex_range;
1363 return Complex_triangle_around_vertex_range(begin, end);
1366 typedef boost::iterator_range<Triangle_iterator<Skeleton_blocker_complex> > Complex_triangle_range;
1377 return Complex_triangle_range(end, end);
1380 return Complex_triangle_range(begin, end);
1401 assert(contains_vertex(v));
1403 Complex_simplex_around_vertex_iterator(
this, v),
1404 Complex_simplex_around_vertex_iterator(
this, v,
true));
1420 Complex_simplex_coboundary_iterator(
this, s,
true));
1424 typedef Simplex_iterator<Skeleton_blocker_complex> Complex_simplex_iterator;
1426 typedef boost::iterator_range < Complex_simplex_iterator > Complex_simplex_range;
1432 Complex_simplex_iterator end(
this,
true);
1434 return Complex_simplex_range(end, end);
1436 Complex_simplex_iterator begin(
this);
1437 return Complex_simplex_range(begin, end);
1451 typename std::multimap<Vertex_handle, Simplex *>::iterator,
1459 typename std::multimap<Vertex_handle, Simplex *>::const_iterator,
1460 const Blocker_handle>
1463 typedef boost::iterator_range <Complex_blocker_around_vertex_iterator> Complex_blocker_around_vertex_range;
1464 typedef boost::iterator_range <Const_complex_blocker_around_vertex_iterator>
1465 Const_complex_blocker_around_vertex_range;
1472 auto begin = Complex_blocker_around_vertex_iterator(blocker_map_.lower_bound(v));
1473 auto end = Complex_blocker_around_vertex_iterator(blocker_map_.upper_bound(v));
1474 return Complex_blocker_around_vertex_range(begin, end);
1481 auto begin = Const_complex_blocker_around_vertex_iterator(blocker_map_.lower_bound(v));
1482 auto end = Const_complex_blocker_around_vertex_iterator(blocker_map_.upper_bound(v));
1483 return Const_complex_blocker_around_vertex_range(begin, end);
1491 typename std::multimap<Vertex_handle, Simplex *>::iterator,
1499 typename std::multimap<Vertex_handle, Simplex *>::const_iterator,
1500 const Blocker_handle>
1503 typedef boost::iterator_range <Complex_blocker_iterator> Complex_blocker_range;
1504 typedef boost::iterator_range <Const_complex_blocker_iterator> Const_complex_blocker_range;
1511 auto begin = Complex_blocker_iterator(blocker_map_.begin(), blocker_map_.end());
1512 auto end = Complex_blocker_iterator(blocker_map_.end(), blocker_map_.end());
1513 return Complex_blocker_range(begin, end);
1520 auto begin = Const_complex_blocker_iterator(blocker_map_.begin(), blocker_map_.end());
1521 auto end = Const_complex_blocker_iterator(blocker_map_.end(), blocker_map_.end());
1522 return Const_complex_blocker_range(begin, end);
1532 std::string to_string()
const {
1533 std::ostringstream stream;
1534 stream << num_vertices() <<
" vertices:\n" << vertices_to_string() << std::endl;
1535 stream << num_edges() <<
" edges:\n" << edges_to_string() << std::endl;
1536 stream << num_blockers() <<
" blockers:\n" << blockers_to_string() << std::endl;
1537 return stream.str();
1540 std::string vertices_to_string()
const {
1541 std::ostringstream stream;
1543 stream <<
"{" << (*this)[vertex].get_id() <<
"} ";
1545 stream << std::endl;
1546 return stream.str();
1549 std::string edges_to_string()
const {
1550 std::ostringstream stream;
1552 stream <<
"{" << (*this)[edge].first() <<
"," << (*this)[edge].second() <<
"} ";
1553 stream << std::endl;
1554 return stream.str();
1557 std::string blockers_to_string()
const {
1558 std::ostringstream stream;
1561 stream << *b << std::endl;
1562 return stream.str();
1572 template<
typename Complex,
typename SimplexHandleIterator>
1573 Complex make_complex_from_top_faces(SimplexHandleIterator simplices_begin, SimplexHandleIterator simplices_end,
1574 bool is_flag_complex =
false) {
1576 typedef typename Complex::Simplex
Simplex;
1577 std::vector<Simplex> simplices;
1578 for (
auto top_face = simplices_begin; top_face != simplices_end; ++top_face) {
1579 auto subfaces_topface = subfaces(*top_face);
1580 simplices.insert(simplices.end(), subfaces_topface.begin(), subfaces_topface.end());
1582 return Complex(simplices.begin(), simplices.end(), is_flag_complex);
1587 namespace skbl = skeleton_blocker;
1591 #include "Skeleton_blocker_simplifiable_complex.h" 1593 #endif // SKELETON_BLOCKER_COMPLEX_H_ Simplex get_vertices(Edge_handle edge_handle) const
returns the simplex made with the two vertices of the edge
Definition: Skeleton_blocker_complex.h:529
virtual Edge_handle remove_edge(Vertex_handle a, Vertex_handle b)
Removes an edge from the simplicial complex and all its cofaces.
Definition: Skeleton_blocker_complex.h:596
boost::iterator_range< Complex_simplex_coboundary_iterator > Complex_coboundary_range
Range over the simplices of the coboundary of a simplex. Methods .begin() and .end() return a Complex...
Definition: Skeleton_blocker_complex.h:1412
Const_complex_blocker_around_vertex_range const_blocker_range(Vertex_handle v) const
Returns a range of the blockers of the complex passing through a vertex.
Definition: Skeleton_blocker_complex.h:1480
Simplicial subcomplex of a complex represented by a skeleton/blockers pair.
Definition: Skeleton_blocker_link_superior.h:20
Abstract simplex used in Skeleton blockers data-structure.
Definition: Skeleton_blocker_simplex.h:38
virtual boost::optional< Vertex_handle > get_address(Root_vertex_handle id) const
Given an Id return the address of the vertex having this Id in the complex.
Definition: Skeleton_blocker_complex.h:432
Iterator through the blockers of a vertex.
Definition: Skeleton_blockers_blockers_iterators.h:79
bool contains_edge(Vertex_handle a, Vertex_handle b) const
Definition: Skeleton_blocker_complex.h:638
Vertex_handle second_vertex(Edge_handle edge_handle) const
returns the first vertex of an edge
Definition: Skeleton_blocker_complex.h:520
Simplex * Blocker_handle
Handle to a blocker of the complex.
Definition: Skeleton_blocker_complex.h:89
void add_vertex(T v)
Definition: Skeleton_blocker_simplex.h:110
bool contains_blocker(const Blocker_handle s) const
Definition: Skeleton_blocker_complex.h:780
Graph_vertex & operator[](Vertex_handle address)
Return the vertex node associated to local Vertex_handle.
Definition: Skeleton_blocker_complex.h:352
virtual void clear()
Definition: Skeleton_blocker_complex.h:311
int dimension() const
Definition: Skeleton_blocker_simplex.h:197
int degree(Vertex_handle local) const
return the graph degree of a vertex.
Definition: Skeleton_blocker_complex.h:468
boost::optional< Edge_handle > operator[](const std::pair< Vertex_handle, Vertex_handle > &ab) const
return an edge handle if the two vertices forms an edge in the complex
Definition: Skeleton_blocker_complex.h:484
SkeletonBlockerDS::Vertex_handle Vertex_handle
The type of an handle to a vertex of the complex.
Definition: Skeleton_blocker_complex.h:77
Complex_edge_around_vertex_range edge_range(Vertex_handle v) const
Returns a Complex_edge_range over all edges of the simplicial complex that passes through 'v'...
Definition: Skeleton_blocker_complex.h:1334
bool contains_vertices(const Simplex &sigma) const
Definition: Skeleton_blocker_complex.h:421
void difference(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:139
void remove_vertex(T v)
Definition: Skeleton_blocker_simplex.h:117
Complex_simplex_range complex_simplex_range() const
Returns a Complex_simplex_range over all the simplices of the complex.
Definition: Skeleton_blocker_complex.h:1431
void contract_edge(Edge_handle edge)
Definition: Skeleton_blocker_complex.h:1246
Edge_handle add_edge(Vertex_handle a, Vertex_handle b)
Adds an edge between vertices a and b.
Definition: Skeleton_blocker_complex.h:541
bool contains_blocker(const Simplex &s) const
Definition: Skeleton_blocker_complex.h:796
Skeleton_blocker_simplex< Vertex_handle > Simplex
A ordered set of integers that represents a simplex.
Definition: Skeleton_blocker_complex.h:83
void remove_star(Vertex_handle v)
Definition: Skeleton_blocker_simplifiable_complex.h:121
Skeleton_blocker_complex(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end, bool is_flag_complex=false, Visitor *visitor_=NULL)
Constructor with a list of simplices.
Definition: Skeleton_blocker_complex.h:171
void set_visitor(Visitor *other_visitor)
allows to change the visitor.
Definition: Skeleton_blocker_complex.h:327
Complex_triangle_around_vertex_range triangle_range(Vertex_handle v) const
Range over triangles around a vertex of the simplicial complex. Methods .begin() and ...
Definition: Skeleton_blocker_complex.h:1360
Iterator on the vertices of a simplicial complex.
Definition: Skeleton_blockers_vertices_iterators.h:28
Iterator through the blockers of a vertex.
Definition: Skeleton_blockers_blockers_iterators.h:27
Class representing the link of a simplicial complex encoded by a skeleton/blockers pair...
Definition: Skeleton_blocker_link_complex.h:30
Definition: SimplicialComplexForAlpha.h:14
Skeleton_blocker_complex(size_t num_vertices_=0, Visitor *visitor_=NULL)
constructs a simplicial complex with a given number of vertices and a visitor.
Definition: Skeleton_blocker_complex.h:153
void remove_all_popable_blockers(Vertex_handle v)
Removes all the popable blockers of the complex passing through v and delete them. Also remove popable blockers in the neighborhood if they became popable.
Definition: Skeleton_blocker_simplifiable_complex.h:93
Complex_triangle_range triangle_range() const
Range over triangles of the simplicial complex. Methods .begin() and .end() return a Triangle_around_...
Definition: Skeleton_blocker_complex.h:1374
Complex_edge_range edge_range() const
Returns a Complex_edge_range over all edges of the simplicial complex.
Definition: Skeleton_blocker_complex.h:1318
Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor used in boost ...
Definition: SkeletonBlockerDS.h:47
bool contains_edges(const Simplex &sigma) const
Definition: Skeleton_blocker_complex.h:647
Complex_blocker_range blocker_range()
Returns a range of the blockers of the complex.
Definition: Skeleton_blocker_complex.h:1510
Class representing the link of a simplicial complex encoded by a skeleton/blockers pair...
Definition: Skeleton_blocker_link_superior.h:27
Iterator on the edges of a simplicial complex.
Definition: Skeleton_blockers_edges_iterators.h:85
Blocker_handle add_blocker(const Simplex &blocker)
Adds the simplex to the set of blockers and returns a Blocker_handle toward it if was not present bef...
Definition: Skeleton_blocker_complex.h:669
Vertex_handle convert_handle_from_another_complex(const Skeleton_blocker_complex &other, Vertex_handle vh_in_other) const
Convert an address of a vertex of a complex to the address in the current complex.
Definition: Skeleton_blocker_complex.h:458
bool contains(const Skeleton_blocker_simplex &a) const
Definition: Skeleton_blocker_simplex.h:228
Root_vertex_handle get_id(Vertex_handle local) const
Definition: Skeleton_blocker_complex.h:443
void add_simplex(const Simplex &sigma)
add a simplex and all its faces.
Definition: Skeleton_blocker_simplifiable_complex.h:197
Iterator over the triangles of the simplicial complex.
Definition: Skeleton_blockers_triangles_iterators.h:102
void remove_edge(Edge_handle edge)
Removes edge and its cofaces from the simplicial complex.
Definition: Skeleton_blocker_complex.h:613
The type of edges that are stored the boost graph. An Edge must be Default Constructible and Equality...
Definition: SkeletonBlockerDS.h:91
Complex_blocker_around_vertex_range blocker_range(Vertex_handle v)
Returns a range of the blockers of the complex passing through a vertex.
Definition: Skeleton_blocker_complex.h:1471
SkeletonBlockerDS::Graph_edge Graph_edge
The type of stored edge node, specified by the template SkeletonBlockerDS.
Definition: Skeleton_blocker_complex.h:70
boost::iterator_range< Complex_simplex_around_vertex_iterator > Complex_simplex_around_vertex_range
Range over the simplices of the simplicial complex around a vertex. Methods .begin() and ...
Definition: Skeleton_blocker_complex.h:1395
Graph_edge & operator[](Edge_handle edge_handle)
returns the stored node associated to an edge
Definition: Skeleton_blocker_complex.h:497
virtual bool contains(const Simplex &s) const
returns true iff the simplex s belongs to the simplicial complex.
Definition: Skeleton_blocker_complex.h:952
Definition: Skeleton_blockers_simplices_iterators.h:302
Definition: Skeleton_blockers_simplices_iterators.h:38
Definition: SkeletonBlockerDS.h:56
void intersection(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:124
boost::optional< Simplex > get_simplex_address(const Root_simplex_handle &s) const
Compute the local vertices of 's' in the current complex If one of them is not present in the complex...
Definition: Skeleton_blocker_complex.h:919
Vertex_handle add_vertex()
Adds a vertex to the simplicial complex and returns its Vertex_handle.
Definition: Skeleton_blocker_complex.h:372
Const_complex_blocker_range const_blocker_range() const
Returns a range of the blockers of the complex.
Definition: Skeleton_blocker_complex.h:1519
Complex_neighbors_vertices_range vertex_range(Vertex_handle v) const
Returns a Complex_edge_range over all edges of the simplicial complex that passes trough v...
Definition: Skeleton_blocker_complex.h:1298
Iterator over the triangles that are adjacent to a vertex of the simplicial complex.
Definition: Skeleton_blockers_triangles_iterators.h:27
bool is_cone() const
Test if the complex is a cone.
Definition: Skeleton_blocker_complex.h:1040
void keep_only_vertices()
The complex is reduced to its set of vertices. All the edges and blockers are removed.
Definition: Skeleton_blocker_complex.h:623
void remove_vertex(Vertex_handle address)
Remove a vertex from the simplicial complex.
Definition: Skeleton_blocker_complex.h:390
const Graph_edge & operator[](Edge_handle edge_handle) const
returns the stored node associated to an edge
Definition: Skeleton_blocker_complex.h:504
Link_complex link(Vertex_handle v) const
Definition: Skeleton_blocker_complex.h:893
Vertex_handle first_vertex(Edge_handle edge_handle) const
returns the first vertex of an edge
Definition: Skeleton_blocker_complex.h:512
Root_simplex_handle get_id(const Simplex &local_simplex) const
returns a simplex with vertices which are the id of vertices of the argument.
Definition: Skeleton_blocker_complex.h:940
boost::graph_traits< Graph >::edge_descriptor Edge_handle
Handle to an edge of the complex.
Definition: Skeleton_blocker_complex.h:114
void remove_blockers()
Remove all blockers, in other words, it expand the simplicial complex to the smallest flag complex th...
Definition: Skeleton_blocker_complex.h:742
Complex_vertex_range vertex_range() const
Returns a Complex_vertex_range over all vertices of the complex.
Definition: Skeleton_blocker_complex.h:1284
void add_edge(const Simplex &s)
Adds all edges of s in the complex.
Definition: Skeleton_blocker_complex.h:554
virtual ~Skeleton_blocker_complex()
Definition: Skeleton_blocker_complex.h:302
Link_complex link(const Simplex &simplex) const
Definition: Skeleton_blocker_complex.h:907
bool is_popable_blocker(Blocker_handle sigma) const
Definition: Skeleton_blocker_simplifiable_complex.h:33
Interface for a visitor of a simplicial complex.
Definition: Skeleton_blocker_complex_visitor.h:26
bool operator==(const Skeleton_blocker_complex &other) const
Definition: Skeleton_blocker_complex.h:278
The type of vertices that are stored the boost graph. A Vertex must be Default Constructible and Equa...
Definition: SkeletonBlockerDS.h:67
int num_connected_components() const
returns the number of connected components in the graph of the 1-skeleton.
Definition: Skeleton_blocker_complex.h:1029
const Graph_vertex & operator[](Vertex_handle address) const
Return the vertex node associated to local Vertex_handle.
Definition: Skeleton_blocker_complex.h:362
void delete_blocker(Blocker_handle sigma)
Definition: Skeleton_blocker_complex.h:770
virtual contractible_status is_contractible() const
Test if the complex is reducible using a strategy defined in the class (by default it tests if the co...
Definition: Skeleton_blocker_complex.h:1164
Vertex_handle operator[](Root_vertex_handle global) const
Return a local Vertex_handle of a vertex given a global one.
Definition: Skeleton_blocker_complex.h:342
Edge_handle add_edge_without_blockers(Vertex_handle a, Vertex_handle b)
Adds an edge between vertices a and b without blockers.
Definition: Skeleton_blocker_complex.h:566
SkeletonBlockerDS::Graph_vertex Graph_vertex
The type of stored vertex node, specified by the template SkeletonBlockerDS.
Definition: Skeleton_blocker_complex.h:65
Complex_simplex_around_vertex_range star_simplex_range(Vertex_handle v) const
Returns a Complex_simplex_around_vertex_range over all the simplices around a vertex of the complex...
Definition: Skeleton_blocker_complex.h:1400
void add_edge_without_blockers(Simplex s)
Adds all edges of s in the complex without adding blockers.
Definition: Skeleton_blocker_complex.h:585
void remove_blocker(const Blocker_handle sigma)
Removes the simplex from the set of blockers.
Definition: Skeleton_blocker_complex.h:732
Link_complex link(Edge_handle edge) const
Definition: Skeleton_blocker_complex.h:900
Abstract Simplicial Complex represented with a skeleton/blockers pair.
Definition: Skeleton_blocker_complex.h:51
void remove_popable_blockers()
Definition: Skeleton_blocker_simplifiable_complex.h:45
bool link_condition(Edge_handle e, bool ignore_popable_blockers=false) const
Definition: Skeleton_blocker_complex.h:1201
bool link_condition(Vertex_handle a, Vertex_handle b, bool ignore_popable_blockers=false) const
Definition: Skeleton_blocker_complex.h:1184
T first_vertex() const
Definition: Skeleton_blocker_simplex.h:210
Complex_coboundary_range coboundary_range(const Simplex &s) const
Returns a Complex_simplex_coboundary_iterator over the simplices of the coboundary of a simplex...
Definition: Skeleton_blocker_complex.h:1417