skbio.tree.TreeNode.compare_biparts#

TreeNode.compare_biparts(other, proportion=True, symmetric=True)[source]#

Calculate the difference of bipartitions between two trees.

Added in version 0.6.3.

Parameters:
otherTreeNode

The other tree to compare with.

proportionbool, optional

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

symmetricbool, optional

Whether to calculate the symmetric difference between self and other (True, default), or only the difference from self to other (False).

Returns:
float

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

Notes

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

Only taxa shared between the two trees are considered.

Examples

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