diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 5b92c90804..0effd69a34 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1342,6 +1342,13 @@ class Simplex_tree { return Dit_value_t(v, Node(&root_, filt)); }); root_.members_.insert(boost::begin(verts), boost::end(verts)); if (dimension_ < 0 && !root_.members_.empty()) dimension_ = 0; + if constexpr (Options::link_nodes_by_label) { + for (auto sh = root_.members().begin(); sh != root_.members().end(); sh++) { + // update newly inserted simplex (the one that are not linked) + if (!sh->second.list_max_vertex_hook_.is_linked()) + update_simplex_tree_after_node_insertion(sh); + } + } } /** \brief Expands the Simplex_tree containing only its one skeleton diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index 60cb32d5c8..de1303e1e2 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -1157,8 +1157,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_boundaries_and_opposite_vertex_iterat } } -BOOST_AUTO_TEST_CASE(batch_vertices) { - typedef Simplex_tree<> typeST; +typedef boost::mpl::list, + Simplex_tree, + Simplex_tree > + list_of_tested_variants_wo_fast_persistence; + +BOOST_AUTO_TEST_CASE_TEMPLATE(batch_vertices, typeST, list_of_tested_variants_wo_fast_persistence) { std::clog << "********************************************************************" << std::endl; std::clog << "TEST BATCH VERTEX INSERTION" << std::endl; typeST st; @@ -1169,6 +1173,16 @@ BOOST_AUTO_TEST_CASE(batch_vertices) { BOOST_CHECK(st.num_simplices() == 4); BOOST_CHECK(st.filtration(st.find({2})) == 0.); BOOST_CHECK(st.filtration(st.find({3})) == 1.5); + + for (auto coface : st.star_simplex_range(st.find({5}))) { + std::clog << "coface"; + for (auto vertex : st.simplex_vertex_range(coface)) { + std::clog << " " << vertex; + // Should be the only one + BOOST_CHECK(vertex == 5); + } + std::clog << "\n"; + } } BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_clear, typeST, list_of_tested_variants) {