begging for a tree implementation

Micah fanmail at micah-wedemeyer.net
Wed Apr 26 23:17:22 EDT 2006


Sybren Stuvel wrote:
> Micah enlightened us with:
> > I'm looking for a simple tree implementation: 0-n children, 1 root.
> > All the nice methods would be appreciated (getLeaves, isLeaf,
> > isRoot, depthfirst, breadthfirst,...)  That's really all I need.  I
> > could code one up, but it would take time to debug, and i'm really
> > short on time right now.
>
> What kind of tree do you want? B+-tree? Black/Red tree? Binary search
> tree?
>
> Sybren
> --
> The problem with the world is stupidity. Not saying there should be a
> capital punishment for stupidity, but why don't we just take the
> safety labels off of everything and let the problem solve itself?
>                                              Frank Zappa

I'm looking for a simple abstract-data-type tree.  I would have thought
there would be a built-in type, but I can't find one.  I just need to
be able to start from a root node and attach children from there.  I
could jury-rig one using a dict or some tuples, but I'd like a
full-featured tree if someone has one implemented.

Thanks for the reply!
Micah




More information about the Python-list mailing list