Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61765
| Date | 2013-12-12 19:01 -0300 |
|---|---|
| From | Ricardo Aráoz <ricaraoz@gmail.com> |
| Subject | Re: Tree library - multiple children |
| References | <52A9FD0A.9080804@gmail.com> <l8d2m1$ql$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4033.1386885698.18130.python-list@python.org> (permalink) |
El 12/12/13 16:26, Neil Cerutti escribió: > On 2013-12-12, Ricardo Aráoz <ricaraoz@gmail.com> 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. > Have you tried nested lists? > > [[1, 2], [3, 4] > > Can represent > > root > / \ > 1-2 3-4 > > Python makes it very easy to manipulate such a structure. It > isn't clear that you need more than that yet. > And what if "2" has a couple of children? And one of those children has children of it's own? You see, I will be needing multiple levels and will need to know if a node is already there at some level, and be able to add a child to that node on the fly, and to be able to traverse the tree in different ways, so I would eventually develop a tree library which is what I'm looking for.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Tree library - multiple children Ricardo Aráoz <ricaraoz@gmail.com> - 2013-12-12 19:01 -0300
csiph-web