skbio.tree.BPTree.count#

BPTree.count(i=0, tips=False)[source]#

Get the count of nodes in the subtree rooted at a node.

Parameters:
iint, optional

Index of the node whose subtree is evaluated. Defaults to the root (0), i.e., the whole tree.

tipsbool, optional

If True, only count the tips (leaves) in the subtree (default: False).

Returns:
int

The number of nodes (or tips, if tips is True) in the subtree rooted at node i, including i itself.

Notes

Returns a node count, not a subtree.