Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tree libraries in python [closed]

Tags:

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.)

like image 587
uhbif19 Avatar asked Mar 14 '10 11:03

uhbif19


People also ask

Does Python have a tree library?

treelib is created to provide an efficient implementation of tree data structure in Python. The main features of treelib includes: Efficient operation of node searching, O(1). Support common tree operations like traversing, insertion, deletion, node moving, shallow/deep copying, subtree cutting etc.

How do you display tree structure in Python?

To insert into a tree we use the same node class created above and add a insert class to it. The insert class compares the value of the node to the parent node and decides to add it as a left node or a right node. Finally the PrintTree class is used to print the tree.


1 Answers

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

like image 135
Terrence Brannon Avatar answered Oct 21 '22 11:10

Terrence Brannon