Hello,

I have written some java classes to generate a random network.
The network is made of : 200 nodes . Each node has a maximum of 50 neighbors.
What i want is to Randomly chose a node from that network and GRAPHICALLY show it with its one hop neighbors and its second hop neighbors.
I have these information saved in the code since each Node has 2 arraylists, one to save its one hop neighbors, and another to save it second hop neighbors. I have never used java to draw before, can you please tell me what classes i should use in order to get what i want ? thank you :)

Look at the example inside java jdk package jdk1.7.0/demo/applets/GraphLayout/example4.html Earlier versions also include this example.

If it would work for you to get a jpeg (or other format) displaying the graphs, consider using the DOT language.

i dont want to use another language ..id rather code in java

You need to come up with a design of display first. Then you can aim to create a graphic for it. You could simply use 2D graphic to display which is not difficult to do. The main issue for you is how you want it to be presented. What constraint of display in term of size of display, layout, etc. Programming part for this graphic display is not that important.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.