Skip to main content



      Home
Home » Eclipse Projects » GEF » DirectedGraph and Edge.tree field
DirectedGraph and Edge.tree field [message #171003] Tue, 08 March 2005 09:24 Go to next message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 004F2A8B85256FBE_=
Content-Type: text/plain; charset="US-ASCII"

In my application I create a directed graph, and apply the
DirectedGraph.visit method to it. Once it is laid out and visible, I want
to add nodes and edges to it (by adding to the current NodeList and
EdgeList, creating a new DirectedGraph, and setting the augmented nodelist
and edgelist as the nodes and edges fields). I then apply the
DirectedGraph.visit method to the new DirectedGraph.

I was finding that I was ending up with a stack overflow due to an
infinite recursion. I created a small test case that had the same pattern
of nodes and edges (only 4 nodes and 4 edges), but it did not display the
infinite recursion problem in the .visit method.

I finally traced the difference to the fact that after the first .visit of
the DirectedGraph, the edges in my edgelist are modified in their .tree
field, which is documented as for internal use only. That is, the edges
when created have a tree field value of "false", but after the first
layout, the value is true. Then when I add another node or edge to the
list, the subsequent layout fails because the earlier-added edges are
"different" due to the fact that they've been laid-out once before.

I tried a workaround, which is to simply set the tree field to false for
all edges in the EdgeList, before the subsequent visit calls. This seems
to work. However, since it is not clear what the field is used for, I
don't know if this is a general solution to my problem.

Is there an accepted way to be able to do multiple layouts on an edge? Is
there a better way to "reinitialize" the state of the edge?
--=_alternative 004F2A8B85256FBE_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">In my application I create a directed
graph, and apply the DirectedGraph.visit method to it. Once it is laid
out and visible, I want to add nodes and edges to it (by adding to the
current NodeList and EdgeList, creating a new DirectedGraph, and setting
the augmented nodelist and edgelist as the nodes and edges fields). I then
apply the DirectedGraph.visit method to the new DirectedGraph.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
I was finding that I was ending up with a stack overflow due to an infinite
recursion. I created a small test case that had the same pattern of nodes
and edges (only 4 nodes and 4 edges), but it did not display the infinite
recursion problem in the .visit method.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I finally traced the difference to the fact that after the first .visit
of the DirectedGraph, the edges in my edgelist are modified in their .tree
field, which is documented as for internal use only. That is, the edges
when created have a tree field value of &quot;false&quot;, but after the
first layout, the value is true. Then when I add another node or edge to
the list, the subsequent layout fails because the earlier-added edges are
&quot;different&quot; due to the fact that they've been laid-out once before.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
I tried a workaround, which is to simply set the tree field to false for
all edges in the EdgeList, before the subsequent visit calls. This seems
to work. However, since it is not clear what the field is used for, I don't
know if this is a general solution to my problem.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Is there an accepted way to be able to do multiple layouts on an edge?
Is there a better way to &quot;reinitialize&quot; the state of the edge?</font>
--=_alternative 004F2A8B85256FBE_=--
Re: DirectedGraph and Edge.tree field Example [message #171021 is a reply to message #171003] Tue, 08 March 2005 11:25 Go to previous messageGo to next message
Eclipse UserFriend
This is a multipart message in MIME format.
--=_alternative 005A414385256FBE_=
Content-Type: text/plain; charset="US-ASCII"

Here is an extremely simple example to illustrate the infinite recursion,
which occurs on the second call to visit. As my earlier note indicated, I
can avoid the problem by resetting the .tree field to false for all edges
before the second call to visit, but I don't know if this is a generally
valid approach.

DirectedGraph graph = new DirectedGraph();
nl = new NodeList();
el = new EdgeList();
Label label1 = new Label();
label1.setText("A");
Node n1 = new Node(label1);

Label label2 = new Label();
label2.setText("B");
Node n2 = new Node(label2);

Label label3 = new Label();
label3.setText("a");
Node n3 = new Node(label3);

Label label4 = new Label();
label4.setText("b");
Node n4 = new Node(label4);


nl.add(n1);
nl.add(n3);
nl.add(n4);
nl.add(n2);


Edge edge1 = new Edge(n1, n3);
el.add(edge1);
Edge edge2 = new Edge(n1, n4);
el.add(edge2);
Edge edge3 = new Edge(n2, n4);
el.add(edge3);


graph.nodes = nl;
graph.edges = el;
new DirectedGraphLayout().visit(graph);


//add the last edge
Edge edge4 = new Edge(n2, n3);
el.add(edge4);
graph = new DirectedGraph();
graph.nodes = nl;
graph.edges = el;


new DirectedGraphLayout().visit(graph);

--=_alternative 005A414385256FBE_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Here is an extremely simple example
to illustrate the infinite recursion, which occurs on the second call to
visit. As my earlier note indicated, I can avoid the problem by resetting
the .tree field to false for all edges before the second call to visit,
but I don't know if this is a generally valid approach.</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; DirectedGraph graph = new DirectedGraph();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; nl = new NodeList();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; el = new EdgeList();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Label label1 = new Label();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; label1.setText(&quot;A&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Node n1 = new Node(label1);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Label label2 = new Label();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; label2.setText(&quot;B&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Node n2 = new Node(label2);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Label label3 = new Label();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; label3.setText(&quot;a&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Node n3 = new Node(label3);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Label label4 = new Label();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; label4.setText(&quot;b&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Node n4 = new Node(label4);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; nl.add(n1);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; nl.add(n3); &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; nl.add(n4);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; nl.add(n2);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Edge edge1 = new Edge(n1, n3); &nbsp; &nbsp;
&nbsp; &nbsp;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; el.add(edge1);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Edge edge2 = new Edge(n1, n4);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; el.add(edge2);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Edge edge3 = new Edge(n2, n4); &nbsp; &nbsp;
&nbsp; &nbsp;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; el.add(edge3);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; graph.nodes = nl;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; graph.edges = el;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; new DirectedGraphLayout().visit(graph);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; //add the last edge</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; Edge edge4 = new Edge(n2, n3);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; el.add(edge4);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; graph = new DirectedGraph(); &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; graph.nodes = nl;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; graph.edges = el;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; new DirectedGraphLayout().visit(graph);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font>
--=_alternative 005A414385256FBE_=--
Re: DirectedGraph and Edge.tree field Example [message #171109 is a reply to message #171021] Tue, 08 March 2005 23:25 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_001C_01C52436.15C0FBD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

It sounds like a bug. The algorithm should reset any of the "internal" =
fields it uses for temporary purposes. Can you open a bugzilla?
<gresh@us.ibm.com> wrote in message =
news:d0kjmd$6tj$1@www.eclipse.org...

Here is an extremely simple example to illustrate the infinite =
recursion, which occurs on the second call to visit. As my earlier note =
indicated, I can avoid the problem by resetting the .tree field to false =
for all edges before the second call to visit, but I don't know if this =
is a generally valid approach.=20

DirectedGraph graph =3D new DirectedGraph();=20
nl =3D new NodeList();=20
el =3D new EdgeList();=20
Label label1 =3D new Label();=20
label1.setText("A");=20
Node n1 =3D new Node(label1);=20
=20
Label label2 =3D new Label();=20
label2.setText("B");=20
Node n2 =3D new Node(label2);=20
=20
Label label3 =3D new Label();=20
label3.setText("a");=20
Node n3 =3D new Node(label3);=20
=20
Label label4 =3D new Label();=20
label4.setText("b");=20
Node n4 =3D new Node(label4);=20
=20
=20
nl.add(n1);=20
nl.add(n3); =20
nl.add(n4);=20
nl.add(n2);=20
=20
=20
Edge edge1 =3D new Edge(n1, n3); =20
el.add(edge1);=20
Edge edge2 =3D new Edge(n1, n4);=20
el.add(edge2);=20
Edge edge3 =3D new Edge(n2, n4); =20
el.add(edge3);=20
=20
=20
graph.nodes =3D nl;=20
graph.edges =3D el;=20
new DirectedGraphLayout().visit(graph);=20
=20
=20
//add the last edge=20
Edge edge4 =3D new Edge(n2, n3);=20
el.add(edge4);=20
graph =3D new DirectedGraph(); =20
graph.nodes =3D nl;=20
graph.edges =3D el;=20

=20
new DirectedGraphLayout().visit(graph);=20

------=_NextPart_000_001C_01C52436.15C0FBD0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2604" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>It sounds like&nbsp;a bug.&nbsp; The =
algorithm=20
should reset any of the "internal" fields it uses for temporary =
purposes.&nbsp;=20
Can you open a bugzilla?</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>&lt;<A href=3D"mailto:gresh@us.ibm.com">gresh@us.ibm.com</A>&gt; =
wrote in=20
message <A=20
=
href=3D"news:d0kjmd$6tj$1@www.eclipse.org">news:d0kjmd$6tj$1@www.eclipse.=
org</A>...</DIV><BR><FONT=20
face=3Dsans-serif size=3D2>Here is an extremely simple example to =
illustrate the=20
infinite recursion, which occurs on the second call to visit. As my =
earlier=20
note indicated, I can avoid the problem by resetting the .tree field =
to false=20
for all edges before the second call to visit, but I don't know if =
this is a=20
generally valid approach.</FONT> <BR><BR><FONT face=3Dsans-serif =
size=3D2>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DirectedGraph graph =
=3D new=20
DirectedGraph();</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nl =3D new NodeList();</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
el =3D new EdgeList();</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label label1 =3D new =
Label();</FONT>=20
<BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; label1.setText("A");</FONT> <BR><FONT face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node =
n1 =3D new=20
Node(label1);</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Label =
label2 =3D=20
new Label();</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; =
&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label2.setText("B");</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
Node n2 =3D new Node(label2);</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
Label label3 =3D new Label();</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
label3.setText("a");</FONT>=20
<BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; Node n3 =3D new Node(label3);</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; Label label4 =3D new Label();</FONT> <BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
label4.setText("b");</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node n4 =3D new =
Node(label4);</FONT>=20
<BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif size=3D2>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
nl.add(n1);</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; =
&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nl.add(n3); &nbsp; &nbsp; &nbsp;=20
&nbsp;</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; nl.add(n4);</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
nl.add(n2);</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; =
&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; Edge edge1 =3D new Edge(n1, n3); &nbsp; &nbsp; =
&nbsp;=20
&nbsp;</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; el.add(edge1);</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Edge =
edge2 =3D=20
new Edge(n1, n4);</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.add(edge2);</FONT> <BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
Edge edge3 =3D new Edge(n2, n4); &nbsp; &nbsp; &nbsp; &nbsp;</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
el.add(edge3);</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; graph.nodes =3D nl;</FONT> <BR><FONT =
face=3Dsans-serif=20
size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
graph.edges =3D=20
el;</FONT> <BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; new DirectedGraphLayout().visit(graph);</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
</FONT><BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; </FONT><BR><FONT face=3Dsans-serif =
size=3D2>&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add the last edge</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
Edge edge4 =3D new Edge(n2, n3);</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el.add(edge4);</FONT> =

<BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; graph =3D new DirectedGraph(); &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp;</FONT> <BR><FONT face=3Dsans-serif =
size=3D2>&nbsp; &nbsp;=20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; graph.nodes =3D nl;</FONT> =
<BR><FONT=20
face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
graph.edges =3D el;</FONT> <BR><BR><FONT face=3Dsans-serif =
size=3D2>&nbsp;</FONT>=20
<BR><FONT face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; &nbsp; new DirectedGraphLayout().visit(graph);</FONT> <BR><FONT =

face=3Dsans-serif size=3D2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
</FONT></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_001C_01C52436.15C0FBD0--
Previous Topic:Connections between Editors
Next Topic:Determine nature of drag in createDragSourceFeedbackFigure
Goto Forum:
  


Current Time: Tue May 13 23:32:17 EDT 2025

Powered by FUDForum. Page generated in 0.03248 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top