#19457: Generator for full binary trees
-------------------------------------+-------------------------------------
Reporter: patxiku | Owner: patxiku
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-7.1
Component: combinatorics | Resolution:
Keywords: binary trees, | Merged in:
full | Reviewers:
Authors: Adrien | Work issues:
Boussicault, Bérénice Delcroix- | Commit:
Oger, Patxi Laborde-Zubieta | e6b47af34b45ca5bfe40c67464e75f895cd71596
Report Upstream: N/A | Stopgaps:
Branch: |
u/patxiku/generator_for_full_binary_trees|
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: needs_review => needs_work
* milestone: sage-6.10 => sage-7.1
Old description:
> We add a generator for full binary trees, and two methods :
> - to_full() :
> Return the full binary tree `bt` obtained from ``self`` by
> replacing
> each leaf of ``self`` by nodes with two child leaves.
>
> - remove_nodes_with_two_child_leaves()
> Return the binary tree obtained by replacing each node of
> ``self``
> with two child leaves, by a leaf.
New description:
We add a generator for full binary trees, and two methods :
- to_full() :
Return the full binary tree `bt` obtained from `self` by replacing
each leaf of `self` by nodes with two child leaves.
- remove_nodes_with_two_child_leaves()
Return the binary tree obtained by replacing each node of `self`
with two child leaves, by a leaf.
--
Comment:
This is not an appropriate docstring
{{{
TODO : A name for nodes with two child leaves should be defined.
}}}
As mentioned in [comment:7 comment:7], why aren't you using facade parents
in both `FullBinaryTrees_all` and `FullBinaryTrees_size`? This is designed
for parents for which elements have other parents. Like non negative
integers
{{{
sage: NN.an_element().parent()
Integer Ring
}}}
Moreover, you should not provide yourself `element_class`. This is
intended to be done by the constructor of `Parent` from the nested class
`Element`. In the case of a facade it makes no sense to have either a
nested class `Element` or an `element_class`. Namely, the
`_element_constructor_` should be something like
{{{
def _element_constructor_(self, data):
return BinaryTree(data)
}}}
You should put definitions of `FullBinaryTrees`.
Avoid such call if possible
{{{
for lft in self.__class__(2*i+1):
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/19457#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.