skbio.core.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}

list of tuple of (int, int, int)

The first index in each tuple is the corresponding node_id. The second index is the left most leaf index. The third index is the right most leaf index