treeflow.tree.topology.numpy_tree_topology module
- class treeflow.tree.topology.numpy_tree_topology.NumpyTreeTopology(parent_indices: ndarray, taxon_set: TaxonSet | None = None)
Bases:
NumpyTreeTopologyAttrsClass representing a bifurcating tree topology as a composition of integer NumPy arrays.
For a phylogenetic tree with
ntaxa at the leaves, the representation maintains a labelling of the1n-1nodes with integer indices. The labelling convention is that the leaves are the firstnindices and the root is at the last index (2n-2).- property taxon_count: int
Number of leaf taxa the tree is based on (
n)
- property node_count: int
- property postorder_node_indices: ndarray
- property child_indices: ndarray
Array of length
2n-2representing the parent-child structure of a tree topology onntaxa.The
ith element of this array is the index of the parent of theith indexed node in the tree, for every node except the root.
- property preorder_indices: ndarray
Array of indices of length
2n-1that form a pre-order traversal of the tree.A pre-order traversal is an ordering of the nodes where every node is visited before its children, starting at the root.
- parent_indices: ndarray