23 #ifndef SKELETON_BLOCKER_COMPLEX_H_ 24 #define SKELETON_BLOCKER_COMPLEX_H_ 26 #include <gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h> 27 #include <gudhi/Skeleton_blocker_link_complex.h> 28 #include <gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h> 29 #include <gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h> 30 #include <gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h> 31 #include <gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h> 32 #include <gudhi/Skeleton_blocker/internal/Top_faces.h> 33 #include <gudhi/Skeleton_blocker/internal/Trie.h> 34 #include <gudhi/Debug_utils.h> 36 #include <boost/graph/adjacency_list.hpp> 37 #include <boost/graph/connected_components.hpp> 38 #include <boost/iterator/transform_iterator.hpp> 39 #include <boost/range/adaptor/map.hpp> 55 namespace skeleton_blocker {
62 template<
class SkeletonBlockerDS>
65 template<
class ComplexType>
friend class Neighbors_vertices_iterator;
67 template<
class ComplexType>
friend class Edge_around_vertex_iterator;
90 typedef typename Root_vertex_handle::boost_vertex_handle boost_vertex_handle;
103 typedef typename Root_simplex_handle::Simplex_vertex_const_iterator Root_simplex_iterator;
104 typedef typename Simplex::Simplex_vertex_const_iterator Simplex_handle_iterator;
107 typedef typename boost::adjacency_list<boost::setS,
116 typedef typename boost::graph_traits<Graph>::vertex_iterator boost_vertex_iterator;
117 typedef typename boost::graph_traits<Graph>::edge_iterator boost_edge_iterator;
120 typedef typename boost::graph_traits<Graph>::adjacency_iterator boost_adjacency_iterator;
126 typedef typename boost::graph_traits<Graph>::edge_descriptor
Edge_handle;
129 typedef std::multimap<Vertex_handle, Simplex *> BlockerMap;
130 typedef typename std::multimap<Vertex_handle, Simplex *>::value_type BlockerPair;
131 typedef typename std::multimap<Vertex_handle, Simplex *>::iterator BlockerMapIterator;
132 typedef typename std::multimap<Vertex_handle, Simplex *>::const_iterator BlockerMapConstIterator;
135 size_t num_vertices_;
136 size_t num_blockers_;
150 std::vector<boost_vertex_handle> degree_;
154 BlockerMap blocker_map_;
166 : visitor(visitor_) {
168 for (
size_t i = 0; i < num_vertices_; ++i) {
175 typedef Trie<Simplex> STrie;
182 template<
typename SimpleHandleOutputIterator>
184 bool is_flag_complex =
false, Visitor* visitor_ = NULL)
188 add_vertices_and_edges(simplices_begin, simplices_end);
190 if (!is_flag_complex)
192 add_blockers(simplices_begin, simplices_end);
199 template<
typename SimpleHandleOutputIterator>
200 void add_vertices_and_edges(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end) {
201 std::vector<std::pair<Vertex_handle, Vertex_handle>> edges;
204 for (
auto s_it = simplices_begin; s_it != simplices_end; ++s_it) {
205 if (s_it->dimension() == 0) num_vertex = (std::max)(num_vertex, s_it->first_vertex().vertex);
206 if (s_it->dimension() == 1) edges.emplace_back(s_it->first_vertex(), s_it->last_vertex());
210 for (
const auto& e : edges)
214 template<
typename SimpleHandleOutputIterator>
215 void add_blockers(SimpleHandleOutputIterator simplices_begin, SimpleHandleOutputIterator simplices_end) {
216 Tries<Simplex> tries(num_vertices(), simplices_begin, simplices_end);
217 tries.init_next_dimension();
218 auto simplices(tries.next_dimension_simplices());
220 while (!simplices.empty()) {
221 simplices = tries.next_dimension_simplices();
222 for (
auto& sigma : simplices) {
225 Simplex common_positive_neighbors(tries.positive_neighbors(sigma.last_vertex()));
226 for (
auto sigma_it = sigma.rbegin(); sigma_it != sigma.rend(); ++sigma_it)
227 if (sigma_it != sigma.rbegin())
228 common_positive_neighbors.
intersection(tries.positive_neighbors(*sigma_it));
230 for (
auto x : common_positive_neighbors) {
232 bool all_edges_here =
true;
235 all_edges_here =
false;
238 if (!all_edges_here)
continue;
246 if (!tries.contains(sigma) && !blocks(sigma))
260 degree_ = copy.degree_;
261 skeleton = Graph(copy.skeleton);
262 num_vertices_ = copy.num_vertices_;
276 degree_ = copy.degree_;
277 skeleton = Graph(copy.skeleton);
278 num_vertices_ = copy.num_vertices_;
291 if (other.num_vertices() != num_vertices())
return false;
292 if (other.num_edges() != num_edges())
return false;
293 if (other.num_blockers() != num_blockers())
return false;
296 if (!other.contains_vertex(v))
return false;
308 return !(*
this == other);
340 visitor = other_visitor;
366 0 <= address.vertex && address.vertex < boost::num_vertices(skeleton));
367 return skeleton[address.vertex];
374 const Graph_vertex&
operator[](Vertex_handle address)
const {
376 0 <= address.vertex && address.vertex < boost::num_vertices(skeleton));
377 return skeleton[address.vertex];
385 Vertex_handle address(boost::add_vertex(skeleton));
387 (*this)[address].activate();
390 (*this)[address].set_id(Root_vertex_handle(address.vertex));
391 degree_.push_back(0);
393 visitor->on_add_vertex(address);
403 assert(contains_vertex(address));
405 boost::clear_vertex(address.vertex, skeleton);
406 (*this)[address].deactivate();
408 degree_[address.vertex] = -1;
410 visitor->on_remove_vertex(address);
415 bool contains_vertex(Vertex_handle u)
const {
416 Vertex_handle num_vertices(boost::num_vertices(skeleton));
417 if (u.vertex < 0 || u.vertex >= num_vertices)
419 return (*
this)[u].is_active();
424 bool contains_vertex(Root_vertex_handle u)
const {
425 boost::optional<Vertex_handle> address =
get_address(u);
426 return address && (*this)[*address].is_active();
434 for (
auto vertex : sigma)
435 if (!contains_vertex(vertex))
444 virtual boost::optional<Vertex_handle>
get_address(Root_vertex_handle
id)
const {
445 boost::optional<Vertex_handle> res;
446 int num_vertices = boost::num_vertices(skeleton);
447 if (
id.vertex < num_vertices)
455 Root_vertex_handle
get_id(Vertex_handle local)
const {
456 assert(0 <= local.vertex && local.vertex < boost::num_vertices(skeleton));
457 return (*
this)[local].get_id();
471 Vertex_handle vh_in_other)
const {
473 assert(vh_in_current_complex);
474 return *vh_in_current_complex;
481 assert(0 <= local.vertex && local.vertex < boost::num_vertices(skeleton));
482 return degree_[local.vertex];
497 const std::pair<Vertex_handle, Vertex_handle>& ab)
const {
498 boost::optional<Edge_handle> res;
499 std::pair<Edge_handle, bool> edge_pair(
500 boost::edge(ab.first.vertex, ab.second.vertex, skeleton));
501 if (edge_pair.second)
502 res = edge_pair.first;
510 return skeleton[edge_handle];
516 const Graph_edge&
operator[](Edge_handle edge_handle)
const {
517 return skeleton[edge_handle];
525 return static_cast<Vertex_handle
> (source(edge_handle, skeleton));
533 return static_cast<Vertex_handle
> (target(edge_handle, skeleton));
542 auto edge((*
this)[edge_handle]);
543 return Simplex((*
this)[edge.first()], (*this)[edge.second()]);
553 Edge_handle
add_edge(Vertex_handle a, Vertex_handle b) {
557 return *((*this)[std::make_pair(a, b)]);
559 add_blockers_after_simplex_insertion(
Simplex(a, b));
567 for (
auto i = s.begin(); i != s.end(); ++i)
568 for (
auto j = i; ++j != s.end(); )
579 assert(contains_vertex(a) && contains_vertex(b));
582 auto edge_handle((*
this)[std::make_pair(a, b)]);
584 edge_handle = boost::add_edge(a.vertex, b.vertex, skeleton).first;
589 visitor->on_add_edge_without_blockers(a, b);
598 for (
auto i = s.begin(); i != s.end(); ++i) {
599 for (
auto j = i; ++j != s.end(); )
608 virtual Edge_handle
remove_edge(Vertex_handle a, Vertex_handle b) {
611 tie(edge, found) = boost::edge(a.vertex, b.vertex, skeleton);
614 visitor->on_remove_edge(a, b);
615 boost::remove_edge(a.vertex, b.vertex, skeleton);
639 while (this->
degree(u) > 0) {
640 Vertex_handle v(*(adjacent_vertices(u.vertex, this->skeleton).first));
652 return boost::edge(a.vertex, b.vertex, skeleton).second;
660 for (
auto i = sigma.begin(); i != sigma.end(); ++i) {
661 if (!contains_vertex(*i))
663 for (
auto j = i; ++j != sigma.end();) {
687 visitor->on_add_blocker(blocker);
688 Blocker_handle blocker_pt =
new Simplex(blocker);
690 auto vertex = blocker_pt->begin();
691 while (vertex != blocker_pt->end()) {
692 blocker_map_.insert(BlockerPair(*vertex, blocker_pt));
709 visitor->on_add_blocker(*blocker);
711 auto vertex = blocker->begin();
712 while (vertex != blocker->end()) {
713 blocker_map_.insert(BlockerPair(*vertex, blocker));
723 void remove_blocker(
const Blocker_handle sigma, Vertex_handle v) {
727 if (*blocker == sigma)
730 if (*blocker != sigma) {
732 <<
"bug ((*blocker).second == sigma) ie try to remove a blocker not present\n";
735 blocker_map_.erase(blocker.current_position());
745 for (
auto vertex : *sigma)
746 remove_blocker(sigma, vertex);
756 while (!blocker_map_.empty()) {
760 blocker_map_.clear();
770 void remove_blocker(
const Simplex& sigma) {
772 for (
auto vertex : sigma)
773 remove_blocker(sigma, vertex);
784 visitor->on_delete_blocker(sigma);
785 remove_blocker(sigma);
826 bool blocks(
const Simplex & sigma)
const {
829 if (sigma.contains(*blocker))
841 virtual void add_neighbours(Vertex_handle v, Simplex & n,
842 bool keep_only_superior =
false)
const {
843 boost_adjacency_iterator ai, ai_end;
844 for (tie(ai, ai_end) = adjacent_vertices(v.vertex, skeleton); ai != ai_end;
846 Vertex_handle value(*ai);
847 if (keep_only_superior) {
848 if (value > v.vertex) {
865 virtual void add_neighbours(
const Simplex &alpha, Simplex & res,
866 bool keep_only_superior =
false)
const {
868 auto alpha_vertex = alpha.begin();
869 add_neighbours(*alpha_vertex, res, keep_only_superior);
870 for (alpha_vertex = (alpha.begin())++; alpha_vertex != alpha.end();
872 keep_neighbours(*alpha_vertex, res, keep_only_superior);
880 virtual void keep_neighbours(Vertex_handle v, Simplex& res,
881 bool keep_only_superior =
false)
const {
883 add_neighbours(v, nv, keep_only_superior);
892 virtual void remove_neighbours(Vertex_handle v, Simplex & res,
893 bool keep_only_superior =
false)
const {
895 add_neighbours(v, nv, keep_only_superior);
905 Link_complex
link(Vertex_handle v)
const {
906 return Link_complex(*
this,
Simplex(v));
912 Link_complex
link(Edge_handle edge)
const {
913 return Link_complex(*
this, edge);
919 Link_complex
link(
const Simplex& simplex)
const {
920 return Link_complex(*
this, simplex);
932 const Root_simplex_handle& s)
const {
933 boost::optional<Simplex> res;
937 for (
auto i = s.begin(); i != s.end(); ++i) {
938 boost::optional<Vertex_handle> address =
get_address(*i);
952 Root_simplex_handle
get_id(
const Simplex& local_simplex)
const {
953 Root_simplex_handle global_simplex;
954 for (
auto x = local_simplex.begin(); x != local_simplex.end(); ++x) {
957 return global_simplex;
978 return num_vertices() == 0;
984 int num_vertices()
const {
986 return num_vertices_;
995 int num_edges()
const {
996 return boost::num_edges(skeleton);
999 int num_triangles()
const {
1001 return std::distance(triangles.begin(), triangles.end());
1007 size_t num_simplices()
const {
1009 return std::distance(simplices.begin(), simplices.end());
1015 size_t num_simplices(
int dimension)
const {
1019 if (s.dimension() == dimension)
1027 size_t num_blockers()
const {
1028 return num_blockers_;
1034 bool complete()
const {
1035 return (num_vertices() * (num_vertices() - 1)) / 2 == num_edges();
1042 int num_vert_collapsed = skeleton.vertex_set().size() - num_vertices();
1043 std::vector<int> component(skeleton.vertex_set().size());
1044 return boost::connected_components(this->skeleton, &component[0])
1045 - num_vert_collapsed;
1053 if (num_vertices() == 0)
1055 if (num_vertices() == 1)
1059 if (blocker_map_.find(vi) == blocker_map_.end()) {
1062 if (degree_[vi.vertex] == num_vertices() - 1)
1113 void update_blockers_after_remove_star_of_vertex_or_edge(
const Simplex& simplex_to_be_removed);
1120 void remove_star(Vertex_handle a, Vertex_handle b);
1139 void add_blockers_after_simplex_insertion(Simplex s);
1144 void remove_blocker_containing_simplex(
const Simplex& sigma);
1149 void remove_blocker_include_in_simplex(
const Simplex& sigma);
1152 enum simplifiable_status {
1153 NOT_HOMOTOPY_EQ, MAYBE_HOMOTOPY_EQ, HOMOTOPY_EQ
1156 simplifiable_status is_remove_star_homotopy_preserving(
const Simplex& simplex) {
1160 return MAYBE_HOMOTOPY_EQ;
1163 enum contractible_status {
1164 NOT_CONTRACTIBLE, MAYBE_CONTRACTIBLE, CONTRACTIBLE
1178 return CONTRACTIBLE;
1180 return MAYBE_CONTRACTIBLE;
1196 bool link_condition(Vertex_handle a, Vertex_handle b,
bool ignore_popable_blockers =
false)
const {
1214 const Graph_edge& edge = (*this)[e];
1217 Vertex_handle a(*this->
get_address(edge.first()));
1218 Vertex_handle b(*this->
get_address(edge.second()));
1228 void tip_blockers(Vertex_handle a, Vertex_handle b, std::vector<Simplex> & buffer)
const;
1239 void swap_edge(Vertex_handle a, Vertex_handle b, Vertex_handle x);
1245 void delete_blockers_around_vertex(Vertex_handle v);
1250 void delete_blockers_around_edge(Vertex_handle a, Vertex_handle b);
1270 void get_blockers_to_be_added_after_contraction(Vertex_handle a, Vertex_handle b,
1271 std::set<Simplex>& blockers_to_add);
1275 void delete_blockers_around_vertices(Vertex_handle a, Vertex_handle b);
1276 void update_edges_after_contraction(Vertex_handle a, Vertex_handle b);
1277 void notify_changed_edges(Vertex_handle a);
1291 typedef boost::iterator_range<Complex_vertex_iterator> Complex_vertex_range;
1297 auto begin = Complex_vertex_iterator(
this);
1298 auto end = Complex_vertex_iterator(
this, 0);
1299 return Complex_vertex_range(begin, end);
1302 typedef Neighbors_vertices_iterator<Skeleton_blocker_complex> Complex_neighbors_vertices_iterator;
1305 typedef boost::iterator_range<Complex_neighbors_vertices_iterator> Complex_neighbors_vertices_range;
1311 auto begin = Complex_neighbors_vertices_iterator(
this, v);
1312 auto end = Complex_neighbors_vertices_iterator(
this, v, 0);
1313 return Complex_neighbors_vertices_range(begin, end);
1325 typedef boost::iterator_range<Complex_edge_iterator> Complex_edge_range;
1331 auto begin = Complex_edge_iterator(
this);
1332 auto end = Complex_edge_iterator(
this, 0);
1333 return Complex_edge_range(begin, end);
1337 typedef Edge_around_vertex_iterator<Skeleton_blocker_complex> Complex_edge_around_vertex_iterator;
1340 typedef boost::iterator_range <Complex_edge_around_vertex_iterator> Complex_edge_around_vertex_range;
1346 Complex_edge_around_vertex_range
edge_range(Vertex_handle v)
const {
1347 auto begin = Complex_edge_around_vertex_iterator(
this, v);
1348 auto end = Complex_edge_around_vertex_iterator(
this, v, 0);
1349 return Complex_edge_around_vertex_range(begin, end);
1364 typedef boost::iterator_range < Triangle_around_vertex_iterator<Skeleton_blocker_complex, Link> >
1365 Complex_triangle_around_vertex_range;
1375 return Complex_triangle_around_vertex_range(begin, end);
1378 typedef boost::iterator_range<Triangle_iterator<Skeleton_blocker_complex> > Complex_triangle_range;
1389 return Complex_triangle_range(end, end);
1392 return Complex_triangle_range(begin, end);
1413 assert(contains_vertex(v));
1415 Complex_simplex_around_vertex_iterator(
this, v),
1416 Complex_simplex_around_vertex_iterator(
this, v,
true));
1432 Complex_simplex_coboundary_iterator(
this, s,
true));
1436 typedef Simplex_iterator<Skeleton_blocker_complex> Complex_simplex_iterator;
1438 typedef boost::iterator_range < Complex_simplex_iterator > Complex_simplex_range;
1444 Complex_simplex_iterator end(
this,
true);
1446 return Complex_simplex_range(end, end);
1448 Complex_simplex_iterator begin(
this);
1449 return Complex_simplex_range(begin, end);
1463 typename std::multimap<Vertex_handle, Simplex *>::iterator,
1471 typename std::multimap<Vertex_handle, Simplex *>::const_iterator,
1472 const Blocker_handle>
1475 typedef boost::iterator_range <Complex_blocker_around_vertex_iterator> Complex_blocker_around_vertex_range;
1476 typedef boost::iterator_range <Const_complex_blocker_around_vertex_iterator>
1477 Const_complex_blocker_around_vertex_range;
1484 auto begin = Complex_blocker_around_vertex_iterator(blocker_map_.lower_bound(v));
1485 auto end = Complex_blocker_around_vertex_iterator(blocker_map_.upper_bound(v));
1486 return Complex_blocker_around_vertex_range(begin, end);
1493 auto begin = Const_complex_blocker_around_vertex_iterator(blocker_map_.lower_bound(v));
1494 auto end = Const_complex_blocker_around_vertex_iterator(blocker_map_.upper_bound(v));
1495 return Const_complex_blocker_around_vertex_range(begin, end);
1503 typename std::multimap<Vertex_handle, Simplex *>::iterator,
1511 typename std::multimap<Vertex_handle, Simplex *>::const_iterator,
1512 const Blocker_handle>
1515 typedef boost::iterator_range <Complex_blocker_iterator> Complex_blocker_range;
1516 typedef boost::iterator_range <Const_complex_blocker_iterator> Const_complex_blocker_range;
1523 auto begin = Complex_blocker_iterator(blocker_map_.begin(), blocker_map_.end());
1524 auto end = Complex_blocker_iterator(blocker_map_.end(), blocker_map_.end());
1525 return Complex_blocker_range(begin, end);
1532 auto begin = Const_complex_blocker_iterator(blocker_map_.begin(), blocker_map_.end());
1533 auto end = Const_complex_blocker_iterator(blocker_map_.end(), blocker_map_.end());
1534 return Const_complex_blocker_range(begin, end);
1544 std::string to_string()
const {
1545 std::ostringstream stream;
1546 stream << num_vertices() <<
" vertices:\n" << vertices_to_string() << std::endl;
1547 stream << num_edges() <<
" edges:\n" << edges_to_string() << std::endl;
1548 stream << num_blockers() <<
" blockers:\n" << blockers_to_string() << std::endl;
1549 return stream.str();
1552 std::string vertices_to_string()
const {
1553 std::ostringstream stream;
1555 stream <<
"{" << (*this)[vertex].get_id() <<
"} ";
1557 stream << std::endl;
1558 return stream.str();
1561 std::string edges_to_string()
const {
1562 std::ostringstream stream;
1564 stream <<
"{" << (*this)[edge].first() <<
"," << (*this)[edge].second() <<
"} ";
1565 stream << std::endl;
1566 return stream.str();
1569 std::string blockers_to_string()
const {
1570 std::ostringstream stream;
1573 stream << *b << std::endl;
1574 return stream.str();
1584 template<
typename Complex,
typename SimplexHandleIterator>
1585 Complex make_complex_from_top_faces(SimplexHandleIterator simplices_begin, SimplexHandleIterator simplices_end,
1586 bool is_flag_complex =
false) {
1588 typedef typename Complex::Simplex
Simplex;
1589 std::vector<Simplex> simplices;
1590 for (
auto top_face = simplices_begin; top_face != simplices_end; ++top_face) {
1591 auto subfaces_topface = subfaces(*top_face);
1592 simplices.insert(simplices.end(), subfaces_topface.begin(), subfaces_topface.end());
1594 return Complex(simplices.begin(), simplices.end(), is_flag_complex);
1599 namespace skbl = skeleton_blocker;
1603 #include "Skeleton_blocker_simplifiable_complex.h" 1605 #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:541
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:608
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:1424
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:1492
Simplicial subcomplex of a complex represented by a skeleton/blockers pair.
Definition: Skeleton_blocker_link_superior.h:32
Abstract simplex used in Skeleton blockers data-structure.
Definition: Skeleton_blocker_simplex.h:50
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:444
Iterator through the blockers of a vertex.
Definition: Skeleton_blockers_blockers_iterators.h:91
bool contains_edge(Vertex_handle a, Vertex_handle b) const
Definition: Skeleton_blocker_complex.h:650
Vertex_handle second_vertex(Edge_handle edge_handle) const
returns the first vertex of an edge
Definition: Skeleton_blocker_complex.h:532
Simplex * Blocker_handle
Handle to a blocker of the complex.
Definition: Skeleton_blocker_complex.h:101
void add_vertex(T v)
Definition: Skeleton_blocker_simplex.h:122
bool contains_blocker(const Blocker_handle s) const
Definition: Skeleton_blocker_complex.h:792
Graph_vertex & operator[](Vertex_handle address)
Return the vertex node associated to local Vertex_handle.
Definition: Skeleton_blocker_complex.h:364
virtual void clear()
Definition: Skeleton_blocker_complex.h:323
int dimension() const
Definition: Skeleton_blocker_simplex.h:209
int degree(Vertex_handle local) const
return the graph degree of a vertex.
Definition: Skeleton_blocker_complex.h:480
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:496
SkeletonBlockerDS::Vertex_handle Vertex_handle
The type of an handle to a vertex of the complex.
Definition: Skeleton_blocker_complex.h:89
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:1346
bool contains_vertices(const Simplex &sigma) const
Definition: Skeleton_blocker_complex.h:433
void difference(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:151
void remove_vertex(T v)
Definition: Skeleton_blocker_simplex.h:129
Complex_simplex_range complex_simplex_range() const
Returns a Complex_simplex_range over all the simplices of the complex.
Definition: Skeleton_blocker_complex.h:1443
void contract_edge(Edge_handle edge)
Definition: Skeleton_blocker_complex.h:1258
Edge_handle add_edge(Vertex_handle a, Vertex_handle b)
Adds an edge between vertices a and b.
Definition: Skeleton_blocker_complex.h:553
bool contains_blocker(const Simplex &s) const
Definition: Skeleton_blocker_complex.h:808
Skeleton_blocker_simplex< Vertex_handle > Simplex
A ordered set of integers that represents a simplex.
Definition: Skeleton_blocker_complex.h:95
void remove_star(Vertex_handle v)
Definition: Skeleton_blocker_simplifiable_complex.h:133
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:183
void set_visitor(Visitor *other_visitor)
allows to change the visitor.
Definition: Skeleton_blocker_complex.h:339
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:1372
Iterator on the vertices of a simplicial complex.
Definition: Skeleton_blockers_vertices_iterators.h:40
Iterator through the blockers of a vertex.
Definition: Skeleton_blockers_blockers_iterators.h:39
Class representing the link of a simplicial complex encoded by a skeleton/blockers pair...
Definition: Skeleton_blocker_link_complex.h:42
Definition: SimplicialComplexForAlpha.h:26
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:165
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:105
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:1386
Complex_edge_range edge_range() const
Returns a Complex_edge_range over all edges of the simplicial complex.
Definition: Skeleton_blocker_complex.h:1330
Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor used in boost ...
Definition: SkeletonBlockerDS.h:59
bool contains_edges(const Simplex &sigma) const
Definition: Skeleton_blocker_complex.h:659
Complex_blocker_range blocker_range()
Returns a range of the blockers of the complex.
Definition: Skeleton_blocker_complex.h:1522
Class representing the link of a simplicial complex encoded by a skeleton/blockers pair...
Definition: Skeleton_blocker_link_superior.h:39
Iterator on the edges of a simplicial complex.
Definition: Skeleton_blockers_edges_iterators.h:97
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:681
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:470
bool contains(const Skeleton_blocker_simplex &a) const
Definition: Skeleton_blocker_simplex.h:240
Root_vertex_handle get_id(Vertex_handle local) const
Definition: Skeleton_blocker_complex.h:455
void add_simplex(const Simplex &sigma)
add a simplex and all its faces.
Definition: Skeleton_blocker_simplifiable_complex.h:209
Iterator over the triangles of the simplicial complex.
Definition: Skeleton_blockers_triangles_iterators.h:114
void remove_edge(Edge_handle edge)
Removes edge and its cofaces from the simplicial complex.
Definition: Skeleton_blocker_complex.h:625
The type of edges that are stored the boost graph. An Edge must be Default Constructible and Equality...
Definition: SkeletonBlockerDS.h:103
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:1483
SkeletonBlockerDS::Graph_edge Graph_edge
The type of stored edge node, specified by the template SkeletonBlockerDS.
Definition: Skeleton_blocker_complex.h:82
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:1407
Graph_edge & operator[](Edge_handle edge_handle)
returns the stored node associated to an edge
Definition: Skeleton_blocker_complex.h:509
virtual bool contains(const Simplex &s) const
returns true iff the simplex s belongs to the simplicial complex.
Definition: Skeleton_blocker_complex.h:964
Definition: Skeleton_blockers_simplices_iterators.h:314
Definition: Skeleton_blockers_simplices_iterators.h:50
Definition: SkeletonBlockerDS.h:68
void intersection(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:136
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:931
Vertex_handle add_vertex()
Adds a vertex to the simplicial complex and returns its Vertex_handle.
Definition: Skeleton_blocker_complex.h:384
Const_complex_blocker_range const_blocker_range() const
Returns a range of the blockers of the complex.
Definition: Skeleton_blocker_complex.h:1531
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:1310
Iterator over the triangles that are adjacent to a vertex of the simplicial complex.
Definition: Skeleton_blockers_triangles_iterators.h:39
bool is_cone() const
Test if the complex is a cone.
Definition: Skeleton_blocker_complex.h:1052
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:635
void remove_vertex(Vertex_handle address)
Remove a vertex from the simplicial complex.
Definition: Skeleton_blocker_complex.h:402
const Graph_edge & operator[](Edge_handle edge_handle) const
returns the stored node associated to an edge
Definition: Skeleton_blocker_complex.h:516
Link_complex link(Vertex_handle v) const
Definition: Skeleton_blocker_complex.h:905
Vertex_handle first_vertex(Edge_handle edge_handle) const
returns the first vertex of an edge
Definition: Skeleton_blocker_complex.h:524
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:952
boost::graph_traits< Graph >::edge_descriptor Edge_handle
Handle to an edge of the complex.
Definition: Skeleton_blocker_complex.h:126
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:754
Complex_vertex_range vertex_range() const
Returns a Complex_vertex_range over all vertices of the complex.
Definition: Skeleton_blocker_complex.h:1296
void add_edge(const Simplex &s)
Adds all edges of s in the complex.
Definition: Skeleton_blocker_complex.h:566
virtual ~Skeleton_blocker_complex()
Definition: Skeleton_blocker_complex.h:314
Link_complex link(const Simplex &simplex) const
Definition: Skeleton_blocker_complex.h:919
bool is_popable_blocker(Blocker_handle sigma) const
Definition: Skeleton_blocker_simplifiable_complex.h:45
Interface for a visitor of a simplicial complex.
Definition: Skeleton_blocker_complex_visitor.h:38
bool operator==(const Skeleton_blocker_complex &other) const
Definition: Skeleton_blocker_complex.h:290
The type of vertices that are stored the boost graph. A Vertex must be Default Constructible and Equa...
Definition: SkeletonBlockerDS.h:79
int num_connected_components() const
returns the number of connected components in the graph of the 1-skeleton.
Definition: Skeleton_blocker_complex.h:1041
const Graph_vertex & operator[](Vertex_handle address) const
Return the vertex node associated to local Vertex_handle.
Definition: Skeleton_blocker_complex.h:374
void delete_blocker(Blocker_handle sigma)
Definition: Skeleton_blocker_complex.h:782
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:1176
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:354
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:578
SkeletonBlockerDS::Graph_vertex Graph_vertex
The type of stored vertex node, specified by the template SkeletonBlockerDS.
Definition: Skeleton_blocker_complex.h:77
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:1412
void add_edge_without_blockers(Simplex s)
Adds all edges of s in the complex without adding blockers.
Definition: Skeleton_blocker_complex.h:597
void remove_blocker(const Blocker_handle sigma)
Removes the simplex from the set of blockers.
Definition: Skeleton_blocker_complex.h:744
Link_complex link(Edge_handle edge) const
Definition: Skeleton_blocker_complex.h:912
Abstract Simplicial Complex represented with a skeleton/blockers pair.
Definition: Skeleton_blocker_complex.h:63
void remove_popable_blockers()
Definition: Skeleton_blocker_simplifiable_complex.h:57
bool link_condition(Edge_handle e, bool ignore_popable_blockers=false) const
Definition: Skeleton_blocker_complex.h:1213
bool link_condition(Vertex_handle a, Vertex_handle b, bool ignore_popable_blockers=false) const
Definition: Skeleton_blocker_complex.h:1196
T first_vertex() const
Definition: Skeleton_blocker_simplex.h:222
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:1429