scikit-bio is back in active development! Check out our announcement of revitalization.

skbio.tree.TreeNode.compare_rfd#

TreeNode.compare_rfd(other, proportion=False)[source]#

Calculate the Robinson and Foulds symmetric difference.

Parameters:
otherTreeNode

A tree to compare against

proportionbool

Return a proportional difference

Returns:
float

The distance between the trees

Raises:
ValueError

If the tip names between self and other are equal.

Notes

Implementation based off of code by Julia Goodrich. The original description of the algorithm can be found in [1].

References

[1]

Comparison of phylogenetic trees. Robinson and Foulds. Mathematical Biosciences. 1981. 53:131-141

Examples

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