GraphStream Users

Archives de la liste Aide


Problem with retrieving Node Position


Chronologique Discussions 
  • From: Barbaros Özdemir <barbaros.oezdemir AT gmail.com>
  • To: graphstream-users AT litislab.fr
  • Subject: Problem with retrieving Node Position
  • Date: Tue, 11 Aug 2015 16:53:35 +0200

Hi @all,

i tried to retrieve node positions just as suggested on the tutorial page (http://graphstream-project.org/doc/Tutorials/Graph-Visualisation_1.0/#viewers) in chapter 2 under "Retrieving nodes coordinates of the automatic layout". 

I do however get for each node the position "0.0 0.0 0.0", which does not make any sense as the drawn graph looks different. 

I appreciate any feedback/comment on what i am doing wrong. 

Thanks in advance. 

Best regards,
Barbaros Özdemir

PS: Here the code i have executed;

Import org.graphstream.graph *.
Import org.graphstream.graph.implementations *.
Import org.graphstream.ui.view.Viewer;

import static org.graphstream.algorithm.Toolkit *.
 
public class Tutorial1 {
        public static void main (String args []) {
         Graph graph = new Graph Single ("Tutorial 1");
        
         graph.addNode ("A");
         graph.addNode ("B");
         graph.addNode ("C");
         graph.addNode ("D");
         graph.addEdge ("AB", "A", "B");
         graph.addEdge ("AC", "A", "C");
         graph.addEdge ("AD", "A", "D");
         graph.addEdge ("BD", "B", "D");
         graph.addEdge ("BC", "B", "C");
         graph.addEdge ("DC", "D", "C");
                 
         for (Node n: graph) {
         String nodeId = n.getId ();
         Node node = graph.getNode (nodeId);
         Double pos [] = nodePosition (node);
         System.out.print (n.getId () + "");
         for (int i = 0; i <pos.length; i ++) {
         System.out.print (pos [i] + "");
         }
         System.out.println ("");
         }
        
         Viewer viewer = graph.display ();
         viewer.enableAutoLayout ();
        }
}

PPS: And here the output (the graph is in attachment): 

A: 0.0 0.0 0.0 
B: 0.0 0.0 0.0 
C: 0.0 0.0 0.0 
D: 0.0 0.0 0.0 

Attachment: Screenshot from 2015-08-11 16:32:37.png
Description: PNG image




Archives gérées par MHonArc 2.6.16.

Top of page