[1.0.3] Bug in Gem layout

9 views
Skip to first unread message

Borg

unread,
May 31, 2009, 2:23:42 PM5/31/09
to guess-discuss
Hello.

I've found a BUG in Gem Layout.
When all nodes have loop edges following error appears:
java.lang.ArrayIndexOutOfBoundsException: -1 when you try to do Gem
Layout.

How to reproduce:
Load following .gdf file and try to do Gem Layout:
nodedef> name, label, color, strokecolor, labelvisible
n0,"n1","158,176,255","255,255,255",1
n1,"n2","255,255,255","255,255,255",1
n2,"n3","255,255,255","255,255,255",1
edgedef> node1, node2, width, weight, comment VARCHAR
n0,n0,2.0,2.0,""
n1,n1,2.0,10.0,""
n0,n1,2.0,2.0,""
n2,n2,2.0,100.0,""
n0,n2,2.0,2.0,"test"

Please fix fix fix :)
Please compile using 1.0.3 branch

Eytan Adar

unread,
May 31, 2009, 4:08:30 PM5/31/09
to guess-...@googlegroups.com
I'll take a look, but no promises... I'm in the middle of writing my dissertation.

A workaround is:

foo = removeSelfLoops()
gemLayout()
add(foo)

-E

Borg

unread,
Jun 1, 2009, 3:53:40 PM6/1/09
to guess-discuss
Yeah.
This happens only when ALL nodes have loops.
If even one node doesnt have loop, it works fine.

I belive its something small.. hidden deep in code :) hope it will be
not so hard to find.

Good luck :)
Borg

On May 31, 10:08 pm, Eytan Adar <eytana...@gmail.com> wrote:
> I'll take a look, but no promises... I'm in the middle of writing my
> dissertation.
>
> A workaround is:
>
> foo = removeSelfLoops()
> gemLayout()
> add(foo)
>
> -E
>

Borg

unread,
Jun 12, 2009, 10:58:30 AM6/12/09
to guess-discuss
Okey. I was able to fix it.
as I said, it was quite simply.
I tested it and it works fine on few of my layouts.
Basicaly fix just ignores loops.
Here it goes:

Index: GEM.java
===================================================================
--- GEM.java (revision 2)
+++ GEM.java (working copy)
@@ -225,7 +225,7 @@
while (nodeSet.hasNext()) {
uint = (Integer)nodeSet.next();
ui = uint.intValue();
- if (gemProp[ui].in != 0) {
+ if (ui != v && gemProp[ui].in != 0) {
q.addFirst(uint);
gemProp[ui].in = gemProp[v].in + 1;
Reply all
Reply to author
Forward
0 new messages