From aab2acd78e142dd5c4f13be0494c021fef6ada2d Mon Sep 17 00:00:00 2001 From: Joris van Rantwijk Date: Sat, 22 Jun 2024 14:28:24 +0200 Subject: [PATCH] Remove redundant clearing of scan queue --- python/mwmatching.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/mwmatching.py b/python/mwmatching.py index 4d33824..f7f61ec 100644 --- a/python/mwmatching.py +++ b/python/mwmatching.py @@ -858,6 +858,8 @@ class _MatchingContext: This function takes time O(n * log(n)). """ + assert not self.scan_queue + # Remove blossom labels and unwind lazy dual updates. for blossom in self.trivial_blossom + self.nontrivial_blossom: if blossom.parent is None: @@ -867,9 +869,6 @@ class _MatchingContext: assert blossom.label == _LABEL_NONE blossom.tree_edge = None - # Clear the scan queue. - self.scan_queue.clear() - # Reset least-slack edge tracking. self.lset_reset() @@ -1121,6 +1120,7 @@ class _MatchingContext: sub.tree_edge = path_edges[p+1] # Delete the expanded blossom. + # TODO -- list manipulation is too slow self.nontrivial_blossom.remove(blossom) def expand_unlabeled_blossom(self, blossom: _NonTrivialBlossom) -> None: @@ -1160,6 +1160,7 @@ class _MatchingContext: sub.delta2_node = self.delta2_queue.insert(prio, sub) # Delete the expanded blossom. + # TODO -- list manipulation is too slow self.nontrivial_blossom.remove(blossom) #