-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide an iterative version on some functions on trees #39519
base: develop
Are you sure you want to change the base?
Conversation
src/sage/combinat/abstract_tree.py
Outdated
if not subtree.is_empty(): | ||
stack.append(subtree) | ||
else: | ||
stack.pop() | ||
node = stack.pop() | ||
action(node) | ||
|
||
def contour_traversal(self,first_action=None, middle_action=None, final_action=None, leaf_action=[]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def contour_traversal(self,first_action=None, middle_action=None, final_action=None, leaf_action=[]): | |
def contour_traversal(self, first_action=None, middle_action=None, final_action=None, leaf_action=None): |
I don't see why leaf_action
should not be None
by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want that if you change only first_action
and final_action
, leaf_action
will be the action of both of them but it's perhaps a bad idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, can you give an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the depth code : i only change the final_action
and it change accordingly the leaf_action
.
I would like it to work like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think again at this point and I think you are right, it's probably better that the default leaf_action
is None.
I made the change in the last commit.
Co-authored-by: Martin Rubey <[email protected]>
to fix the tests and the linter Co-authored-by: Oscfon <[email protected]>
attention, je me suis permis de faire quelques modifs, il faut faire "git pull" pour les recevoir localement avant de travailler a nouveau |
last fix for the linter
Documentation preview for this PR (built with commit f35c7d6; changes) is ready! 🎉 |
y a trois tests qui ne passent pas |
J'avais oublié une dépendance. Ça devrait être bon |
This pull request provide iterative methods on AbstractTrees which work both on OrderedTree and BinaryTree.
The problem was that some functions like node_number reach the recursion limit on huge instances.
📝 Checklist