diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-08-25 15:33:05 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-08-25 15:33:05 +0000 |
commit | 3e9006eeb1c731e63fce5aa71802997284abe461 (patch) | |
tree | 8054cac2411c6cd83d2e8e632dbc455c0b2843a2 /src/Simplex_tree/include | |
parent | eead3066ec52bdc1eaedf5d6bbd3957ce711b036 (diff) |
Code review : dimension_ is now set on the fly
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/graph_expansion_with_blocker_oracle@2634 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 12974878db3242c442c09268437de4d56e704593
Diffstat (limited to 'src/Simplex_tree/include')
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index b1767f63..ee173c70 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1102,23 +1102,20 @@ class Simplex_tree { */ template< typename Blocker > void expansion_with_blockers(int max_dim, Blocker block_simplex) { - dimension_ = max_dim; // Loop must be from the end to the beginning, as higher dimension simplex are always on the left part of the tree for (auto& simplex : boost::adaptors::reverse(root_.members())) { if (has_children(&simplex)) { - siblings_expansion_with_blockers(simplex.second.children(), max_dim - 1, block_simplex); + siblings_expansion_with_blockers(simplex.second.children(), max_dim, max_dim - 1, block_simplex); } } - dimension_ = max_dim - dimension_; } private: /** \brief Recursive expansion with blockers of the simplex tree.*/ template< typename Blocker > - void siblings_expansion_with_blockers(Siblings* siblings, // must contain elements - int k, Blocker block_simplex) { - if (dimension_ > k) { - dimension_ = k; + void siblings_expansion_with_blockers(Siblings* siblings, int max_dim, int k, Blocker block_simplex) { + if (dimension_ < max_dim - k) { + dimension_ = max_dim - k; } if (k == 0) return; @@ -1170,7 +1167,7 @@ class Simplex_tree { } else { // ensure recursive call simplex->second.assign_children(new_sib); - siblings_expansion_with_blockers(new_sib, k - 1, block_simplex); + siblings_expansion_with_blockers(new_sib, max_dim, k - 1, block_simplex); } } else { // ensure the children property |