GraphStream Users

Archives de la liste Aide


Re: help needed with layout


Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, sbarr10 AT earthlink.net
  • Subject: Re: help needed with layout
  • Date: Mon, 8 Jul 2013 14:35:44 +0200

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 ;-)

Antoine


2013/7/7 <sbarr10 AT earthlink.net>
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.
http://freepages.genealogy.rootsweb.ancestry.com/~colin/DriscollOfCork//Participants/autosomalDNA.png

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
project.

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?

http://graphstream-project.org/doc/FAQ/Attributes/Is-there-a-list-of-attributes-with-a-predefined-meaning-for-the-layout-algorithms_1.0/

My code is very minimal and listed here:

System.setProperty("org.graphstream.ui.renderer",
"org.graphstream.ui.j2dviewer.J2DGraphRenderer");

Graph graph = new MultiGraph("Driscoll");
FileSourceFactory fsf = new FileSourceFactory();
FileSource fs = null;
try {
  fs = fsf.sourceFor("driscoll.txt");
  fs.addSink(graph);
  fs.readAll("driscoll.txt");
} catch( IOException e) {
  System.err.println(e.getMessage());
} finally {
fs.removeSink(graph);
}
for (Node node : graph) {
  node.addAttribute("ui.label", node.getId());
  //node.addAttribute("layout.weight",10);
}
for (Edge edge: graph.getEachEdge()) {
  edge.addAttribute("ui.label",edge.getAttribute("arcvalue"));
  //edge.addAttribute("ui.weight",30);
}
graph.addAttribute("ui.quality");
graph.addAttribute("layout.quality",4);
graph.addAttribute("ui.stylesheet",
"url('file:///c:/dev/graphstream/modeldna/dist/driscoll.css')");

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
City.

Thank you so very much!  Merci.

Susan

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