re-adding deleted nodes

7 views
Skip to first unread message

Ilija

unread,
May 16, 2008, 6:19:19 AM5/16/08
to guess-discuss
Hi,
I have a small problem with re-adding deleted nodes. For example in
the first state I have nodes a,b,c
and in the second just a,b so I delete c because I do not want it to
influence my layout. But then if I have a third state e.g. b,c and
want to load the state file I get *NameError: Immutable variable b
already defined in namespace*. I guess that nodes are kept in some
temp table or similar, so is there any way to completely delete it so
they could be readded.

Gutemberg Vieira

unread,
May 16, 2008, 7:50:54 AM5/16/08
to guess-...@googlegroups.com
Hi,

I ran into this problem a while ago and couldn't solve at that time.
Eytan, what happens when a node is deleted?

[]s
Gutemberg

Manuel Breugelmans

unread,
May 16, 2008, 9:42:49 AM5/16/08
to guess-...@googlegroups.com
On Friday 16 May 2008 13:50:54 Gutemberg Vieira wrote:
> Hi,
>
> I ran into this problem a while ago and couldn't solve at that time.
> Eytan, what happens when a node is deleted?
>
> []s
> Gutemberg
>

You can use removeComplete() for this. remove() will just detach them from the
graph but keep them accessible for cheap re-adding.


eg:

>>> addNode("a")
a
>>> removeComplete([a])
>>> a
Traceback (innermost last):
File "<string>", line 1, in ?
NameError: a


>>> addNode("b")
b
>>> remove([b])
[b]
>>> b
b
>>> add([b])
b

Gutemberg Vieira

unread,
May 16, 2008, 9:52:07 AM5/16/08
to guess-...@googlegroups.com
Cool, I will try this.

Ilija

unread,
May 16, 2008, 11:53:57 AM5/16/08
to guess-discuss
Hi,
This removes it completely so I can not see it in the other states. So
if I have multiple GDF files that repesent states (file 1 = state 1)
than once I completely delete the node I can not see it previous
states.
Any ideas?
State ranges do not work because of the different weights.
Thanks,
Ilija

Eytan Adar

unread,
May 16, 2008, 12:11:51 PM5/16/08
to guess-...@googlegroups.com
I thought I had fixed this at some point... I'll take a look when I have a minute
 
-Eytan

Eytan Adar

unread,
May 16, 2008, 4:48:25 PM5/16/08
to guess-...@googlegroups.com
I think there's a change in the GDF reader that might be a fix for this (from February)... it's checked in, but not released... Can you download http://graphexploration.cond.org/guess.jar and overwrite your guess.jar with it (you might want to make a backup).
 
-Eytan

Ilija

unread,
May 18, 2008, 8:52:45 AM5/18/08
to guess-discuss
Hi,
I tried with the new file and it still does not work. Same error
message *NameError: Immutable variable b
already defined in namespace*?
Any ideas?
Thanks, Ilija

On May 16, 10:48 pm, "Eytan Adar" <eytana...@gmail.com> wrote:
> I think there's a change in the GDF reader that might be a fix for this
> (from February)... it's checked in, but not released... Can you downloadhttp://graphexploration.cond.org/guess.jarand overwrite your guess.jar with
> it (you might want to make a backup).
>
> -Eytan
>

Eytan Adar

unread,
May 18, 2008, 12:02:03 PM5/18/08
to guess-...@googlegroups.com
Just to make sure I understand... you have 3 states
 
file 1 says: a,b,c
 
file 2 says: a,b
file 3 says: b,c
 
I'm trying to construct the simplest thing that gives this error.
 
-Eytan

Ilija

