BinTreeNode#
- class tangles.util.tree.BinTreeNode(parent: Node | None = None, left_child: Node | None = None, right_child: Node | None = None)#
Node of a BinTree.
Note: when a node is created, the parent attribute of left_child and of right_child is set to this node.
Parameters#
- parentBinTreeNode, optional
The parent of the node.
- left_childBinTreeNode, optional
The left child of the node.
- right_childBinTreeNode, optional
The right child of the node.
Attributes#
- parentBinTreeNode or None
The parent of the node. If parent is None then the node has no parent.
- left_childBinTreeNode or None
The left child of the node. If left_child is None then the node has no left child.
- right_childBinTreeNode or None
The right child of the node. If right_child is None then the node has no right child.
Methods
Return the list of children of this node
Create a new BinTreeNode (note: this is a kind of abstract base function)
Copy the subtree starting at this node
Replace each child by a copy of the subtree starting at this node
Detach the node by removing its pointer to its parent and the parents pointer to it
Turn an indicator matrix back into a binary tree
Whether this node is a leaf
Find all leaves in the binary tree
Returns the level of this node
Return all the nodes at a certain depth below this node
Returns the list of sides one has to take to go from the root to this node
Set the left child of the node
Set the right child of the node
Turn a list of nodes into an indicator matrix