Skip to main content
`Ctrl`+`K`

# skbio.tree.TreeNode.is_bifurcating

TreeNode.is_bifurcating(strict=False, include_self=True)

  Check if the tree is bifurcating.

  Added in version 0.6.3.

  Parameters:
    strict bool, optional

      Whether to consider single-child nodes as violations of bifurcation. Default is False.

    include_self bool, optional

      If False, will not check the current node. This is useful for checking an unrooted tree, whose root node may have three children. Default is True.

  See also

  `bifurcate`
  `prune`

  Notes

  In a bifurcating tree (a.k.a. binary tree), every node has at most two children. The property of bifurcation is necessary for a wide range of tree analyses. In contrast, if a node has three or more children, it is considered as multifurcating, or polytomy in phylogenetics.

  In strict mode, every internal node (including root) has to have exactly two children in order for the tree to be bifurcating. Single-child nodes are considered as violations. These nodes can be collapsed by `prune`.

  This method operates on the subtree below the current node.

  Examples

      >>> from skbio import TreeNode
      >>> tree = TreeNode.read(["((a,b,c),(d,e))root;"])
      >>> tree.is_bifurcating()
      False