summaryrefslogtreecommitdiff
path: root/src/Bottleneck_distance/include
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-28 19:22:07 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-28 19:22:07 +0000
commit439fc9387d7a14f486173c7e7b7ff76c4d8cf2c1 (patch)
treea1b6cf95a00e04aec329f853b00c94cc242822d5 /src/Bottleneck_distance/include
parentf7b1a4118e6ef5bd3f78f04f6808a77d3079a618 (diff)
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
Diffstat (limited to 'src/Bottleneck_distance/include')
-rw-r--r--src/Bottleneck_distance/include/gudhi/Graph_matching.h8
1 files changed, 6 insertions, 2 deletions
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<int>& path) {
+ // Making unmatched_in_u an unordered_set<int> 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);