Fork me on GitHub"

# skbio.tree.TreeNode.count

TreeNode.count(tips=False)

  Get the count of nodes in the tree

  State: Experimental as of 0.4.0.

  Parameters

    tips (bool) – If True, only return the count of the number of tips

  Returns

    The number of nodes or tips

  Return type

    int

  Examples

      >>> from skbio import TreeNode
      >>> tree = TreeNode.read(["((a,(b,c)d)e,(f,g)h)i;"])
      >>> print(tree.count())
      9
      >>> print(tree.count(tips=True))
      5