I am looking for a good Tree data structure class. I have come across this package, but since I am relatively new to Python (not programming), I dont know if there are any better ones out there.
I’d like to hear from the Pythonistas on here – do you have a favorite tree script that you regularly use and would recommend?
[Edit]
To clarify, by ‘Tree’, I mean a simple unordered tree (Hmm, thats a bit of a recursive definition – but hopefully, that clarifies things somewhat). Regarding what I need the tree for (i.e. use case). I am reading tree data from a flat file and I need to build a tree from the data and traverse all nodes in the tree.
Roll your own. For example, just model your tree as list of list. You should detail your specific need before people can provide better recommendation.
In response to HelloGoodbye’s question, this is a sample code to iterate a tree.
One catch is this recursive implementation is O(n log n). It works fine for all trees I have to deal with. Maybe the subgenerator in Python 3 would help.