Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61765

Re: Tree library - multiple children

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ricaraoz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; 'root': 0.05; 'tree': 0.05; 'binary': 0.07; 'level,': 0.07; 'nested': 0.07; 'library?': 0.09; 'python': 0.11; '2],': 0.16; 'escribi\xf3:': 0.16; 'from:addr:ricaraoz': 0.16; 'from:name:ricardo ar\xe1oz': 0.16; 'node.': 0.16; 'subject:library': 0.16; 'traverse': 0.16; 'wrote:': 0.18; 'library': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'see,': 0.30; "i'm": 0.30; 'lists?': 0.31; 'node': 0.31; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'clear': 0.37; 'represent': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'easy': 0.60; 'eventually': 0.60; 'such': 0.63; 'more': 0.64; 'different': 0.65; 'levels': 0.65; 'needing': 0.65; '3-4': 0.68
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=+LujDzmv4vc5thDwK8tFDceDfYRlPPoJC6KgB7O37qw=; b=anHO9nwHmU6EZAdX1sIQczk+Cc+hpi5/v3y5E3deeinAEVxdwPRwbXEjhOmlb6WgLO xnjueN0noE8PZQ2HFSPJ7hrB2UcfYZ5vO4qMlP9CEOwkKZOwZye1Afp8K6B8GlEMWFmS pOimSBfJV9zDhXZ7XHBqR6gISgpb4lIhWLkhtRSDHBKBl4uE2EDT1U6PR6o87YpfUolk QXjlOqBwMlDaUD2umvpiRvz2JTYXxhysJfePQlHI3k99rVXy57rnw2idR/znSQuZNuaw Eoin3z5H2hlYkIe0vzu9/i9XWA0G16h7AkK4TGZ2TarM2/FU3+f/qba69//dWJmHZoiy T5Dw==
X-Received by 10.236.47.162 with SMTP id t22mr8082935yhb.123.1386885694507; Thu, 12 Dec 2013 14:01:34 -0800 (PST)
Date Thu, 12 Dec 2013 19:01:32 -0300
From Ricardo Aráoz <ricaraoz@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Tree library - multiple children
References <52A9FD0A.9080804@gmail.com> <l8d2m1$ql$1@ger.gmane.org>
In-Reply-To <l8d2m1$ql$1@ger.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4033.1386885698.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386885698 news.xs4all.nl 2883 [2001:888:2000:d::a6]:53351
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61765

Show key headers only | View raw


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


Thread

Re: Tree library - multiple children Ricardo Aráoz <ricaraoz@gmail.com> - 2013-12-12 19:01 -0300

csiph-web