GraphStream Users

Archives de la liste Aide

Re: How to use GraphicGraph

Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT>
  • To: graphstream-users AT
  • Subject: Re: How to use GraphicGraph
  • Date: Tue, 2 Aug 2011 14:07:43 +0200

| Graph g = ... ;
| Viewer v = g.display(false);
| ProxyPipe proxy = v.newThreadProxyOnGraphicGraph();
| proxy.addAttributeSink(g);
| proxy.pump();
| Steiner s = new Steiner();
| s.init(g);
| s.compute();

2011/8/2 Stefan Balev <stefan.balev AT>

I have an application that dynamically recomputes the coordinates of the nodes of a graph :

Graph g = ...
new Steiner(g).compute();

At the beginning I naively thought that when the user drags a node in the viewer, this will change the "xyz" attribute of the node in g. Then I realized that dragging a node actually changes the "xyz" attribute of the node in the GraphicGraph associated to the viewer. In order to have the coordinate changes back to g I tried something like this:

Graph g = ...
new Steiner(g).compute();

Now almost everything works fine, but sometimes I have random exceptions like this:

Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException
at java.util.LinkedList.remove(
at java.util.LinkedList.removeFirst(
at java.util.LinkedList.remove(
[ ... stack trace too long to paste it entirely ... ]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Is it because of the "Caution : Use the returned graph only in the Swing thread !!" warning that we can read in Javadoc of getGraphicGraph()? If yes, what is the easiest proper way to do what I am trying to? Thanks for your help.

Btw, everything works great when I use FileSinkImages. Here is a small video showing this.



Guilhelm Savin
PhD Student of Computer Science

Archives gérées par MHonArc 2.6.16.

Top of page