Unordered Trees

class pybs.unordered_tree.unordered_trees.UnorderedTree[source]

Class whose elements represents unabeled, unordered rooted trees.

A tree is represented as a multiset of child trees. That is, the internal organization closely resemples the notation \(\tau = [\tau_1^{m_1}, \dots, \tau_k^{m_k}]\) known from the literature.

__init__(arg)[source]

Initiate a tree from arguments.

Possible arguments include strings of the format [[],[]], another UnorderedTree and a list/tuple of trees.

butcher_product(other)[source]

Return the Butcher product \(self \circ other\)

The Butcher product is formed by adding other to the multiset of children of self.

order()[source]

Return the total number of vertexes in a tree.

density()[source]

Return the density, \(\gamma\), of a tree.

symmetry()[source]

Return the symmetry, \(\sigma\), of a tree.

alpha()[source]

Return the \(\alpha\) of a tree.

F()[source]

Return elementary differential as a string.

The returned string is not really suitable for further calculations.

is_binary()[source]

Check if the UnorderedTree is a binary tree.

is_tall()[source]

Check if the UnorderedTree is a tall tree.

is_bushy()[source]

Check if the UnorderedTree is a bushy tree.

get_free_tree()[source]

Return the FreeTree representative of self.

Note that the returned object is not necessarily complete in the sense that it knows about all rooted trees it represents. To make sure the rooted tree is complete, call the_trees[self.order()].free_trees().

__str__()[source]

Return a string representation of the format [[],[]].

__eq__(other)[source]

Check if two UnorderedTrees are equal.

Done by checking that other is indeed an Unordered tree, and the test equality as ClonableMultisets.

__cmp__(other)[source]

Ordering due to P.Leone (2000) PhD thesis.

This is a total ordering. For most purposes it is just used to define a suitable bijection between \(T\) and \(\mathbb{N}\).

_planar_forest_str()[source]

Return string for package planar forest.

Slightly different string representation, e.g. b[b,b].

_is_symmetric()[source]

Used to check if free trees are symmetric.