skbio.tree.BPTree.level_ancestor#

BPTree.level_ancestor(i, d)[source]#

Index of the ancestor a given number of levels above a node.

Parameters:
iint

Index of the node to evaluate.

dint

Number of levels to ascend toward the root.

Returns:
int

Index of the ancestor d levels above node i, or -1 if d is not positive.

Notes

Returns an integer index into the parentheses bit array, not a node object. ancestors returns the full list of ancestor nodes from a node toward the root.