unread,
May 18, 2008, 12:17:25 PM5/18/08
to guess-discuss
So something like this:
a.gdf:
nodedef>name, v1 BOOLEAN
a,1
b,1
c,1
edgedef> node1,node2,weight
a,b,1
a,c,1
b,c,1
b.gdf:
nodedef>name, v2 BOOLEAN
a,1
c,1
edgedef> node1,node2,weight
a,c,1
c.gdf:
nodedef>name, v3 BOOLEAN
b,1
c,1
edgedef> node1,node2,weight
b,c,1
And if I load them with makeFromGDF (fileName) I get all the nodes at
the end.
So I run a loop to remove nodes that are not visible in a current
state (lets say for b.gdf):
for n in g.edges:
if (n.v2 == 1):
n.visible = 1;
else:
remove(n);
and I do the same for every state/file.
if I say
else:
n.visible = 0
than nodes are not visible, but effect the layout and
edges remain visible in every next state once they appear
if I say something like
else:
removeCompletely(n)
than the nodes can not be readded.
Sorry for the length, but I hope I clarified my problem a bit
and there is a simple solution.
Thanks again,
Ilija

On May 18, 6:02 pm, "Eytan Adar" <eytana...@gmail.com> wrote:
> Just to make sure I understand... you have 3 states
>
> file 1 says: a,b,c
>
> file 2 says: a,b
> file 3 says: b,c
>
> I'm trying to construct the simplest thing that gives this error.
>
> -Eytan
>
> On Sun, May 18, 2008 at 5:52 AM, Ilija <il...@eccf.su.ac.yu> wrote:
>
> > Hi,
> >  I tried with the new file and it still does not work. Same error
> > message *NameError: Immutable variable b
> > already defined in namespace*?
> > Any ideas?
> > Thanks, Ilija
>
> > On May 16, 10:48 pm, "Eytan Adar" <eytana...@gmail.com> wrote:
> > > I think there's a change in the GDF reader that might be a fix for this
> > > (from February)... it's checked in, but not released... Can you
> > downloadhttp://graphexploration.cond.org/guess.jarandoverwrite your

Chrisotphe Preiur

unread,
May 19, 2008, 12:00:46 PM5/19/08
to guess-discuss

wait wait wait...
You mean you can load a.gdf, b.gdf and c.gdf in a sequence?
When i do that:
>>> makeFromGDF("Tests/a.gdf")
>>> makeFromGDF("Tests/b.gdf")
i get:
java.lang.Error: java.lang.Error: java.sql.SQLException: Unique
constraint violation:

which i thought came from the fact that loading b.gdf tries to
redefine already existing nodes.
Probably i'm not doing it the proper way, do i?

