1
0
Fork 0

Simplify deletion of expanded blossoms

This commit is contained in:
Joris van Rantwijk 2023-02-12 15:04:27 +01:00
parent a1836a585f
commit fa524ce754
1 changed files with 3 additions and 10 deletions

View File

@ -1137,16 +1137,9 @@ class _MatchingContext:
# Delete the expanded blossoms. # Delete the expanded blossoms.
# We do this in one pass over the array to ensure O(n) time. # We do this in one pass over the array to ensure O(n) time.
p = 0 self.nontrivial_blossom = [blossom
for (i, blossom) in enumerate(self.nontrivial_blossom): for blossom in self.nontrivial_blossom
if not blossom.marker: if not blossom.marker]
# Keep this blossom.
if i > p:
self.nontrivial_blossom[p] = blossom
p += 1
# Trim the array.
del self.nontrivial_blossom[p:]
# #
# Augmenting: # Augmenting: