I'm working with LabelledRootedTree but my problem is that I need to
create first all the nodes and then an algorithm creates connection
parent-child. It is something like that:
for v in g.vertices():
nodes[v] = LabelledRootedTree([], v;label) # labelled tree node
with no child
for ... :
if ...:
nodes[v1].append(nodes[v2]) #adding children
This is not possible because LabelledRootedTree is not mutable. But I
don't know how to create a mutable labelled rooted tree (and I don't
really understand how the tree class architecture works). When I'm
finished building the tree, at the end of my algorithm, I would really
much like to change the tree back to immutable. This thing seems
really natural for me but for some reason, it seems really difficult
to do !
Thank's anyway
Viviane
(PS : sorry for the first half-message, my keyboard did it without asking me)
2012/9/3 Viviane Pons <[email protected]>:
> I'm working with LabelledRootedTree but my problem is that I need to
> create first all the nodes and then an algorithm creates connection
> parent-child. It is something like that:
>
> for v in g.vertices():
> nodes[v] = LabelledRootedTree([], v;label) # labelled tree node
> with no child
>
> for ... :
>
>
> 2012/9/3 Nicolas M. Thiery <[email protected]>:
>> On Mon, Sep 03, 2012 at 06:57:44PM +0200, Viviane Pons wrote:
>>> I'm trying to work with trees but I find them quite difficult to use.
>>> I have a simple question : how can I crate a temporary mutable
>>> labelled rooted tree and set it to be immutable after the construction
>>> is finished ?
>>>
>>> I have found no way of doing this and this would be necessary for what
>>> I'm doing now. If someone know how it works, it would be great.
>>
>> Just a suggestion: could you post a sample piece of code that you
>> would want to write?
>>
>> Cheers,
>> Nicolas
>> --
>> Nicolas M. Thiéry "Isil" <[email protected]>
>> http://Nicolas.Thiery.name/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-combinat-devel" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/sage-combinat-devel?hl=en.
>>
--
You received this message because you are subscribed to the Google Groups
"sage-combinat-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-combinat-devel?hl=en.