3

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!

mamruoc
  • 847
  • 3
  • 11
  • 21

1 Answers1

5

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.

fresskoma
  • 25,481
  • 10
  • 85
  • 128
  • 1
    I am pretty new to Java and JUNG, do you have any code examples to share? Please? – mamruoc Jan 10 '11 at 14:01
  • 1
    As I said, you should look at the original version of the CircleLayout in the JUNG framework itself. Here is my modified version of the CircleLayout http://pastebin.com/9UkEaqR4 , in case it help. The magic you are looking for begins around line 120. – fresskoma Jan 10 '11 at 14:05
  • Hello,I have been away last days. Please let me have a little of time verifying that it works before accepting. Thanks! – mamruoc Jan 12 '11 at 08:11