Skip to content

Commit

Permalink
Trac #16351: Move RecursivelyEnumeratedSet_forest code to sage/sets/r…
Browse files Browse the repository at this point in the history
…ecursively_enumerated_set.pyx, remove deprecated classes SearchForest, TransitiveIdeal, TransitiveIdealGraded

Move the code of `SearchForest` from `sage/combinat/backtrack.py` to
`sage/sets/recursively_enumerated_set.pyx` into a class named
`RecursivelyEnumeratedSet_forest`.

This is a follow up of #6637.

URL: https://trac.sagemath.org/16351
Reported by: slabbe
Ticket author(s): Matthias Koeppe
Reviewer(s): Vincent Delecroix
  • Loading branch information
Release Manager committed Jun 23, 2020
2 parents 5e33139 + 908acba commit c3dfbf5
Show file tree
Hide file tree
Showing 8 changed files with 669 additions and 945 deletions.
8 changes: 4 additions & 4 deletions src/sage/categories/affine_weyl_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def affine_grassmannian_elements_of_given_length(self, k):
:meth:`AffineWeylGroups.ElementMethods.is_affine_grassmannian`
"""
from sage.combinat.backtrack import SearchForest
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest

def select_length(pair):
u, length = pair
Expand All @@ -119,9 +119,9 @@ def succ(pair):
u1.is_affine_grassmannian()):
yield (u1, length + 1)
return
return SearchForest(((self.one(), 0),), succ, algorithm='breadth',
category=FiniteEnumeratedSets(),
post_process=select_length)
return RecursivelyEnumeratedSet_forest(((self.one(), 0),), succ, algorithm='breadth',
category=FiniteEnumeratedSets(),
post_process=select_length)

class ElementMethods:
def is_affine_grassmannian(self):
Expand Down
12 changes: 6 additions & 6 deletions src/sage/categories/coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def weak_order_ideal(self, predicate, side="right", category=None):
.. rubric:: Background
The weak order is returned as a :class:`SearchForest`.
The weak order is returned as a :class:`RecursivelyEnumeratedSet_forest`.
This is achieved by assigning to each element `u1` of the
ideal a single ancestor `u=u1 s_i`, where `i` is the
smallest descent of `u`.
Expand All @@ -474,7 +474,7 @@ def weak_order_ideal(self, predicate, side="right", category=None):
sage: [x.length() for x in W]
[0, 1, 1, 2, 2, 3]
"""
from sage.combinat.backtrack import SearchForest
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest

def succ(u):
for i in u.descents(positive=True, side=side):
Expand All @@ -484,7 +484,7 @@ def succ(u):
return
from sage.categories.finite_coxeter_groups import FiniteCoxeterGroups
default_category = FiniteEnumeratedSets() if self in FiniteCoxeterGroups() else EnumeratedSets()
return SearchForest((self.one(),), succ, algorithm='breadth',
return RecursivelyEnumeratedSet_forest((self.one(),), succ, algorithm='breadth',
category=default_category.or_subcategory(category))

@cached_method
Expand Down Expand Up @@ -1844,7 +1844,7 @@ def binary_factorizations(self, predicate=ConstantFunction(True)):
sage: w0.binary_factorizations().category()
Category of finite enumerated sets
"""
from sage.combinat.backtrack import SearchForest
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest
W = self.parent()
if not predicate(W.one()):
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
Expand All @@ -1857,8 +1857,8 @@ def succ(u_v):
u1 = u * s[i]
if i == u1.first_descent() and predicate(u1):
yield (u1, s[i] * v)
return SearchForest(((W.one(), self),), succ,
category=FiniteEnumeratedSets())
return RecursivelyEnumeratedSet_forest(((W.one(), self),), succ,
category=FiniteEnumeratedSets())

@cached_in_parent_method
def bruhat_lower_covers(self):
Expand Down

0 comments on commit c3dfbf5

Please sign in to comment.