Search code examples
javajung

How to plot a node in given coordinate using JUNG


I want to virtualize my network simulations and need to plot the nodes in the network. Each node has a pre-defined location and I need to plot the nodes into the correct coordination.

I am using JUNG: http://jung.sourceforge.net/applet/index.html

Any suggestions?

Thanks!


Solution

  • I recently solved this problem by writing my own rendering Layout for JUNG.

    As base for my derived layout I used the Circle Layout, which is pretty simple. In there you will see that JUNG does a setLocation(Dimension d) for every Vertex, which is pretty much what you are looking for, I guess. Just take a look at the source of the CircleLayout. Then you could use a custom Vertex object, which stores the coordinates you want the vertex to have, which is then read by your custom layout.