Re: Is there a standard name for this tree structure?

2010-04-06 Thread Lie Ryan
On 04/07/10 14:18, Steven D'Aprano wrote: > I could have used None, or "root", or "this is a magic value that > probably won't clash with an entry in the tree", or -1 as a sentinel > instead, but they all risk accidental clashes with tree entries. Especially when you want to consider the possibi

Re: Is there a standard name for this tree structure?

2010-04-06 Thread Steven D'Aprano
On Tue, 06 Apr 2010 19:16:05 +0200, egbert wrote: > On Sun, Apr 04, 2010 at 12:10:02PM +, Steven D'Aprano wrote: > >> I can implement this tree using a flat dict: >> >> root = object() >> data = {root: ['Mammal', 'Reptile'], > > What is the advantage, or thougth behind, using an instance o

Re: Is there a standard name for this tree structure?

2010-04-06 Thread egbert
On Sun, Apr 04, 2010 at 12:10:02PM +, Steven D'Aprano wrote: > I can implement this tree using a flat dict: > > root = object() > data = {root: ['Mammal', 'Reptile'], What is the advantage, or thougth behind, using an instance of object as the root of your flat tree ? egbert -- Egbert Bo

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Patrick Maupin
On Apr 4, 10:41 am, Patrick Maupin wrote: > The primary differences between this structure and just haphazardly > wiring up random objects into a directed graph are that (1) there may > be some performance differences (but when the garbage collector has to > figure out how to break cycles, these

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Patrick Maupin
On Apr 4, 9:06 am, Duncan Booth wrote: > Do you have any carniverous apes? If so it's a directed acyclic graph. Well, since he has a root node, he's really only described the *use* of this data structure implementation for a rooted tree. As you point out, the implementation itself is more genera

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Stefan Behnel
Steven D'Aprano, 04.04.2010 14:10: I have a hierarchical structure something like a directory tree or a nested tree structure: Mammal +-- Ape : +-- Chimpanzee : +-- Gorilla : +-- Human +-- Carnivore : +-- Cat : +-- Tiger Reptile +-- Lizard +-- Snake +-- Cobra +-- Python

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Duncan Booth
Steven D'Aprano wrote: > I have a hierarchical structure something like a directory tree or a > nested tree structure: > > Mammal > +-- Ape >: +-- Chimpanzee >: +-- Gorilla >: +-- Human > +-- Carnivore >: +-- Cat >: +-- Tiger > Reptile > +-- Lizard > +-- Snake > +-- Cobra >

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Alf P. Steinbach
* Steven D'Aprano: I have a hierarchical structure something like a directory tree or a nested tree structure: Mammal +-- Ape : +-- Chimpanzee : +-- Gorilla : +-- Human +-- Carnivore : +-- Cat : +-- Tiger Reptile +-- Lizard +-- Snake +-- Cobra +-- Python This is a forest

Is there a standard name for this tree structure?

2010-04-04 Thread Steven D'Aprano
I have a hierarchical structure something like a directory tree or a nested tree structure: Mammal +-- Ape : +-- Chimpanzee : +-- Gorilla : +-- Human +-- Carnivore : +-- Cat : +-- Tiger Reptile +-- Lizard +-- Snake +-- Cobra +-- Python This is a forest because each top-leve