From 439fc9387d7a14f486173c7e7b7ff76c4d8cf2c1 Mon Sep 17 00:00:00 2001 From: glisse Date: Tue, 28 Mar 2017 19:22:07 +0000 Subject: Longer comments git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck-glisse@2270 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fa5f87490ae2b94cbe6b4789001b0075f8a4726a --- src/Bottleneck_distance/include/gudhi/Graph_matching.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h index 6e024146..c4775b07 100644 --- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h +++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h @@ -157,14 +157,18 @@ inline Layered_neighbors_finder Graph_matching::layering() const { } inline void Graph_matching::update(std::vector& path) { + // Making unmatched_in_u an unordered_set is simpler and almost as fast. #if 0 - // Avoid an expensive erase in the middle of the vector, but break the ordering, so the search needs to be linear. + // Avoid an expensive erase in the middle of the vector, but break the + // ordering, so the search needs to be linear. auto p = std::find(unmatched_in_u.begin(), unmatched_in_u.end(), path.front()); assert(p != unmatched_in_u.end()); std::swap(*p, unmatched_in_u.back()); unmatched_in_u.pop_back(); #else - // Take advantage of the vector being sorted, but pay an expensive erase to maintain the order. + // Take advantage of the vector being sorted, but pay an expensive erase to + // maintain the order. This is essentially the same as making unmatched_in_u + // a boost flat_set. auto p = std::lower_bound(unmatched_in_u.begin(), unmatched_in_u.end(), path.front()); assert(p != unmatched_in_u.end() && *p == path.front()); unmatched_in_u.erase(p); -- cgit v1.2.3