for idx, n in enumerate(MasterNode.subtree()):
c.deleteOutline(n)
Well thinking further, the only think I would *really* need is to find a way to keep a reference to nodes which lasts through changes in the trees, and if not possible for all of the nodes, at least for two of them, the node which begins the iteration, and the child currently in the loop.
thelist=p.subtree()
for p in thelist:
g.es(p)
p.deletePositionsInList(thelist)
c.redraw()
for x in range (0,totalnumberofnodes+1):
c.executeMinibufferCommand('goto-next-node')
c.executeMinibufferCommand('delete-node')
Thank you both for the answers and clarifications (Terry). Everything was very useful.
Edward: Yes, im trying the following code without success:thelist=p.subtree()
for p in thelist:
g.es(p)
p.deletePositionsInList(thelist)
c.redraw()
I got something which does the trick:for x in range (0,totalnumberofnodes+1):
c.executeMinibufferCommand('goto-next-node')
c.executeMinibufferCommand('delete-node')
What references do we have as constants now?
In my opinion (Leo-Ignorant one) it should be easy to just refer all the nodes to their absolute position on the tree.
On Tue, May 14, 2013 at 11:19 AM, Fidel Pérez <fidel...@gmail.com> wrote:
What references do we have as constants now?Good question. At present, I don't know and don't remember. I'm going to study all off this asap.
Im sorry but I still don't understand it:
Say we have a tree of nodes.For being able to represent that list of nodes into a tree we must have first assigned a position for each node into the tree, therefore, that position is a piece of information we have out there.
Given we have the information on how to put each node (also cloned ones) one after another, the deleting process would consist only on reading that information backwards, then deleting through that reference.
Which is the part I am assuming wrong?
This is the scheme I use:
def delAllChildren(posx):
while True:
pos2 = posx.getLastChild()
if pos2:
pos2.doDelete()
else:
break
FoundOne=1
Keeptesting=1
while FoundOne==1:
Keeptesting=0
for ChildsToErase in c.p.subtree():
if ChildsToErase.gnx in NodesToDeleteList:
ChildsToErase.doDelete()
Keeptesting=1
if Keeptesting==0:
FoundOne=0