The following are three equivalent representations of the same tree (phylogenetic). I am trying to figure out an algorithm to check if two tree representations are equivalent. Trees are defined to be equivalent if the parent-child relationship between nodes are similar.
(Whale,(Seal,((Mouse,Rat),((((Carp,Loach),Frog),Chicken),Human))),Cow);
(Whale,(Seal,((Rat,Mouse),(Human,((Frog,(Loach,Carp)),Chicken)))),Cow);
((Seal,((Rat,Mouse),(Human,((Frog,(Loach,Carp)),Chicken)))), Cow, Whale);
Can anyone suggest a method?