![]() |
Pixie
|
CRTP facade for rooted ordered trees. More...
#include <tree.h>
Public Types | |
| using | Node = TreeNode |
Public Member Functions | |
| Node | root () const |
| Return the root node. | |
| std::size_t | size () const |
| Return the number of nodes. | |
| bool | empty () const |
| Check whether the tree contains no nodes. | |
| bool | is_leaf (const Node &node) const |
Check whether node has no children. | |
| bool | is_root (const Node &node) const |
Check whether node is the root. | |
| std::size_t | degree (const Node &node) const |
Return the number of children of node. | |
| Node | first_child (const Node &node) const |
Return the first child of node. | |
| Node | child (const Node &node, std::size_t index) const |
Return a child of node by zero-based index. | |
| Node | parent (const Node &node) const |
Return the parent of node. | |
| bool | is_last_child (const Node &node) const |
Check whether node is its parent's last child. | |
| Node | next_sibling (const Node &node) const |
Return the next sibling of node. | |
CRTP facade for rooted ordered trees.
Implementations may use different succinct encodings, but expose the same logical navigation operations through this facade.
<pixie/tree/implementations.h> for the available succinct encodings.
|
inline |
Return a child of node by zero-based index.
| node | Valid node handle from this tree. |
| index | Child index in [0, degree(node)). |
|
inline |
Return the number of children of node.
| node | Valid node handle from this tree. |
|
inline |
Check whether the tree contains no nodes.
true when size() == 0.
|
inline |
Return the first child of node.
| node | Valid non-leaf node handle from this tree. |
|
inline |
Check whether node is its parent's last child.
| node | Valid non-root node handle from this tree. |
true when no sibling follows node.
|
inline |
Check whether node has no children.
| node | Valid node handle from this tree. |
true when the node is a leaf.
|
inline |
Check whether node is the root.
| node | Valid node handle from this tree. |
true when the node is the root.
|
inline |
Return the next sibling of node.
| node | Valid non-root node that is not its parent's last child. |
|
inline |
Return the parent of node.
| node | Valid node handle from this tree. |
node is the root.
|
inline |
Return the root node.
|
inline |
Return the number of nodes.