codist.tree
Tree utilities and type definitions.
Module Attributes
A singleton used in change operations |
|
A tree type. |
Functions
|
Postorder traversal of keyroot indices for keyroots in \(T\) |
|
The postorder traversal of \(l(i)\) for each index \(i\) in \(T\) |
|
The postorder enumeration of the indices of the parent of each node, The root of the tree has the parent Lambda (i.e. indicating no parent). |
|
A postorder traversal of the node data in |
|
Small convenience function to help construct trees |
- Lambda: Final[str] = 'Λ'
A singleton used in change operations
- Tree: type[tuple[T, tuple[Tree[T], ...]]] = Tree
A tree type. A tree is any tuple of the form:
Tree[T] = tuple[T, tuple[Tree[T], ...]]
- keyroots(tree: Tree) tuple[int, ...]
Postorder traversal of keyroot indices for keyroots in \(T\)
- leftmosts(tree: Tree) tuple[int, ...]
The postorder traversal of \(l(i)\) for each index \(i\) in \(T\)
- parents(tree: Tree) tuple[int | Lambda, ...]
The postorder enumeration of the indices of the parent of each node, The root of the tree has the parent Lambda (i.e. indicating no parent)
- postorder(tree: Tree) tuple[T, ...]
A postorder traversal of the node data in
tree
- t(root: T, *children: Tree) Tree
Small convenience function to help construct trees