23 #ifndef SIMPLEX_TREE_H_ 24 #define SIMPLEX_TREE_H_ 26 #include <gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h> 27 #include <gudhi/Simplex_tree/Simplex_tree_siblings.h> 28 #include <gudhi/Simplex_tree/Simplex_tree_iterators.h> 29 #include <gudhi/Simplex_tree/indexing_tag.h> 32 #include <gudhi/graph_simplicial_complex.h> 33 #include <gudhi/Debug_utils.h> 35 #include <boost/container/flat_map.hpp> 36 #include <boost/iterator/transform_iterator.hpp> 37 #include <boost/graph/adjacency_list.hpp> 38 #include <boost/range/adaptor/reversed.hpp> 41 #include <tbb/parallel_sort.h> 49 #include <initializer_list> 55 struct Simplex_tree_options_full_featured;
70 template<
typename SimplexTreeOptions = Simplex_tree_options_full_featured>
89 typedef Simplex_tree_node_explicit_storage<Simplex_tree> Node;
94 typedef typename boost::container::flat_map<Vertex_handle, Node> Dictionary;
98 typedef Simplex_tree_siblings<Simplex_tree, Dictionary> Siblings;
100 struct Key_simplex_base_real {
101 Key_simplex_base_real() : key_(-1) {}
103 Simplex_key
key()
const {
return key_; }
107 struct Key_simplex_base_dummy {
108 Key_simplex_base_dummy() {}
110 Simplex_key
key()
const { assert(
false);
return -1; }
112 typedef typename std::conditional<Options::store_key, Key_simplex_base_real, Key_simplex_base_dummy>::type
115 struct Filtration_simplex_base_real {
116 Filtration_simplex_base_real() : filt_(0) {}
118 Filtration_value
filtration()
const {
return filt_; }
120 Filtration_value filt_;
122 struct Filtration_simplex_base_dummy {
123 Filtration_simplex_base_dummy() {}
125 Filtration_value
filtration()
const {
return 0; }
128 Filtration_simplex_base_dummy>::type Filtration_simplex_base;
136 typedef typename Dictionary::iterator Dictionary_it;
137 typedef typename Dictionary_it::value_type Dit_value_t;
139 struct return_first {
140 Vertex_handle operator()(
const Dit_value_t& p_sh)
const {
203 boost::make_transform_iterator(root_.members_.begin(), return_first()),
204 boost::make_transform_iterator(root_.members_.end(), return_first()));
247 if (filtration_vect_.empty()) {
250 return filtration_vect_;
279 template<
class SimplexHandle>
292 root_(nullptr, null_vertex_),
298 : null_vertex_(simplex_source.null_vertex_),
299 root_(nullptr, null_vertex_ , simplex_source.root_.members_),
301 dimension_(simplex_source.dimension_) {
302 auto root_source = simplex_source.root_;
307 void rec_copy(Siblings *sib, Siblings *sib_source) {
308 for (
auto sh = sib->members().begin(), sh_source = sib_source->members().begin();
309 sh != sib->members().end(); ++sh, ++sh_source) {
311 Siblings * newsib =
new Siblings(sib, sh_source->first);
312 newsib->members_.reserve(sh_source->second.children()->members().size());
313 for (
auto & child : sh_source->second.children()->members())
314 newsib->members_.emplace_hint(newsib->members_.end(), child.first, Node(newsib, child.second.filtration()));
315 rec_copy(newsib, sh_source->second.children());
316 sh->second.assign_children(newsib);
323 : null_vertex_(std::move(old.null_vertex_)),
324 root_(std::move(old.root_)),
325 filtration_vect_(std::move(old.filtration_vect_)),
326 dimension_(std::move(old.dimension_)) {
328 old.root_ = Siblings(
nullptr, null_vertex_);
333 for (
auto sh = root_.members().begin(); sh != root_.members().end(); ++sh) {
335 rec_delete(sh->second.children());
342 void rec_delete(Siblings * sib) {
343 for (
auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) {
345 rec_delete(sh->second.children());
354 if ((null_vertex_ != st2.null_vertex_) ||
355 (dimension_ != st2.dimension_))
357 return rec_equal(&root_, &st2.root_);
362 return (!(*
this == st2));
367 bool rec_equal(Siblings* s1, Siblings* s2) {
368 if (s1->members().size() != s2->members().size())
370 for (
auto sh1 = s1->members().begin(), sh2 = s2->members().begin();
371 (sh1 != s1->members().end() && sh2 != s2->members().end()); ++sh1, ++sh2) {
372 if (sh1->first != sh2->first || sh1->second.filtration() != sh2->second.filtration())
378 if (!rec_equal(sh1->second.children(), sh2->second.children()))
390 static Simplex_key
key(Simplex_handle sh) {
391 return sh->second.key();
400 return filtration_vect_[
key];
410 return sh->second.filtration();
412 return std::numeric_limits<Filtration_value>::infinity();
421 std::invalid_argument(
"Simplex_tree::assign_filtration - cannot assign filtration on null_simplex"));
422 sh->second.assign_filtration(fv);
430 return Dictionary_it(
nullptr);
447 return root_.members_.size();
459 auto sib_begin = sib->members().begin();
460 auto sib_end = sib->members().end();
461 size_t simplices_number = sib_end - sib_begin;
462 for (
auto sh = sib_begin; sh != sib_end; ++sh) {
467 return simplices_number;
477 while (curr_sib !=
nullptr) {
479 curr_sib = curr_sib->oncles();
491 template<
class SimplexHandle>
493 return (sh->second.children()->parent() == sh->first);
503 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
504 Simplex_handle
find(
const InputVertexRange & s) {
505 auto first = std::begin(s);
506 auto last = std::end(s);
512 std::vector<Vertex_handle> copy(first, last);
513 std::sort(std::begin(copy), std::end(copy));
514 return find_simplex(copy);
519 Simplex_handle find_simplex(
const std::vector<Vertex_handle> &
simplex) {
520 Siblings * tmp_sib = &root_;
521 Dictionary_it tmp_dit;
522 Vertex_handle last = simplex.back();
523 for (
auto v : simplex) {
524 tmp_dit = tmp_sib->members_.find(v);
525 if (tmp_dit == tmp_sib->members_.end()) {
531 tmp_sib = tmp_dit->second.children();
538 Simplex_handle find_vertex(Vertex_handle v) {
540 assert(contiguous_vertices());
541 return root_.members_.begin() + v;
543 return root_.members_.find(v);
549 bool contiguous_vertices()
const {
550 if (root_.members_.empty())
return true;
551 if (root_.members_.begin()->first != 0)
return false;
552 if (std::prev(root_.members_.end())->first != static_cast<Vertex_handle>(root_.members_.size() - 1))
return false;
571 std::pair<Simplex_handle, bool> insert_vertex_vector(
const std::vector<Vertex_handle>& simplex,
573 Siblings * curr_sib = &root_;
574 std::pair<Simplex_handle, bool> res_insert;
575 auto vi = simplex.begin();
576 for (; vi != simplex.end() - 1; ++vi) {
577 res_insert = curr_sib->members_.emplace(*vi, Node(curr_sib, filtration));
579 res_insert.first->second.assign_children(
new Siblings(curr_sib, *vi));
581 curr_sib = res_insert.first->second.children();
583 res_insert = curr_sib->members_.emplace(*vi, Node(curr_sib, filtration));
584 if (!res_insert.second) {
586 if (res_insert.first->second.filtration() >
filtration) {
588 res_insert.first->second.assign_filtration(filtration);
592 return std::pair<Simplex_handle, bool>(
null_simplex(),
false);
622 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
624 Filtration_value filtration = 0) {
625 auto first = std::begin(simplex);
626 auto last = std::end(simplex);
629 return std::pair<Simplex_handle, bool>(
null_simplex(),
true);
632 std::vector<Vertex_handle> copy(first, last);
633 std::sort(std::begin(copy), std::end(copy));
634 return insert_vertex_vector(copy, filtration);
651 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
653 Filtration_value filtration = 0) {
654 auto first = std::begin(Nsimplex);
655 auto last = std::end(Nsimplex);
658 return std::pair<Simplex_handle, bool>(
null_simplex(),
true);
661 std::vector<Vertex_handle> copy(first, last);
662 std::sort(std::begin(copy), std::end(copy));
664 std::vector<std::vector<Vertex_handle>> to_be_inserted;
665 std::vector<std::vector<Vertex_handle>> to_be_propagated;
666 return rec_insert_simplex_and_subfaces(copy, to_be_inserted, to_be_propagated, filtration);
670 std::pair<Simplex_handle, bool> rec_insert_simplex_and_subfaces(std::vector<Vertex_handle>& the_simplex,
671 std::vector<std::vector<Vertex_handle>>& to_be_inserted,
672 std::vector<std::vector<Vertex_handle>>& to_be_propagated,
673 Filtration_value filtration = 0.0) {
674 std::pair<Simplex_handle, bool> insert_result;
675 if (the_simplex.size() > 1) {
677 Vertex_handle last_vertex = the_simplex.back();
678 the_simplex.pop_back();
680 insert_result = rec_insert_simplex_and_subfaces(the_simplex, to_be_inserted, to_be_propagated, filtration);
683 to_be_inserted.insert(to_be_inserted.begin(), to_be_propagated.begin(), to_be_propagated.end());
684 to_be_propagated = to_be_inserted;
687 for (
auto& simplex_tbi : to_be_inserted) {
688 simplex_tbi.push_back(last_vertex);
690 std::vector<Vertex_handle> last_simplex(1, last_vertex);
691 to_be_inserted.insert(to_be_inserted.begin(), last_simplex);
699 for (
auto& simplex_tbi : to_be_inserted) {
700 insert_result = insert_vertex_vector(simplex_tbi, filtration);
702 }
else if (the_simplex.size() == 1) {
704 if ((to_be_inserted.size() != 0) || (to_be_propagated.size() != 0)) {
705 std::cerr <<
"Simplex_tree::rec_insert_simplex_and_subfaces - Error vector not empty\n";
708 std::vector<Vertex_handle> first_simplex(1, the_simplex.back());
710 to_be_inserted.push_back(first_simplex);
712 insert_result = insert_vertex_vector(first_simplex, filtration);
714 std::cerr <<
"Simplex_tree::rec_insert_simplex_and_subfaces - Recursivity error\n";
717 return insert_result;
724 sh->second.assign_key(key);
730 std::pair<Simplex_handle, Simplex_handle>
endpoints(Simplex_handle sh) {
732 return { find_vertex(sh->first), find_vertex(
self_siblings(sh)->parent()) };
736 template<
class SimplexHandle>
738 if (sh->second.children()->parent() == sh->first)
739 return sh->second.children()->oncles();
741 return sh->second.children();
766 filtration_vect_.clear();
769 filtration_vect_.push_back(sh);
781 tbb::parallel_sort(filtration_vect_.begin(), filtration_vect_.end(), is_before_in_filtration(
this));
783 std::stable_sort(filtration_vect_.begin(), filtration_vect_.end(), is_before_in_filtration(
this));
800 void rec_coface(std::vector<Vertex_handle> &vertices, Siblings *curr_sib,
int curr_nbVertices,
801 std::vector<Simplex_handle>& cofaces,
bool star,
int nbVertices) {
802 if (!(star || curr_nbVertices <= nbVertices))
804 for (Simplex_handle simplex = curr_sib->members().begin(); simplex != curr_sib->members().end(); ++
simplex) {
805 if (vertices.empty()) {
810 bool addCoface = (star || curr_nbVertices == nbVertices);
812 cofaces.push_back(simplex);
814 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
816 if (simplex->first == vertices.back()) {
818 bool equalDim = (star || curr_nbVertices == nbVertices);
819 bool addCoface = vertices.size() == 1 && equalDim;
821 cofaces.push_back(simplex);
824 Vertex_handle tmp = vertices.back();
826 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
827 vertices.push_back(tmp);
829 }
else if (simplex->first > vertices.back()) {
834 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
858 Cofaces_simplex_range cofaces;
860 assert(codimension >= 0);
862 std::vector<Vertex_handle> copy(rg.begin(), rg.end());
863 if (codimension + static_cast<int>(copy.size()) > dimension_ + 1 ||
864 (codimension == 0 && static_cast<int>(copy.size()) > dimension_))
867 assert(std::is_sorted(copy.begin(), copy.end(), std::greater<Vertex_handle>()));
868 bool star = codimension == 0;
869 rec_coface(copy, &root_, 1, cofaces, star, codimension + static_cast<int>(copy.size()));
881 bool reverse_lexicographic_order(Simplex_handle sh1, Simplex_handle sh2) {
884 Simplex_vertex_iterator it1 = rg1.begin();
885 Simplex_vertex_iterator it2 = rg2.begin();
886 while (it1 != rg1.end() && it2 != rg2.end()) {
894 return ((it1 == rg1.end()) && (it2 != rg2.end()));
903 struct is_before_in_filtration {
907 bool operator()(
const Simplex_handle sh1,
const Simplex_handle sh2)
const {
909 if (sh1->second.filtration() != sh2->second.filtration()) {
910 return sh1->second.filtration() < sh2->second.filtration();
913 return st_->reverse_lexicographic_order(sh1, sh2);
938 template<
class OneSkeletonGraph>
943 if (boost::num_vertices(skel_graph) == 0) {
946 if (num_edges(skel_graph) == 0) {
952 root_.members_.reserve(boost::num_vertices(skel_graph));
954 typename boost::graph_traits<OneSkeletonGraph>::vertex_iterator v_it,
956 for (std::tie(v_it, v_it_end) = boost::vertices(skel_graph); v_it != v_it_end;
958 root_.members_.emplace_hint(
959 root_.members_.end(), *v_it,
960 Node(&root_, boost::get(vertex_filtration_t(), skel_graph, *v_it)));
962 typename boost::graph_traits<OneSkeletonGraph>::edge_iterator e_it,
964 for (std::tie(e_it, e_it_end) = boost::edges(skel_graph); e_it != e_it_end;
966 auto u = source(*e_it, skel_graph);
967 auto v = target(*e_it, skel_graph);
970 auto sh = find_vertex(u);
972 sh->second.assign_children(
new Siblings(&root_, sh->first));
975 sh->second.children()->members().emplace(
977 Node(sh->second.children(),
978 boost::get(edge_filtration_t(), skel_graph, *e_it)));
995 dimension_ = max_dim;
996 for (Dictionary_it root_it = root_.members_.begin();
997 root_it != root_.members_.end(); ++root_it) {
999 siblings_expansion(root_it->second.children(), max_dim - 1);
1002 dimension_ = max_dim - dimension_;
1007 void siblings_expansion(Siblings * siblings,
1009 if (dimension_ > k) {
1014 Dictionary_it next = siblings->members().begin();
1017 thread_local std::vector<std::pair<Vertex_handle, Node> > inter;
1018 for (Dictionary_it s_h = siblings->members().begin();
1019 s_h != siblings->members().end(); ++s_h, ++next) {
1020 Simplex_handle root_sh = find_vertex(s_h->first);
1025 siblings->members().end(),
1026 root_sh->second.children()->members().begin(),
1027 root_sh->second.children()->members().end(),
1028 s_h->second.filtration());
1029 if (inter.size() != 0) {
1030 Siblings * new_sib =
new Siblings(siblings,
1034 s_h->second.assign_children(new_sib);
1035 siblings_expansion(new_sib, k - 1);
1038 s_h->second.assign_children(siblings);
1047 static void intersection(std::vector<std::pair<Vertex_handle, Node> >& intersection,
1048 Dictionary_it begin1, Dictionary_it end1,
1049 Dictionary_it begin2, Dictionary_it end2,
1050 Filtration_value filtration_) {
1051 if (begin1 == end1 || begin2 == end2)
1054 if (begin1->first == begin2->first) {
1055 Filtration_value filt = (std::max)({begin1->second.filtration(), begin2->second.filtration(), filtration_});
1056 intersection.emplace_back(begin1->first, Node(
nullptr, filt));
1057 if (++begin1 == end1 || ++begin2 == end2)
1059 }
else if (begin1->first < begin2->first) {
1060 if (++begin1 == end1)
1063 if (++begin2 == end2)
1081 os <<
key(b_sh) <<
" ";
1097 bool modified =
false;
1099 for (
auto& simplex : boost::adaptors::reverse(root_.members())) {
1101 modified |= rec_make_filtration_non_decreasing(simplex.second.children());
1112 bool rec_make_filtration_non_decreasing(Siblings * sib) {
1113 bool modified =
false;
1116 for (
auto& simplex : boost::adaptors::reverse(sib->members())) {
1119 Boundary_simplex_iterator max_border = std::max_element(std::begin(boundary), std::end(boundary),
1120 [](Simplex_handle sh1, Simplex_handle sh2) {
1124 Filtration_value max_filt_border_value =
filtration(*max_border);
1125 if (simplex.second.filtration() < max_filt_border_value) {
1128 simplex.second.assign_filtration(max_filt_border_value);
1131 modified |= rec_make_filtration_non_decreasing(simplex.second.children());
1147 return rec_prune_above_filtration(
root(), filtration);
1151 bool rec_prune_above_filtration(Siblings* sib, Filtration_value filt) {
1152 auto&& list = sib->members();
1153 auto last = std::remove_if(list.begin(), list.end(), [=](Dit_value_t&
simplex) {
1154 if (simplex.second.filtration() <= filt)
return false;
1155 if (
has_children(&simplex)) rec_delete(simplex.second.children());
1159 bool modified = (last != list.end());
1160 if (last == list.begin() && sib !=
root()) {
1162 sib->oncles()->members()[sib->parent()].assign_children(sib->oncles());
1167 list.erase(last, list.end());
1168 for (
auto&& simplex : list)
1170 modified |= rec_prune_above_filtration(simplex.second.children(), filt);
1185 std::invalid_argument(
"Simplex_tree::remove_maximal_simplex - argument has children"));
1188 Siblings* child = sh->second.children();
1190 if ((child->size() > 1) || (child ==
root())) {
1196 child->oncles()->members().at(child->parent()).assign_children(child->oncles());
1202 Vertex_handle null_vertex_;
1207 std::vector<Simplex_handle> filtration_vect_;
1213 template<
typename...T>
1225 template<
typename...T>
1228 std::vector<typename ST::Vertex_handle>
simplex;
1229 typename ST::Filtration_value fil;
1234 int dim =
static_cast<int> (simplex.size() - 1);
1235 if (max_dim < dim) {
1256 static const bool store_key =
true;
1257 static const bool store_filtration =
true;
1258 static const bool contiguous_vertices =
false;
1272 static const bool store_key =
true;
1273 static const bool store_filtration =
true;
1274 static const bool contiguous_vertices =
true;
1281 #endif // SIMPLEX_TREE_H_ Simplex_tree_skeleton_simplex_iterator< Simplex_tree > Skeleton_simplex_iterator
Iterator over the simplices of the skeleton of the simplicial complex, for a given dimension...
Definition: Simplex_tree.h:184
Dictionary::iterator Simplex_handle
Handle type to a simplex contained in the simplicial complex represented by the simplex tree...
Definition: Simplex_tree.h:133
bool prune_above_filtration(Filtration_value filtration)
Prune above filtration value given as parameter.
Definition: Simplex_tree.h:1146
void expansion(int max_dim)
Expands the Simplex_tree containing only its one skeleton until dimension max_dim.
Definition: Simplex_tree.h:994
Filtration_simplex_range::const_iterator Filtration_simplex_iterator
Iterator over the simplices of the simplicial complex, ordered by the filtration. ...
Definition: Simplex_tree.h:193
Tag for a linear ordering of simplices.
Definition: indexing_tag.h:32
Simplex Tree data structure for representing simplicial complexes.
Definition: Simplex_tree.h:71
Siblings * self_siblings(SimplexHandle sh)
Definition: Simplex_tree.h:737
std::pair< Simplex_handle, bool > insert_simplex_and_subfaces(const InputVertexRange &Nsimplex, Filtration_value filtration=0)
Insert a N-simplex and all his subfaces, from a N-simplex represented by a range of Vertex_handles...
Definition: Simplex_tree.h:652
void assign_key(Simplex_handle sh, Simplex_key key)
Assign a value 'key' to the key of the simplex represented by the Simplex_handle 'sh'.
Definition: Simplex_tree.h:723
bool read_simplex(std::istream &in_, std::vector< Vertex_handle > &simplex, Filtration_value &fil)
Read a face from a file.
Definition: reader_utils.h:170
bool operator==(Simplex_tree &st2)
Checks if two simplex trees are equal.
Definition: Simplex_tree.h:353
Concept describing an indexing scheme (see FilteredComplex) for applying continuous maps to a cell co...
Definition: IndexingTag.h:30
static Simplex_key key(Simplex_handle sh)
Returns the key associated to a simplex.
Definition: Simplex_tree.h:390
static Simplex_handle null_simplex()
Returns a Simplex_handle different from all Simplex_handles associated to the simplices in the simpli...
Definition: Simplex_tree.h:429
static constexpr bool contiguous_vertices
If true, the list of vertices present in the complex must always be 0, ..., num_vertices-1, without any hole.
Definition: SimplexTreeOptions.h:41
boost::iterator_range< Complex_vertex_iterator > Complex_vertex_range
Range over the vertices of the simplicial complex.
Definition: Simplex_tree.h:159
Simplex_tree_simplex_vertex_iterator< Simplex_tree > Simplex_vertex_iterator
Iterator over the vertices of a simplex.
Definition: Simplex_tree.h:163
Definition: SimplicialComplexForAlpha.h:26
Vertex_handle null_vertex() const
Returns a Vertex_handle different from all Vertex_handles associated to the vertices of the simplicia...
Definition: Simplex_tree.h:441
void print_hasse(std::ostream &os)
Write the hasse diagram of the simplicial complex in os.
Definition: Simplex_tree.h:1076
Key type used as simplex identifier.
Definition: SimplexKey.h:27
Siblings * root()
Definition: Simplex_tree.h:746
Simplex_tree(Simplex_tree &&old)
User-defined move constructor moves the whole tree structure.
Definition: Simplex_tree.h:322
Options::Simplex_key Simplex_key
Key associated to each simplex.
Definition: Simplex_tree.h:82
bool operator!=(Simplex_tree &st2)
Checks if two simplex trees are different.
Definition: Simplex_tree.h:361
bool make_filtration_non_decreasing()
Browse the simplex tree to ensure the filtration is not decreasing. The simplex tree is browsed start...
Definition: Simplex_tree.h:1096
std::vector< Simplex_handle > Filtration_simplex_range
Range over the simplices of the simplicial complex, ordered by the filtration.
Definition: Simplex_tree.h:189
Filtration_simplex_range const & filtration_simplex_range(Indexing_tag=Indexing_tag())
Returns a range over the simplices of the simplicial complex, in the order of the filtration...
Definition: Simplex_tree.h:246
void initialize_filtration()
Initializes the filtrations, i.e. sort the simplices according to their order in the filtration and i...
Definition: Simplex_tree.h:765
Simplex_handle find(const InputVertexRange &s)
Given a range of Vertex_handles, returns the Simplex_handle of the simplex in the simplicial complex ...
Definition: Simplex_tree.h:504
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:32
Cofaces_simplex_range cofaces_simplex_range(const Simplex_handle simplex, int codimension)
Compute the cofaces of a n simplex.
Definition: Simplex_tree.h:857
Complex_simplex_range complex_simplex_range()
Returns a range over the simplices of the simplicial complex.
Definition: Simplex_tree.h:212
Concept of the template parameter for the class Gudhi::Simplex_tree<SimplexTreeOptions>.
Definition: SimplexTreeOptions.h:27
void assign_filtration(Simplex_handle sh, Filtration_value fv)
Sets the filtration value of a simplex. In debug mode, if sh is a null_simplex.
Definition: Simplex_tree.h:419
std::pair< Simplex_handle, Simplex_handle > endpoints(Simplex_handle sh)
Definition: Simplex_tree.h:730
Boundary_simplex_range boundary_simplex_range(SimplexHandle sh)
Returns a range over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:280
int dimension() const
Returns an upper bound on the dimension of the simplicial complex.
Definition: Simplex_tree.h:485
Complex_vertex_range complex_vertex_range()
Returns a range over the vertices of the simplicial complex. The order is increasing according to < o...
Definition: Simplex_tree.h:201
Simplex_vertex_range simplex_vertex_range(Simplex_handle sh)
Returns a range over the vertices of a simplex.
Definition: Simplex_tree.h:259
Options::Vertex_handle Vertex_handle
Type for the vertex handle.
Definition: Simplex_tree.h:86
Skeleton_simplex_range skeleton_simplex_range(int dim)
Returns a range over the simplices of the dim-skeleton of the simplicial complex. ...
Definition: Simplex_tree.h:226
boost::iterator_range< Boundary_simplex_iterator > Boundary_simplex_range
Range over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:173
Cofaces_simplex_range star_simplex_range(const Simplex_handle simplex)
Compute the star of a n simplex.
Definition: Simplex_tree.h:846
void set_dimension(int dimension)
Definition: Simplex_tree.h:751
bool has_children(SimplexHandle sh) const
Returns true if the node in the simplex tree pointed by sh has children.
Definition: Simplex_tree.h:492
Simplex_handle simplex(Simplex_key key) const
Returns the simplex associated to a key.
Definition: Simplex_tree.h:399
int dimension(Simplex_handle sh)
Returns the dimension of a simplex.
Definition: Simplex_tree.h:474
static Simplex_key null_key()
Returns a key different for all keys associated to the simplices of the simplicial complex...
Definition: Simplex_tree.h:435
static Filtration_value filtration(Simplex_handle sh)
Returns the filtration value of a simplex.
Definition: Simplex_tree.h:408
Definition: Simplex_tree.h:1267
Definition: Simplex_tree.h:1251
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:27
boost::transform_iterator< return_first, Dictionary_it > Complex_vertex_iterator
Iterator over the vertices of the simplicial complex.
Definition: Simplex_tree.h:157
~Simplex_tree()
Destructor; deallocates the whole tree structure.
Definition: Simplex_tree.h:332
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition: Simplex_tree.h:446
void remove_maximal_simplex(Simplex_handle sh)
Remove a maximal simplex.
Definition: Simplex_tree.h:1182
static const bool store_filtration
If true, each simplex has extra storage for one Filtration_value, and this value is propagated by ope...
Definition: SimplexTreeOptions.h:39
size_t num_simplices()
returns the number of simplices in the simplex_tree.
Definition: Simplex_tree.h:452
boost::iterator_range< Complex_simplex_iterator > Complex_simplex_range
Range over the simplices of the simplicial complex.
Definition: Simplex_tree.h:179
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition: Simplex_tree.h:78
Simplex_tree()
Constructs an empty simplex tree.
Definition: Simplex_tree.h:290
Simplex_tree_boundary_simplex_iterator< Simplex_tree > Boundary_simplex_iterator
Iterator over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:171
boost::iterator_range< Skeleton_simplex_iterator > Skeleton_simplex_range
Range over the simplices of the skeleton of the simplicial complex, for a given dimension.
Definition: Simplex_tree.h:187
Simplex_tree_complex_simplex_iterator< Simplex_tree > Complex_simplex_iterator
Iterator over the simplices of the simplicial complex.
Definition: Simplex_tree.h:177
void insert_graph(const OneSkeletonGraph &skel_graph)
Inserts a 1-skeleton in an empty Simplex_tree.
Definition: Simplex_tree.h:939
Simplex_tree(const Simplex_tree &simplex_source)
User-defined copy constructor reproduces the whole tree structure.
Definition: Simplex_tree.h:297
This file includes common file reader for GUDHI.
boost::iterator_range< Simplex_vertex_iterator > Simplex_vertex_range
Range over the vertices of a simplex.
Definition: Simplex_tree.h:165
std::pair< Simplex_handle, bool > insert_simplex(const InputVertexRange &simplex, Filtration_value filtration=0)
Insert a simplex, represented by a range of Vertex_handles, in the simplicial complex.
Definition: Simplex_tree.h:623
void rec_copy(Siblings *sib, Siblings *sib_source)
depth first search, inserts simplices when reaching a leaf.
Definition: Simplex_tree.h:307
std::vector< Simplex_handle > Cofaces_simplex_range
Range over the cofaces of a simplex.
Definition: Simplex_tree.h:167