|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_FUNCTION_FUNCTIONS_H_
2 #define GENESIS_TREE_FUNCTION_FUNCTIONS_H_
58 bool is_leaf( TreeLink
const& link );
63 bool is_leaf( TreeNode
const& node );
68 bool is_leaf( TreeEdge
const& edge );
73 bool is_inner( TreeLink
const& link );
78 bool is_inner( TreeNode
const& node );
83 bool is_inner( TreeEdge
const& edge );
88 bool is_root( TreeLink
const& link );
93 bool is_root( TreeNode
const& node );
99 size_t degree( TreeLink
const& link );
104 size_t degree( TreeNode
const& node );
138 bool is_binary( Tree
const& tree,
bool loose =
false );
220 utils::Matrix<signed char>
edge_sides( Tree
const& tree );
241 size_t subtree_size( Tree
const& tree, TreeLink
const& link );
259 std::vector<size_t>
subtree_sizes( Tree
const& tree, TreeNode
const& node );
325 utils::Matrix<signed char>
sign_matrix( Tree
const& tree,
bool compressed =
false );
339 std::vector< TreeLink const* >
path_to_root( TreeNode
const& node );
366 #endif // include guard
size_t leaf_node_count(Tree const &tree)
Count the number of leaf Nodes of a Tree.
std::vector< size_t > subtree_max_path_heights(Tree const &tree, TreeNode const &node)
size_t inner_node_count(Tree const &tree)
Count the number of inner Nodes.
utils::Matrix< signed char > sign_matrix(Tree const &tree, bool compressed)
Compute the sign matrix or Sequential Binary Partition (SBP) of a Tree.
bool is_inner(TreeLink const &link)
Return true iff the node of the given link is an inner node.
bool is_binary(Tree const &tree, bool loose)
Alias for is_bifurcating().
TreeNode const & lowest_common_ancestor(TreeNode const &node_a, TreeNode const &node_b)
Return the lowest common ancestor of two TreeNodes.
size_t subtree_max_path_height(Tree const &tree, TreeLink const &link)
Calculate the height of a subtree, that is, the maximum path length to a leaf of that subtree,...
std::vector< size_t > inner_edge_indices(Tree const &tree)
Get a list of the edge indices of all inner edges, that is, all TreeEdges that do not lead to a leaf ...
size_t degree(TreeLink const &link)
Return the degree of the node for a given TreeLink, i.e. how many neighbouring nodes it has.
size_t max_degree(Tree const &tree)
Return the highest degree of the Nodes of a Tree.
std::vector< TreeLink const * > path_to_root(TreeNode const &node)
Helper function that finds all TreeLinks between a given TreeNode and the root of the Tree.
size_t leaf_edge_count(Tree const &tree)
Return the number of Edges of a Tree that lead to a leaf Node.
size_t node_count(Tree const &tree)
Return the number of Nodes of a Tree. Same as Tree::node_count().
bool is_root(TreeLink const &link)
Return whether the link belongs to the root node of its Tree.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
size_t inner_edge_count(Tree const &tree)
Return the number of Edges of a Tree that do not lead to a leaf Node.
bool is_bifurcating(Tree const &tree, bool loose)
Return whether the Tree is bifurcating.
std::vector< size_t > subtree_sizes(Tree const &tree, TreeNode const &node)
Calculate the sizes of all subtrees as seen from the given TreeNode.
std::vector< size_t > leaf_edge_indices(Tree const &tree)
Get a list of the edge indices of all leaf edges, that is, all TreeEdges that lead to a leaf TreeNode...
std::vector< size_t > leaf_node_indices(Tree const &tree)
Get a list of the node indices of all leaf TreeNodes.
bool is_rooted(Tree const &tree)
Return whether the Tree is rooted, that is, whether the root node has two neighbors.
utils::Matrix< size_t > lowest_common_ancestors(Tree const &tree)
Return the lowest common ancestor of each pair of TreeNodes for a given tree, in form of a Matrix of ...
utils::Matrix< signed char > edge_sides(Tree const &tree)
Create a Matrix that indiciaces the relative position of the Edges of a Tree, i.e....
std::vector< size_t > inner_node_indices(Tree const &tree)
Get a list of the node indices of all inner TreeNodes.
size_t subtree_size(Tree const &tree, TreeLink const &link)
Return the size of the subtree defined by the given TreeLink, measured in number of nodes.
bool is_leaf(TreeLink const &link)
Return true iff the node of the given link is a leaf node.
size_t edge_count(Tree const &tree)
Return the number of Edges of a Tree. Same as Tree::edge_count().
utils::Matrix< signed char > node_root_direction_matrix(Tree const &tree)
Calculate a Matrix that indicates the nodes on the root side of a given node.