scikit-bio is back in active development! Check out our announcement of revitalization.

skbio.tree.TreeNode.index_tree#

TreeNode.index_tree()[source]#

Index a tree for rapid lookups within a tree array.

Indexes nodes in-place as n._leaf_index.

Returns:
dict

A mapping {node_id: TreeNode}

np.array of ints

This arrays describes the IDs of every internal node, and the ID range of the immediate descendents. The first column in the array corresponds to node_id. The second column is the left most descendent’s ID. The third column is the right most descendent’s ID.