Tree Objects

Tree, Forest, ForestSum and TensorProductSum classes.

The classes Tree, Forest and ForestSum are immutable and hashable. The hash is generated in such a way that two elements of the same class which are equivalent (e.g. two different orderings of the same tree) will have the same hash. However, this is not the case across classes. For example, for a Tree t, hash(t), hash(t.as_forest()) and hash(t.as_forest_sum()) are different.

The class Tree is totally ordered by the lexicographic ordering. If the trees have the same structure but are colored differently, they are ordered based on color, with the color of the highest levels of the trees being the primary ordering.

Non-Planar Types

Planar Types

Shared Types