Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Tree library - multiple children

Reply
Thread Tools

Re: Tree library - multiple children

 
 
Michael Torrie
Guest
Posts: n/a
 
      12-12-2013
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tree library - multiple children Ricardo ArŠoz Python 2 12-13-2013 10:55 PM
Re: Tree library - multiple children MRAB Python 0 12-12-2013 07:38 PM
Re: Tree library - multiple children Joel Goldstick Python 0 12-12-2013 07:30 PM
Re: Tree library - multiple children Neil Cerutti Python 0 12-12-2013 07:26 PM
Re: Tree library - multiple children Terry Reedy Python 0 12-12-2013 06:56 PM



Advertisments