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>
31 #include <gudhi/reader_utils.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>
86 struct Simplex_tree_options_full_featured;
101 template<
typename SimplexTreeOptions = Simplex_tree_options_full_featured>
120 typedef Simplex_tree_node_explicit_storage<Simplex_tree> Node;
125 typedef typename boost::container::flat_map<Vertex_handle, Node> Dictionary;
129 typedef Simplex_tree_siblings<Simplex_tree, Dictionary> Siblings;
131 struct Key_simplex_base_real {
132 Key_simplex_base_real() : key_(-1) {}
138 struct Key_simplex_base_dummy {
139 Key_simplex_base_dummy() {}
143 typedef typename std::conditional<Options::store_key, Key_simplex_base_real, Key_simplex_base_dummy>::type
146 struct Filtration_simplex_base_real {
147 Filtration_simplex_base_real() : filt_(0) {}
149 Filtration_value
filtration()
const {
return filt_; }
151 Filtration_value filt_;
153 struct Filtration_simplex_base_dummy {
154 Filtration_simplex_base_dummy() {}
156 Filtration_value
filtration()
const {
return 0; }
159 Filtration_simplex_base_dummy>::type Filtration_simplex_base;
167 typedef typename Dictionary::iterator Dictionary_it;
168 typedef typename Dictionary_it::value_type Dit_value_t;
170 struct return_first {
234 boost::make_transform_iterator(root_.members_.begin(), return_first()),
235 boost::make_transform_iterator(root_.members_.end(), return_first()));
278 if (filtration_vect_.empty()) {
281 return filtration_vect_;
310 template<
class SimplexHandle>
324 root_(nullptr, null_vertex_),
330 : null_vertex_(simplex_source.null_vertex_),
331 threshold_(simplex_source.threshold_),
332 root_(nullptr, null_vertex_ , simplex_source.root_.members_),
334 dimension_(simplex_source.dimension_) {
335 auto root_source = simplex_source.root_;
340 void rec_copy(Siblings *sib, Siblings *sib_source) {
341 for (
auto sh = sib->members().begin(), sh_source = sib_source->members().begin();
342 sh != sib->members().end(); ++sh, ++sh_source) {
344 Siblings * newsib =
new Siblings(sib, sh_source->first);
345 newsib->members_.reserve(sh_source->second.children()->members().size());
346 for (
auto & child : sh_source->second.children()->members())
347 newsib->members_.emplace_hint(newsib->members_.end(), child.first, Node(newsib, child.second.filtration()));
348 rec_copy(newsib, sh_source->second.children());
349 sh->second.assign_children(newsib);
356 : null_vertex_(std::move(old.null_vertex_)),
357 threshold_(std::move(old.threshold_)),
358 root_(std::move(old.root_)),
359 filtration_vect_(std::move(old.filtration_vect_)),
360 dimension_(std::move(old.dimension_)) {
363 old.root_ = Siblings(
nullptr, null_vertex_);
368 for (
auto sh = root_.members().begin(); sh != root_.members().end(); ++sh) {
370 rec_delete(sh->second.children());
377 void rec_delete(Siblings * sib) {
378 for (
auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) {
380 rec_delete(sh->second.children());
389 if ((null_vertex_ != st2.null_vertex_) ||
390 (threshold_ != st2.threshold_) ||
391 (dimension_ != st2.dimension_))
393 return rec_equal(&root_, &st2.root_);
398 return (!(*
this == st2));
403 bool rec_equal(Siblings* s1, Siblings* s2) {
404 if (s1->members().size() != s2->members().size())
406 for (
auto sh1 = s1->members().begin(), sh2 = s2->members().begin();
407 (sh1 != s1->members().end() && sh2 != s2->members().end()); ++sh1, ++sh2) {
408 if (sh1->first != sh2->first || sh1->second.filtration() != sh2->second.filtration())
414 if (!rec_equal(sh1->second.children(), sh2->second.children()))
427 return sh->second.key();
436 return filtration_vect_[
key];
446 return sh->second.filtration();
457 std::invalid_argument(
"Simplex_tree::assign_filtration - cannot assign filtration on null_simplex"));
458 sh->second.assign_filtration(fv);
471 return Dictionary_it(
nullptr);
488 return root_.members_.size();
500 auto sib_begin = sib->members().begin();
501 auto sib_end = sib->members().end();
502 size_t simplices_number = sib_end - sib_begin;
503 for (
auto sh = sib_begin; sh != sib_end; ++sh) {
508 return simplices_number;
518 while (curr_sib !=
nullptr) {
520 curr_sib = curr_sib->oncles();
532 template<
class SimplexHandle>
534 return (sh->second.children()->parent() == sh->first);
544 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
546 auto first = std::begin(s);
547 auto last = std::end(s);
553 std::vector<Vertex_handle> copy(first, last);
554 std::sort(std::begin(copy), std::end(copy));
555 return find_simplex(copy);
561 Siblings * tmp_sib = &root_;
562 Dictionary_it tmp_dit;
563 Vertex_handle last = simplex.back();
564 for (
auto v : simplex) {
565 tmp_dit = tmp_sib->members_.find(v);
566 if (tmp_dit == tmp_sib->members_.end()) {
572 tmp_sib = tmp_dit->second.children();
581 assert(contiguous_vertices());
582 return root_.members_.begin() + v;
584 return root_.members_.find(v);
590 bool contiguous_vertices()
const {
591 if (root_.members_.empty())
return true;
592 if (root_.members_.begin()->first != 0)
return false;
593 if (std::prev(root_.members_.end())->first != static_cast<Vertex_handle>(root_.members_.size() - 1))
return false;
612 std::pair<Simplex_handle, bool> insert_vertex_vector(
const std::vector<Vertex_handle>& simplex,
614 Siblings * curr_sib = &root_;
615 std::pair<Simplex_handle, bool> res_insert;
616 auto vi = simplex.begin();
617 for (; vi != simplex.end() - 1; ++vi) {
618 res_insert = curr_sib->members_.emplace(*vi, Node(curr_sib, filtration));
620 res_insert.first->second.assign_children(
new Siblings(curr_sib, *vi));
622 curr_sib = res_insert.first->second.children();
624 res_insert = curr_sib->members_.emplace(*vi, Node(curr_sib, filtration));
625 if (!res_insert.second) {
627 if (res_insert.first->second.filtration() >
filtration) {
629 res_insert.first->second.assign_filtration(filtration);
633 return std::pair<Simplex_handle, bool>(
null_simplex(),
false);
663 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
666 auto first = std::begin(simplex);
667 auto last = std::end(simplex);
670 return std::pair<Simplex_handle, bool>(
null_simplex(),
true);
673 std::vector<Vertex_handle> copy(first, last);
674 std::sort(std::begin(copy), std::end(copy));
675 return insert_vertex_vector(copy, filtration);
692 template<
class InputVertexRange = std::initializer_list<Vertex_handle>>
695 auto first = std::begin(Nsimplex);
696 auto last = std::end(Nsimplex);
699 return std::pair<Simplex_handle, bool>(
null_simplex(),
true);
702 std::vector<Vertex_handle> copy(first, last);
703 std::sort(std::begin(copy), std::end(copy));
705 std::vector<std::vector<Vertex_handle>> to_be_inserted;
706 std::vector<std::vector<Vertex_handle>> to_be_propagated;
707 return rec_insert_simplex_and_subfaces(copy, to_be_inserted, to_be_propagated, filtration);
711 std::pair<Simplex_handle, bool> rec_insert_simplex_and_subfaces(std::vector<Vertex_handle>& the_simplex,
712 std::vector<std::vector<Vertex_handle>>& to_be_inserted,
713 std::vector<std::vector<Vertex_handle>>& to_be_propagated,
714 Filtration_value filtration = 0.0) {
715 std::pair<Simplex_handle, bool> insert_result;
716 if (the_simplex.size() > 1) {
718 Vertex_handle last_vertex = the_simplex.back();
719 the_simplex.pop_back();
721 insert_result = rec_insert_simplex_and_subfaces(the_simplex, to_be_inserted, to_be_propagated, filtration);
724 to_be_inserted.insert(to_be_inserted.begin(), to_be_propagated.begin(), to_be_propagated.end());
725 to_be_propagated = to_be_inserted;
728 for (
auto& simplex_tbi : to_be_inserted) {
729 simplex_tbi.push_back(last_vertex);
731 std::vector<Vertex_handle> last_simplex(1, last_vertex);
732 to_be_inserted.insert(to_be_inserted.begin(), last_simplex);
740 for (
auto& simplex_tbi : to_be_inserted) {
741 insert_result = insert_vertex_vector(simplex_tbi, filtration);
743 }
else if (the_simplex.size() == 1) {
745 if ((to_be_inserted.size() != 0) || (to_be_propagated.size() != 0)) {
746 std::cerr <<
"Simplex_tree::rec_insert_simplex_and_subfaces - Error vector not empty\n";
749 std::vector<Vertex_handle> first_simplex(1, the_simplex.back());
751 to_be_inserted.push_back(first_simplex);
753 insert_result = insert_vertex_vector(first_simplex, filtration);
755 std::cerr <<
"Simplex_tree::rec_insert_simplex_and_subfaces - Recursivity error\n";
758 return insert_result;
765 sh->second.assign_key(key);
773 return { find_vertex(sh->first), find_vertex(
self_siblings(sh)->parent()) };
777 template<
class SimplexHandle>
779 if (sh->second.children()->parent() == sh->first)
780 return sh->second.children()->oncles();
782 return sh->second.children();
812 filtration_vect_.clear();
815 filtration_vect_.push_back(sh);
827 tbb::parallel_sort(filtration_vect_.begin(), filtration_vect_.end(), is_before_in_filtration(
this));
829 std::stable_sort(filtration_vect_.begin(), filtration_vect_.end(), is_before_in_filtration(
this));
846 void rec_coface(std::vector<Vertex_handle> &vertices, Siblings *curr_sib,
int curr_nbVertices,
847 std::vector<Simplex_handle>& cofaces,
bool star,
int nbVertices) {
848 if (!(star || curr_nbVertices <= nbVertices))
850 for (
Simplex_handle simplex = curr_sib->members().begin(); simplex != curr_sib->members().end(); ++
simplex) {
851 if (vertices.empty()) {
856 bool addCoface = (star || curr_nbVertices == nbVertices);
858 cofaces.push_back(simplex);
860 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
862 if (simplex->first == vertices.back()) {
864 bool equalDim = (star || curr_nbVertices == nbVertices);
865 bool addCoface = vertices.size() == 1 && equalDim;
867 cofaces.push_back(simplex);
870 Vertex_handle tmp = vertices.back();
872 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
873 vertices.push_back(tmp);
875 }
else if (simplex->first > vertices.back()) {
880 rec_coface(vertices, simplex->second.children(), curr_nbVertices + 1, cofaces, star, nbVertices);
906 assert(codimension >= 0);
908 std::vector<Vertex_handle> copy(rg.begin(), rg.end());
909 if (codimension + static_cast<int>(copy.size()) > dimension_ + 1 ||
910 (codimension == 0 && static_cast<int>(copy.size()) > dimension_))
913 assert(std::is_sorted(copy.begin(), copy.end(), std::greater<Vertex_handle>()));
914 bool star = codimension == 0;
915 rec_coface(copy, &root_, 1, cofaces, star, codimension + static_cast<int>(copy.size()));
932 while (it1 != rg1.end() && it2 != rg2.end()) {
940 return ((it1 == rg1.end()) && (it2 != rg2.end()));
949 struct is_before_in_filtration {
955 if (sh1->second.filtration() != sh2->second.filtration()) {
956 return sh1->second.filtration() < sh2->second.filtration();
959 return st_->reverse_lexicographic_order(sh1, sh2);
984 template<
class OneSkeletonGraph>
989 if (boost::num_vertices(skel_graph) == 0) {
992 if (num_edges(skel_graph) == 0) {
998 root_.members_.reserve(boost::num_vertices(skel_graph));
1000 typename boost::graph_traits<OneSkeletonGraph>::vertex_iterator v_it,
1002 for (std::tie(v_it, v_it_end) = boost::vertices(skel_graph); v_it != v_it_end;
1004 root_.members_.emplace_hint(
1005 root_.members_.end(), *v_it,
1006 Node(&root_, boost::get(vertex_filtration_t(), skel_graph, *v_it)));
1008 typename boost::graph_traits<OneSkeletonGraph>::edge_iterator e_it,
1010 for (std::tie(e_it, e_it_end) = boost::edges(skel_graph); e_it != e_it_end;
1012 auto u = source(*e_it, skel_graph);
1013 auto v = target(*e_it, skel_graph);
1016 auto sh = find_vertex(u);
1018 sh->second.assign_children(
new Siblings(&root_, sh->first));
1021 sh->second.children()->members().emplace(
1023 Node(sh->second.children(),
1024 boost::get(edge_filtration_t(), skel_graph, *e_it)));
1041 dimension_ = max_dim;
1042 for (Dictionary_it root_it = root_.members_.begin();
1043 root_it != root_.members_.end(); ++root_it) {
1045 siblings_expansion(root_it->second.children(), max_dim - 1);
1048 dimension_ = max_dim - dimension_;
1053 void siblings_expansion(Siblings * siblings,
1055 if (dimension_ > k) {
1060 Dictionary_it next = siblings->members().begin();
1063 static std::vector<std::pair<Vertex_handle, Node> > inter;
1064 for (Dictionary_it s_h = siblings->members().begin();
1065 s_h != siblings->members().end(); ++s_h, ++next) {
1071 siblings->members().end(),
1072 root_sh->second.children()->members().begin(),
1073 root_sh->second.children()->members().end(),
1074 s_h->second.filtration());
1075 if (inter.size() != 0) {
1076 Siblings * new_sib =
new Siblings(siblings,
1080 s_h->second.assign_children(new_sib);
1081 siblings_expansion(new_sib, k - 1);
1084 s_h->second.assign_children(siblings);
1093 static void intersection(std::vector<std::pair<Vertex_handle, Node> >& intersection,
1094 Dictionary_it begin1, Dictionary_it end1,
1095 Dictionary_it begin2, Dictionary_it end2,
1096 Filtration_value filtration_) {
1097 if (begin1 == end1 || begin2 == end2)
1100 if (begin1->first == begin2->first) {
1101 Filtration_value filt = (std::max)({begin1->second.filtration(), begin2->second.filtration(), filtration_});
1102 intersection.emplace_back(begin1->first, Node(
nullptr, filt));
1103 if (++begin1 == end1 || ++begin2 == end2)
1105 }
else if (begin1->first < begin2->first) {
1106 if (++begin1 == end1)
1109 if (++begin2 == end2)
1127 os <<
key(b_sh) <<
" ";
1143 bool modified =
false;
1145 for (
auto& simplex : boost::adaptors::reverse(root_.members())) {
1147 modified |= rec_make_filtration_non_decreasing(simplex.second.children());
1158 bool rec_make_filtration_non_decreasing(Siblings * sib) {
1159 bool modified =
false;
1162 for (
auto& simplex : boost::adaptors::reverse(sib->members())) {
1170 Filtration_value max_filt_border_value =
filtration(*max_border);
1171 if (simplex.second.filtration() < max_filt_border_value) {
1174 simplex.second.assign_filtration(max_filt_border_value);
1177 modified |= rec_make_filtration_non_decreasing(simplex.second.children());
1193 return rec_prune_above_filtration(
root(), filtration);
1197 bool rec_prune_above_filtration(Siblings* sib, Filtration_value filt) {
1198 auto&& list = sib->members();
1199 auto last = std::remove_if(list.begin(), list.end(), [=](Dit_value_t&
simplex) {
1200 if (simplex.second.filtration() <= filt)
return false;
1201 if (
has_children(&simplex)) rec_delete(simplex.second.children());
1205 bool modified = (last != list.end());
1206 if (last == list.begin() && sib !=
root()) {
1208 sib->oncles()->members()[sib->parent()].assign_children(sib->oncles());
1213 list.erase(last, list.end());
1214 for (
auto&& simplex : list)
1216 modified |= rec_prune_above_filtration(simplex.second.children(), filt);
1231 std::invalid_argument(
"Simplex_tree::remove_maximal_simplex - argument has children"));
1234 Siblings* child = sh->second.children();
1236 if ((child->size() > 1) || (child ==
root())) {
1242 child->oncles()->members().at(child->parent()).assign_children(child->oncles());
1248 Vertex_handle null_vertex_;
1250 Filtration_value threshold_;
1255 std::vector<Simplex_handle> filtration_vect_;
1261 template<
typename...T>
1262 std::ostream& operator<<(std::ostream & os, Simplex_tree<T...> & st) {
1263 for (
auto sh : st.filtration_simplex_range()) {
1264 os << st.dimension(sh) <<
" ";
1265 for (
auto v : st.simplex_vertex_range(sh)) {
1268 os << st.filtration(sh) <<
"\n";
1273 template<
typename...T>
1274 std::istream& operator>>(std::istream & is, Simplex_tree<T...> & st) {
1275 typedef Simplex_tree<T...> ST;
1276 std::vector<typename ST::Vertex_handle> simplex;
1277 typename ST::Filtration_value fil;
1278 typename ST::Filtration_value max_fil = 0;
1280 while (read_simplex(is, simplex, fil)) {
1283 int dim =
static_cast<int> (simplex.size() - 1);
1284 if (max_dim < dim) {
1287 if (max_fil < fil) {
1291 st.insert_simplex(simplex, fil);
1294 st.set_dimension(max_dim);
1295 st.set_filtration(max_fil);
1303 typedef int Vertex_handle;
1304 typedef double Filtration_value;
1305 typedef int Simplex_key;
1306 static const bool store_key =
true;
1307 static const bool store_filtration =
true;
1308 static const bool contiguous_vertices =
false;
1316 typedef int Vertex_handle;
1317 typedef float Filtration_value;
1318 typedef int Simplex_key;
1319 static const bool store_key =
true;
1320 static const bool store_filtration =
true;
1321 static const bool contiguous_vertices =
true;
1328 #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:215
Dictionary::iterator Simplex_handle
Handle type to a simplex contained in the simplicial complex represented by the simplex tree...
Definition: Simplex_tree.h:164
bool prune_above_filtration(Filtration_value filtration)
Prune above filtration value given as parameter.
Definition: Simplex_tree.h:1192
void expansion(int max_dim)
Expands the Simplex_tree containing only its one skeleton until dimension max_dim.
Definition: Simplex_tree.h:1040
Filtration_simplex_range::const_iterator Filtration_simplex_iterator
Iterator over the simplices of the simplicial complex, ordered by the filtration. ...
Definition: Simplex_tree.h:224
Tag for a linear ordering of simplices.
Definition: indexing_tag.h:32
Simplex Tree data structure for representing simplicial complexes.
Definition: Simplex_tree.h:102
Siblings * self_siblings(SimplexHandle sh)
Definition: Simplex_tree.h:778
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:693
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:764
bool operator==(Simplex_tree &st2)
Checks if two simplex trees are equal.
Definition: Simplex_tree.h:388
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:426
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:470
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:190
Simplex_tree_simplex_vertex_iterator< Simplex_tree > Simplex_vertex_iterator
Iterator over the vertices of a simplex.
Definition: Simplex_tree.h:194
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:482
void print_hasse(std::ostream &os)
Write the hasse diagram of the simplicial complex in os.
Definition: Simplex_tree.h:1122
Siblings * root()
Definition: Simplex_tree.h:787
Simplex_tree(Simplex_tree &&old)
User-defined move constructor moves the whole tree structure.
Definition: Simplex_tree.h:355
Filtration_value filtration() const
Returns an upper bound of the filtration values of the simplices.
Definition: Simplex_tree.h:462
Options::Simplex_key Simplex_key
Key associated to each simplex.
Definition: Simplex_tree.h:113
bool operator!=(Simplex_tree &st2)
Checks if two simplex trees are different.
Definition: Simplex_tree.h:397
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:1142
std::vector< Simplex_handle > Filtration_simplex_range
Range over the simplices of the simplicial complex, ordered by the filtration.
Definition: Simplex_tree.h:220
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:277
void initialize_filtration()
Initializes the filtrations, i.e. sort the simplices according to their order in the filtration and i...
Definition: Simplex_tree.h:811
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:545
Cofaces_simplex_range cofaces_simplex_range(const Simplex_handle simplex, int codimension)
Compute the cofaces of a n simplex.
Definition: Simplex_tree.h:903
Complex_simplex_range complex_simplex_range()
Returns a range over the simplices of the simplicial complex.
Definition: Simplex_tree.h:243
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:455
std::pair< Simplex_handle, Simplex_handle > endpoints(Simplex_handle sh)
Definition: Simplex_tree.h:771
Boundary_simplex_range boundary_simplex_range(SimplexHandle sh)
Returns a range over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:311
int dimension() const
Returns an upper bound on the dimension of the simplicial complex.
Definition: Simplex_tree.h:526
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:232
Simplex_vertex_range simplex_vertex_range(Simplex_handle sh)
Returns a range over the vertices of a simplex.
Definition: Simplex_tree.h:290
Options::Vertex_handle Vertex_handle
Type for the vertex handle.
Definition: Simplex_tree.h:117
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:257
boost::iterator_range< Boundary_simplex_iterator > Boundary_simplex_range
Range over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:204
void set_filtration(Filtration_value fil)
Definition: Simplex_tree.h:792
Cofaces_simplex_range star_simplex_range(const Simplex_handle simplex)
Compute the star of a n simplex.
Definition: Simplex_tree.h:892
void set_dimension(int dimension)
Definition: Simplex_tree.h:797
bool has_children(SimplexHandle sh) const
Returns true if the node in the simplex tree pointed by sh has children.
Definition: Simplex_tree.h:533
Simplex_handle simplex(Simplex_key key) const
Returns the simplex associated to a key.
Definition: Simplex_tree.h:435
int dimension(Simplex_handle sh)
Returns the dimension of a simplex.
Definition: Simplex_tree.h:515
static Simplex_key null_key()
Returns a key different for all keys associated to the simplices of the simplicial complex...
Definition: Simplex_tree.h:476
static Filtration_value filtration(Simplex_handle sh)
Returns the filtration value of a simplex.
Definition: Simplex_tree.h:444
Definition: Simplex_tree.h:1314
Model of SimplexTreeOptions.
Definition: Simplex_tree.h:1301
boost::transform_iterator< return_first, Dictionary_it > Complex_vertex_iterator
Iterator over the vertices of the simplicial complex.
Definition: Simplex_tree.h:188
~Simplex_tree()
Destructor; deallocates the whole tree structure.
Definition: Simplex_tree.h:367
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition: Simplex_tree.h:487
void remove_maximal_simplex(Simplex_handle sh)
Remove a maximal simplex.
Definition: Simplex_tree.h:1228
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:493
boost::iterator_range< Complex_simplex_iterator > Complex_simplex_range
Range over the simplices of the simplicial complex.
Definition: Simplex_tree.h:210
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition: Simplex_tree.h:109
Simplex_tree()
Constructs an empty simplex tree.
Definition: Simplex_tree.h:321
Simplex_tree_boundary_simplex_iterator< Simplex_tree > Boundary_simplex_iterator
Iterator over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:202
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:218
Simplex_tree_complex_simplex_iterator< Simplex_tree > Complex_simplex_iterator
Iterator over the simplices of the simplicial complex.
Definition: Simplex_tree.h:208
void insert_graph(const OneSkeletonGraph &skel_graph)
Inserts a 1-skeleton in an empty Simplex_tree.
Definition: Simplex_tree.h:985
Simplex_tree(const Simplex_tree &simplex_source)
User-defined copy constructor reproduces the whole tree structure.
Definition: Simplex_tree.h:329
boost::iterator_range< Simplex_vertex_iterator > Simplex_vertex_range
Range over the vertices of a simplex.
Definition: Simplex_tree.h:196
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:664
void rec_copy(Siblings *sib, Siblings *sib_source)
depth first search, inserts simplices when reaching a leaf.
Definition: Simplex_tree.h:340
std::vector< Simplex_handle > Cofaces_simplex_range
Range over the cofaces of a simplex.
Definition: Simplex_tree.h:198