GraphStream Users

Archives de la liste Aide

ViewerPump and visualization questions

Chronologique Discussions 
  • From: "Gergely Zahoransky-Kohalmi" <gzahoransky-kohalmi AT>
  • To: <graphstream-users AT>
  • Subject: ViewerPump and visualization questions
  • Date: Sat, 11 Jan 2014 19:32:38 -0700

First, Happy New Year for you All!

I have an easier and a more complicated question for you, I hope you can help
me out on these issues.

For reference, I'm using the 1.2 version of GS.

1. The easy one: If I display the graph with the graph.display() method all
the things defined in the css file are showing up nicely. On the other hand,
if I define a custom view (following directions in your tutorial), the some
things are just not working. Such things: if I use pi-charts as edge sprites,
then there's always only one color (there are multiple colors when using the
default graph.display() method). I'm using the "angle" edge type (ref:, but it is not
showing up on my view, only in the case of calling graph.dipslay(). I include
this line in the main method according to your directions:
I've found a workaround, though. If I start my code with the
-Dgs.ui.renderer=org.graphstream.ui.j2dviewer.J2DGraphRenderer switch
(following your tutorial), then things look just the way I want with my
custom view (pi charts are multi-colored).
I'd like to solve this inside the code, but so far I could not achieve it. On
a side note, there's a warning message when starting the program with the

<<"gs.ui.renderer" is deprecated,use "org.graphstream.ui.renderer" instead">>
, so you might want to change that in the tutorial to:
-Dorg.graphstream.ui.renderer=org.graphstream.ui.j2dviewer.J2DGraphRenderer .

2. The more complicated question:

I managed to create a gui app where I can create a graph, select a node with
right-click, and the do things with the set of selected nodes. If I enable
the auto layout on the viewer, then clicking again on one of the nodes, I got
the following error message:

"Exception in thread "AWT-EventQueue-0"
org.graphstream.graph.IdAlreadyInUseException: singleton exception: id "3629"
already in use. Cannot create a node."

I am not sure why a simple click on the graph view wants to create a node, I
did not implement anything like that. I also tried to move around the part of
the code which is responsible for setting up the ViewerPipe, no success. (I
thought I might need to set the ViewerPipe before actually adding nodes to
the graph by the graph.addNode() method).

The scheme of my interactive gui is as follows:

1. In the main thread, I initiate a Viewer as: viewer = new Viewer(graph,
2. I add a view by addDefaultView

3. I create a ViewPipe, and plug that in into a custom mouse manager so that
the pump() method is only called when some node is clicked.

4. I visualize the view as follows (code from the main thread, i.e. main

EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MyGraph window = new MyGraph();


} catch (Exception e) {

For the record, I don't take advantage on the methods of ViewerListener, as
it only deals with basic things (no distinction between node clicks,
selection, right and left clicks).

Any help would be greatly appreciated!



  • ViewerPump and visualization questions, Gergely Zahoransky-Kohalmi, 12/01/2014

Archives gérées par MHonArc 2.6.16.

Top of page