simple_hierarchy.tree¶
A module for a tree structure for a class hierarchy.
- class simple_hierarchy.tree.Node(name, n_classes, parent)[source]¶
Bases:
object
Stores a node with name and number of classes.
Used to store a node with a name of number of classes. This class is inteded for storing class heiarchies, as such, their is both a name and number of classes per node. The node is linked to a list of children and its parent.
- Parameters
name (
str
) – The name of the node.n_classes (
int
) – The number of classes for this class that node represents.parent (
Optional
[Node
]) – The parent of the node, if its the root, then the parent is None.
- name¶
The name of the node.
- n_classes¶
The number of classes for this class that node represents.
- parent¶
The parent of the node, if its the root, then the parent is None.
- children¶
A list of nodes that are children of this node.