#include <genesis/tree/tree/subtree.hpp>
Reference to a subtree of a Tree.
This class refers to a particular subtree of a Tree. Such a subtree contains all TreeNodes and TreeEdges at one side of a TreeEdge, while leaving out the other side of it.
The "subtree" of a leaf node is only that node itself. There are no empty subtrees, and there is no subtree that contains all of the Tree. That is, a Subtree is always a split (or bipartition) of the Tree into two parts, separated by an edge.
A subtree is defined by the TreeLink that is part of the subtree, while its outer() link is not:
In the example, parts A
and B
, as well as the node on the left, belong to the Subtree, and parts C
and D
, as well as the node on the right do not.
The marked TreeLink, as well as its TreeNode and TreeEdge can be used to construct a Subtree and can be retrieved from it. The Tree that a Subtree refers to has to stay alive, otherwise we get dangling pointers. It is the responsibility of the user to ensure this.
The Tree iterators (e.g., IteratorPreorder and IteratorPostorder) furthermore offer constructors that take a Subtree and only iterate this part of the Tree.
Definition at line 69 of file subtree.hpp.
Public Member Functions  
Subtree (Subtree &&)=default  
Subtree (Subtree const &)=default  
Subtree (TreeEdge const &edge, bool use_primary=false)  
Construct a Subtree in one of the two directions of a given TreeEdge. More...  
Subtree (TreeLink const &link)  
Construct a Subtree that contains all of the tree except for the part that the outer() link of the given TreeLink belongs to. More...  
Subtree (TreeNode const &node)  
Construct a Subtree representing the given TreeNode and the part of the Tree away from its root node. More...  
~Subtree ()=default  
TreeEdge const &  edge () const 
Get the TreeEdge that separates the subtree from the rest of the tree. More...  
void  invert () 
Invert/flip the subtree to represent the other (complementary) part of the tree. More...  
TreeLink const &  link () const 
Get the TreeLink that separates the subtree from the rest of the tree. More...  
TreeNode const &  node () const 
Get the TreeNode at which the subtree starts. More...  
Subtree &  operator= (Subtree &&)=default 
Subtree &  operator= (Subtree const &)=default 
Protected Attributes  
TreeLink const *  link_ = nullptr 
Construct a Subtree that contains all of the tree except for the part that the outer() link of the given TreeLink belongs to.
Definition at line 86 of file subtree.hpp.
Construct a Subtree representing the given TreeNode and the part of the Tree away from its root node.
Definition at line 94 of file subtree.hpp.
Construct a Subtree in one of the two directions of a given TreeEdge.
With use_primary
set to false
(default), the subtree is the one pointing away from the root. With use_primary
set to true
, the root side of the edge is used as subtree instead.
Definition at line 104 of file subtree.hpp.

default 

inline 
Get the TreeEdge that separates the subtree from the rest of the tree.
Definition at line 141 of file subtree.hpp.

inline 
Invert/flip the subtree to represent the other (complementary) part of the tree.
Definition at line 149 of file subtree.hpp.

inline 
Get the TreeLink that separates the subtree from the rest of the tree.
This link belongs to the subtree, while its outer() does not.
Definition at line 125 of file subtree.hpp.

inline 
Get the TreeNode at which the subtree starts.
Definition at line 133 of file subtree.hpp.

protected 
Definition at line 168 of file subtree.hpp.