summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test/simplex_tree_unit_test.cpp
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-17 18:14:39 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-12-17 18:14:39 +0000
commitf538a1fac876b84edf87bb0d95d70413295e2330 (patch)
tree6c3bbaaa1154873e3f0dbef96f0afe473d05159d /src/Simplex_tree/test/simplex_tree_unit_test.cpp
parenta910ec9af137d8cd2d0d41ca17bbbc5d5ee8e77b (diff)
Fix graph insertion.
It currently ignores edge (i, j) with j<i, but nothing in the concept forbids such an edge. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/misc-glisse@3080 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 305f58b4995878da23b0fa07dc783c0bdceab6db
Diffstat (limited to 'src/Simplex_tree/test/simplex_tree_unit_test.cpp')
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index 580d610a..f63ea080 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -863,3 +863,35 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) {
BOOST_CHECK(st == st_other_copy);
}
+
+BOOST_AUTO_TEST_CASE(insert_graph) {
+ std::cout << "********************************************************************" << std::endl;
+ std::cout << "INSERT GRAPH" << std::endl;
+ typedef typename boost::adjacency_list<boost::vecS, boost::vecS,
+ boost::undirectedS,
+ boost::property<vertex_filtration_t, double>,
+ boost::property<edge_filtration_t, double>> Graph;
+ Graph g(3);
+ // filtration value 0 everywhere
+ put(Gudhi::vertex_filtration_t(), g, 0, 0);
+ put(Gudhi::vertex_filtration_t(), g, 1, 0);
+ put(Gudhi::vertex_filtration_t(), g, 2, 0);
+ // vertices don't always occur in sorted order
+ add_edge(0, 1, 0, g);
+ add_edge(2, 1, 0, g);
+ add_edge(2, 0, 0, g);
+
+ typedef Simplex_tree<> typeST;
+ typeST st1;
+ st1.insert_graph(g);
+ BOOST_CHECK(st1.num_simplices() == 6);
+
+ // edges can have multiplicity in the graph unless we replace the first vecS with (hash_)setS
+ add_edge(1, 0, 0, g);
+ add_edge(1, 2, 0, g);
+ add_edge(0, 2, 0, g);
+ add_edge(0, 2, 0, g);
+ typeST st2;
+ st2.insert_graph(g);
+ BOOST_CHECK(st2.num_simplices() == 6);
+}