Tree libraries in python [closed]

2019-02-02 08:20发布

问题:

Are there any python libraries for data trees?

I mean a tree as a general data structure, not just an xml tree. (Like in this question, but in python.)

回答1:

pypi, the Python Package Index, suggests tinytree, treedict, caxes, pyavl... these are just the top few after filtering away the many accidental hits (which point to specific tree such as XML ones, AST ones, etc, etc;-). If you clarify what you want to do with your trees it may be easier to suggest a specific package.



回答2:

I'm happy with treelib. It addresses my problem. Could use a bit more documentation though. But the code is clear.



回答3:

Although the ETE library seems to be originally developed to work with Phylogenetic trees, it implements many general features to work with any type of hierarchical tree structures, including programmatic tree drawing and visualization.

There is a comprehensive tutorial and a reference guide, in case you want to explore it.



回答4:

python-graph seems to be a fairly thorough and complete package, and can export DOT graphs for use with Graphviz.



回答5:

You probably want to look at cElementTree.



标签: python tree