Class ParentTree
Defined in File ParentTree.h
Class Documentation
-
class ParentTree
a tree (a forest) of the nodes 0 , … , n - 1 as a vector of parents
Public Functions
-
explicit ParentTree(int n)
Tree( n ): a forest of n isolated nodes.
- Pre:
n >= 0
-
int parent(int i) const
the parent of the node i; -1 if i is a root
-
void setParent(int i, int j)
makes the node i a child of the node j, or a root if j = -1
- Pre:
i and j are nodes, or j = -1 , and i != j; j is not in the subtree of i (which would make a cycle)
-
int size(void) const
the number of nodes
-
explicit ParentTree(int n)