Skip to main content
`Ctrl`+`K`

# skbio.tree.TreeNode.compare_subsets

TreeNode.compare_subsets(other, shared_only=False, proportion=True)

  Calculate the difference of subsets between two trees.

  Parameters:
    other TreeNode

      The other tree to compare with.

    shared_only bool, optional

      Only consider taxa shared with the other tree. Default is False.

      Changed in version 0.6.3: Renamed from `exclude_absent_taxa`. The old name is kept as an alias but is deprecated.

    proportion bool, optional

      Whether to return count (False) or proportion (True, default) of different subsets.

      Added in version 0.6.3.

  Returns:
    float

      The count or proportion of subsets that differ between the trees.

  See also

  `subsets`
  `compare_rfd`
  `compare_biparts`

  Notes

  This metric is equivalent to the Robinson-Foulds distance on rooted trees.

  Examples

      >>> from skbio import TreeNode
      >>> tree1 = TreeNode.read(["((a,b),(c,d));"])
      >>> tree2 = TreeNode.read(["(((a,b),c),d);"])
      >>> tree1.compare_subsets(tree2)
      0.5