Main Content

getcanonical

Calculate canonical form of phylogenetic tree

Syntax

Pointers = getcanonical(Tree)
[Pointers, Distances, Names] = getcanonical(Tree)

Arguments

Treephytree object created by phytree function (object constructor).

Description

Pointers = getcanonical(Tree) returns the pointers for the canonical form of a phylogenetic tree (Tree). In a canonical tree the leaves are ordered alphabetically and the branches are ordered first by their width and then alphabetically by their first element. A canonical tree is isomorphic to all the trees with the same skeleton independently of the order of their leaves and branches.

[Pointers, Distances, Names] = getcanonical(Tree) returns, in addition to the pointers described above, the reordered distances (Distances) and node names (Names).

Examples

  1. Create two phylogenetic trees with the same skeleton but slightly different distances.

    b = [1 2; 3 4; 5 6; 7 8;9 10];
    tr_1 = phytree(b,[.1 .2 .3 .3 .4 ]');
    tr_2 = phytree(b,[.2 .1 .2 .3 .4 ]');
  2. Plot the trees.

     plot(tr_1)
     plot(tr_2)
  3. Check whether the trees have an isomorphic construction.

    isequal(getcanonical(tr_1),getcanonical(tr_2))  
    
    ans =
         1

Version History

Introduced before R2006a