Sorry Ilija to interfere with your problem of deleting nodes but i'm
trying to do something similar
(just exactly opposite: i want to keep the same layout for each state,
it's the weights that change)

Ilija

unread,
May 19, 2008, 12:46:47 PM5/19/08
to guess-discuss
Hi Christoph,
If you download the revised guess.jar
"
I think there's a change in the GDF reader that might be a fix for
this
(from February)... it's checked in, but not released... Can you
download
http://graphexploration.cond.org/guess.jar and overwrite your
guess.jar with
it (you might want to make a backup).

-Eytan
"

it works, but you may have some problems if all the states have the
same
nodes and in some states there is a edge between them and in some
there is not.
What will happen is that all the next states keep the edges from the
previous?
Ilija

Eytan Adar

unread,
May 19, 2008, 12:55:00 PM5/19/08
to guess-...@googlegroups.com
there's a bug I just fixed that randomized the layout when you do the reload... let me try and finish with the other problem and I'll try and upload a new guess.jar later today or early tomorrow.
 
You should be able to do what you want with the new version (load up multiple GDFs, keeping layout)
 
-Eytan

Eytan Adar

unread,
May 19, 2008, 1:53:44 PM5/19/08
to guess-...@googlegroups.com
Can you give this a try?
 
 
the layout thing that Christophe mentioned wanting should also be fixed... I haven't tested extensively.
 
-E

Chrisotphe Preiur

unread,
May 19, 2008, 3:25:29 PM5/19/08
to guess-discuss

> Can you give this a try?
> http://graphexploration.cond.org/guess.jar

Works for me, at least for loading the three test gdf files a b c
given earlier by Ilija.
I will test further on my data and tell if i get everything ok.

-- Christophe.

Ilija

unread,
May 19, 2008, 4:43:04 PM5/19/08
to guess-discuss
It seams to work. Many thanks,
Ilija

On May 19, 7:53 pm, "Eytan Adar" <eytana...@gmail.com> wrote:
> Can you give this a try?
>
> http://graphexploration.cond.org/guess.jar
>
> the layout thing that Christophe mentioned wanting should also be fixed... I
> haven't tested extensively.
>
> -E
>
> On Mon, May 19, 2008 at 9:55 AM, Eytan Adar <eytana...@gmail.com> wrote:
> > there's a bug I just fixed that randomized the layout when you do the
> > reload... let me try and finish with the other problem and I'll try and
> > upload a new guess.jar later today or early tomorrow.
>
> > You should be able to do what you want with the new version (load up
> > multiple GDFs, keeping layout)
>
> > -Eytan
>
> > On Mon, May 19, 2008 at 9:00 AM, Chrisotphe Preiur <kryt...@yahoo.fr>

Eytan Adar

unread,
May 19, 2008, 6:02:37 PM5/19/08
to guess-...@googlegroups.com
great!  Let me know if anything breaks...
 
btw, Ilija, there's a hidden state called _deleted for deleted nodes... you can do a query like
 
v1["_deleted"] = true
 
to find all nodes that have been deleted and have a v1 variable set to true...  Might save you from reloading the gdf every time.
 
-Eytan

Chrisotphe Preiur

unread,
May 22, 2008, 5:36:21 AM5/22/08
to guess-discuss

everything ok.
Just to keep it in the archive, here is what i did:

I've got 4 time-periods.

- i change the settings for these two things Eytan mentioned earlier:
centerAfterLayout(false) and setSynchronous(true)
- i load the 4 gdf files without any other computation
- i do the layout with all nodes and edges
- then for each file again,
- i remove(g.edges)
- i load the file
- i exportGDF
- i set state (i.e. ss(i) where i is the number of the file)

Takes some time without anything happening and then i get a couple of
nodes and edges. By zooming out i get my last-period network. I can
get the other ones with ls(1), ls(2) etc. (load state)

Note that my nodes and edges attributes change at each time period.
I've checked that everything is ok with this.

Just one thing, but i guess it's more python than Guess stuff: i've
tried
putting some 'print' instructions here and there to trace the
execution but
i just get all the messages at the end of the process. Output
buffering i guess.

Thanks Eytan for the new guess.jar :)

-- Christophe.

Manuel Breugelmans

unread,
May 22, 2008, 5:54:31 AM5/22/08
to guess-...@googlegroups.com
On Thursday 22 May 2008 11:36:21 Chrisotphe Preiur wrote:
> Just one thing, but i guess it's more python than Guess stuff: i've
> tried
> putting some 'print' instructions here and there to trace the
> execution but
> i just get all the messages at the end of the process. Output
> buffering i guess.

You *could* get around this by running evrything in a seperate thread, but
that might introduce subtle problems so ...

eg:

>>> import time
>>> import java.lang.Thread
>>> import java.lang.Runnable
>>> class Printer(Runnable):
... def run(self):
... for i in [1,2,3]:
... print i
... time.sleep(1)
...
...
...
>>> Thread(Printer()).run()
>>> Thread(Printer()).start()

Ilija

unread,
May 22, 2008, 7:13:06 AM5/22/08
to guess-discuss
Did you try removing edges before saving the state, and than
centering.
That worked for me.
Ilija

Chrisotphe Preiur

unread,
May 22, 2008, 8:01:18 AM5/22/08
to guess-discuss

> Did you try removing edges before saving the state, and than
> centering.

I did not try anything since everything works as i expected. :)
I was just reporting my final solution for a use case that i think is
quite common
(watching the evolution of a network by keeping the same layout all
along)

Thanks anyway.

-- Christophe.
Reply all
Reply to author
Forward
0 new messages