Skip to content

Commit

Permalink
avoid copy of graph
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Oct 10, 2024
1 parent 93c0c8b commit 17f72fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sage/combinat/posets/posets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8961,8 +8961,9 @@ def __iter__(self):
for dig in it:
# We need to relabel the digraph since range(self._n) must be a linear
# extension. Too bad we need to compute this again. TODO: Fix this.
label_dict = dict(zip(dig.topological_sort(), range(dig.order())))
yield FinitePoset(dig.relabel(label_dict, inplace=False))
label_dict = dict(zip(dig.topological_sort(), range(self._n)))
dig.relabel(label_dict, inplace=True)
yield FinitePoset(dig)

def cardinality(self, from_iterator=False):
r"""
Expand Down

0 comments on commit 17f72fa

Please sign in to comment.