GraphStream Users

Archives de la liste Aide

Re: help needed with layout

Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT>
  • To: "graphstream-users AT" <graphstream-users AT>
  • Subject: Re: help needed with layout
  • Date: Mon, 8 Jul 2013 15:13:41 +0200


You may have slightly better results with gravity to 0.025 or 0.03 and all nodes weights to 0.5 to 0.7. This is quite difficult to set, for no great result I fear :(


2013/7/8 Antoine Dutot <antoine.dutot AT>
Hi Susan,

One of the problems with the layout here is that it does not handle well several connected components or single nodes. These distinct components repulse each others. The distance being too large between components all other elements seem small.

This could be solved with some sort of center of attraction or gravitation that will attract components and single nodes toward the center of the graph. The feature is present in the default layout but still experimental (this is why it is not in the documentation :-)).

Try to experiment with:

graph.addAttribute("layout.gravity", 0.01);

For example, after your line graph.addAttribute("layout.quality", 4). The gravity value must be small but may be difficult to set.

Hope this will solve (at least partially) your problem. J'espère que cela vous aidera ;-)


2013/7/7 <sbarr10 AT>

Hello everyone,

I am very new to GraphStream and this is my first message.  Thank you for
developing this amazing toolkit !

I am using GS to try modeling relationships between people who test their
autosomal DNA.

The link shows what I have achieved so far.

The individual nodes represent the testers in this DNA project.  The edge value
between 2 nodes is a measure of shared DNA material.   Nodes with no
connections mean that the tester has not had a match in the project yet.  An
edge that is a thicker gray line between 2 nodes means the two testers are
known to be very close relatives (e.g., uncle-niece, mother-child, etc).

The data is static (there is no change over a few minutes.)  I am expecting the
number of testers to increase very slowly over time (months, years) as more
testers join the project.  There is no need for interaction with the graph and
there is no need for the graph to dynamically change in the display.  The data
itself will change, very slowly over months and years, as more testers join the

But as you can see I am having a problem with layout.  The nodes are bunched
too closely together.  Some node labels or edge values are obscured.  Because
the project will grow, I cannot dictate XY coordinates for each node.  I have
tried using some of the attributes listed here but I cannot get them to work or
maybe I am using them incorrectly?

My code is very minimal and listed here:


Graph graph = new MultiGraph("Driscoll");
FileSourceFactory fsf = new FileSourceFactory();
FileSource fs = null;
try {
  fs = fsf.sourceFor("driscoll.txt");
} catch( IOException e) {
} finally {
for (Node node : graph) {
  node.addAttribute("ui.label", node.getId());
for (Edge edge: graph.getEachEdge()) {

Viewer viewer = graph.display();

My input file consists of only an and ae commands, e.g.,
an kN73108
ae  line01 k190013 k84509 arcvalue=27

I understand SpringBox is the default Layout.  How can I get the nodes to repel
each other more, spread out further apart, and get more control over the
lengths of the edges?

I would love to be able to one day present this data to the O'Driscoll DNA
project and possibly to the genealogy RootsTech conference held in Salt Lake

Thank you so very much!  Merci.


P.S.  I am sorry I studied French so long ago (1981) and remember so little of
it now!

Archives gérées par MHonArc 2.6.16.

Top of page