Hello I have a tree such as :
>>> print(tree)
/-A
--|
| /-B
\-|
| /-C
\-|
| /-D
\-|
\-E
tree=Tree("(A,(B,C,(D,E)));") (ete3 function)
And I'm looking for a way to see the closest leaves to a particular leaf.
Here for instance the leaves most closely related to C
are D
and E.
The leaf most closely related to D
is E
The the leaves most closely related to B
are C, D
and E.
the definition of "closest" is tricky in this context, but what you describe can easily be achieved by the following code (note that the tree in your code was missing a parenthesis):