mode.utils.trees¶
Data structure: Trees.
- class mode.utils.trees.Node(data: T, *, root: Optional[NodeT] = None, parent: Optional[NodeT] = None, children: Optional[list[mode.utils.types.trees.NodeT[T]]] = None)¶
Tree node.
Notes
Nodes have a link to
the
.rootnode (or None if this is the top-most node)the
.parentnode (if this is a child node).a list of children
A Node may have arbitrary
.dataassociated with it, and arbitrary data may also be stored in.children.- Parameters:
data (Any) – Data to associate with node.
- Keyword Arguments:
- as_graph() DependencyGraphT¶
Convert to
DependencyGraph.
- property depth: int¶
- discard(data: T) None¶
Remove node so it’s no longer a child of this node.
- property path: str¶