On 12/12/2013 11:14 AM, Ricardo Aráoz wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binary tree, I need to have multiple children per node.
There are lots of types of tree structures that may or may not be applicable to your problem. And it depends on what kind of data you're storing. For example, I wrote a parser years ago (in C) that processed BER-encoded structured data (sort of like binary xml). Turned out that the nested structure of BER-encoded data lends itself well to "left-child, right-sibling" trees (and it happens to be binary, which makes for easy traversal). In any even Python's data primitives are powerful enough that you don't need a library at all. Just use Python's built-in primitives. You can do most tree structures with just list manipulation, without any class overhead at all. In fact in my case, my "left-child right sibling" trees are by definition lists (think LISP car and cdr) or tuples. The LISP-esque nature of Python's data types always did make Python appeal to me. -- https://mail.python.org/mailman/listinfo/python-list