diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2019-01-22 08:55:53 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2019-01-22 08:55:53 +0000 |
commit | e2487023711a163b51e403330fa6efb982badd59 (patch) | |
tree | 6056d4ae61c1289a4f348cced82c5994ae5d205b /src/Simplex_tree/include/gudhi/Simplex_tree.h | |
parent | e105da964b96218459c8822816de36273f6cdf17 (diff) | |
parent | 453fc857c70a5168eed639545faa903f48e84c9c (diff) |
Merge of adjacency_list_direction_improvement branch.
Test and benchmark of directed, undirected and bidirectionnal adjacency list.
Use of directed when possible as it is the more efficient.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@4069 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 1ab5c9e741ea57d734e3ee34f207c6790b132a48
Diffstat (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree.h')
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 78697ea2..4b18651c 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1049,7 +1049,8 @@ class Simplex_tree { * boost::graph_traits<OneSkeletonGraph>::vertex_descriptor * must be Vertex_handle. * boost::graph_traits<OneSkeletonGraph>::directed_category - * must be undirected_tag. + * can be directed_tag (the fastest, the least RAM use), undirected_tag or even + * bidirected_tag. * * If an edge appears with multiplicity, the function will arbitrarily pick * one representative to read the filtration value. */ @@ -1077,12 +1078,14 @@ class Simplex_tree { root_.members_.end(), *v_it, Node(&root_, boost::get(vertex_filtration_t(), skel_graph, *v_it))); } - typename boost::graph_traits<OneSkeletonGraph>::edge_iterator e_it, - e_it_end; - for (std::tie(e_it, e_it_end) = boost::edges(skel_graph); e_it != e_it_end; - ++e_it) { - auto u = source(*e_it, skel_graph); - auto v = target(*e_it, skel_graph); + std::pair<typename boost::graph_traits<OneSkeletonGraph>::edge_iterator, + typename boost::graph_traits<OneSkeletonGraph>::edge_iterator> boost_edges = boost::edges(skel_graph); + // boost_edges.first is the equivalent to boost_edges.begin() + // boost_edges.second is the equivalent to boost_edges.end() + for (; boost_edges.first != boost_edges.second; boost_edges.first++) { + auto edge = *(boost_edges.first); + auto u = source(edge, skel_graph); + auto v = target(edge, skel_graph); if (u == v) throw "Self-loops are not simplicial"; // We cannot skip edges with the wrong orientation and expect them to // come a second time with the right orientation, that does not always @@ -1098,7 +1101,7 @@ class Simplex_tree { } sh->second.children()->members().emplace(v, - Node(sh->second.children(), boost::get(edge_filtration_t(), skel_graph, *e_it))); + Node(sh->second.children(), boost::get(edge_filtration_t(), skel_graph, edge))); } } |