Re: Help with fast tree-like structure

2006-01-25 Thread Lonnie Princehouse
> A = [, B, C] >B = [, D] >C = [] Why store node data in the same list that contains the children? It seems like the OO approach would be more extensible, e.g. class Node: def __init__(self): self.children = [] # list of nodes # store node data as attributes... # If you wa

Help with fast tree-like structure

2006-01-25 Thread David Hirschfield
I've written a tree-like data structure that stores arbitrary python objects. The objective was for the tree structure to allow any number of children per node, and any number of root nodes...and for it to be speedy for trees with thousands of nodes. At its core, the structure is just a list of