Ticket #8703: trac_8703-trees_addition-dg.patch

File trac_8703-trees_addition-dg.patch, 4.3 KB (added by darij, 6 years ago)

docstrings improved. let's see if this works...

  • sage/combinat/abstract_tree.py

    # HG changeset patch
    # User darij grinberg <darijgrinberg@gmail.com>
    # Date 1362209209 28800
    # Node ID 2138739627609b648a2268e4d72dccafb95e02ae
    # Parent  4725d5410950f729bc7e687e404893f04292c7d9
    [mq]: trac_8703-trees_addition2-dg.patch
    
    diff --git a/sage/combinat/abstract_tree.py b/sage/combinat/abstract_tree.py
    a b class AbstractLabelledTree(AbstractTree) 
    810810
    811811    def as_digraph(self):
    812812        """
    813         Returns a directed graph version of ``self``
     813        Returns a directed graph version of ``self``.
     814       
     815        WARNING:
     816        At this time, the output makes sense only if ``self`` is a
     817        labelled binary tree with no repeated labels and no "None"
     818        labels.
    814819
    815820        EXAMPLES::
    816821
  • sage/combinat/binary_tree.py

    diff --git a/sage/combinat/binary_tree.py b/sage/combinat/binary_tree.py
    a b from sage.misc.lazy_attribute import laz 
    111111
    112112class BinaryTree(AbstractClonableTree, ClonableArray):
    113113    """
    114     The class of binary trees
     114    The class of binary trees. Binary trees here mean ordered (aka plane)
     115    binary trees, meaning that the children of each node are ordered.
    115116
    116117    INPUT:
    117118
    118119    - ``children`` -- ``None`` (default) or a list, tuple or iterable of
    119       length 2 of binary trees or convertible objects. Alternatively a string
    120       is also accepted. The syntax is the same as for printing: empty trees
    121       are denoted by `.` and children are grouped by square brackets.
     120      length 2 of binary trees or convertible objects. This corresponds to
     121      the standard recursive definition of a binary tree as either a leaf
     122      or a pair of binary trees. Syntactic sugar allows leaving out all
     123      but the outermost calls of the ``BinaryTree()`` constructor, so that,
     124      e. g., ``BinaryTree([BinaryTree(None),BinaryTree(None)])`` can be
     125      simplified to ``BinaryTree([None,None])``. It is also allowed to
     126      abbreviate ``[None, None]`` by ``[]``.
    122127
    123128    - ``check`` -- (default to ``True``) whether check for binary should be
    124129      performed or not.
    class BinaryTree(AbstractClonableTree, C (this hunk was shorter than expected) 
    131136
    132137        sage: BinaryTree()
    133138        .
     139        sage: BinaryTree(None)
     140        .
     141        sage: BinaryTree([])
     142        [., .]
    134143        sage: BinaryTree([None, None])
    135144        [., .]
    136145        sage: BinaryTree([None, []])
    class BinaryTree(AbstractClonableTree, C 
    436431        - a leaf is associated to the empty Dyck Word
    437432
    438433        - a tree with chidren `l,r` is associated to the Dyck word
    439           `1 T(l) 0 T(r)` where `T(l)` and `T(r)` are the trees
     434          `1 T(l) 0 T(r)` where `T(l)` and `T(r)` are the Dyck words
    440435          associated to `l` and `r`.
    441436
    442437        EXAMPLES::
    class BinaryTree(AbstractClonableTree, C 
    458453        The *canopee* of a non empty binary tree `T` with `n` internal nodes is
    459454        the list `l` of `0` and `1` of length `n-1` obtained by going along the
    460455        leaves of `T` from left to right except the two extremal ones, writing
    461         `0` if the leaf is a right leaf and `1` is a left leaf.
     456        `0` if the leaf is a right leaf and `1` if the leaf is a left leaf.
    462457
    463458        EXAMPLES::
    464459
  • sage/combinat/ordered_tree.py

    diff --git a/sage/combinat/ordered_tree.py b/sage/combinat/ordered_tree.py
    a b class OrderedTree(AbstractClonableTree,  
    2626    """
    2727    The class for (ordered rooted) Trees
    2828
    29     An ordered tree is a constructed from a node called the root on which one
     29    An ordered tree is constructed from a node called the root on which one
    3030    has grafted a possibly empty list of trees. There is a total order on the
    31     children of a node which is given by the the order of the element in the
     31    children of a node which is given by the order of the element in the
    3232    list. Note that there is no empty ordered tree.
    3333
    3434    INPUT:
    3535    One can create a tree from any list (or more generally iterable) of trees
    3636    or objects convertible to a tree. Alternatively a string is also
    3737    accepted. The syntax is the same as for printing: children are grouped by
    3838    square brackets.
     39    Ordered trees are occasionally called plane trees in literature.
    3940
    4041    EXAMPLES::
    4142
    4243