Tree.add
- Tree.add(node, parent=None)[source]
Add a node to the tree.
- Parameters:
- node
compas.datastructures.TreeNode
The node to add.
- parent
compas.datastructures.TreeNode
, optional The parent node of the node to add. Default is
None
, in which case the node is added as a root node.
- node
- Returns:
- None
- Raises:
- TypeError
If the node is not a
compas.datastructures.TreeNode
object. If the supplied parent node is not acompas.datastructures.TreeNode
object.- ValueError
If the node is already part of another tree. If the supplied parent node is not part of this tree. If the tree already has a root node, when trying to add a root node.