Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
Printing a Tree object relies on the _asciiArt method that is implemented using pure recursion, which can result in a RecursionError for a sufficiently large tree. If the implementation is modified to use memoization, then this recursion error could be avoided.
Example:
t = Tree("(0);")
for i in range(1001):
(t&str(i)).add_child(name=str(i + 1))
print(t)
Printing a
Tree
object relies on the_asciiArt
method that is implemented using pure recursion, which can result in aRecursionError
for a sufficiently large tree. If the implementation is modified to use memoization, then this recursion error could be avoided.Example: