File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Network nodes simulation using arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Network nodes simulation using arrays" Watch "Network nodes simulation using arrays" New topic

Network nodes simulation using arrays


Joined: Apr 05, 2007
Posts: 1
I am try to do a simulation for a computer network.My objective is to interconnect nodes to each other.For e.g node1 is connected to node3,4,5 and so on.I am using an array of 500 elements for this. The nodes are randomly connected to each other.So for e.g. how do i make the elements 3,4,5(nodes) refer to element 1(node).
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
I think a type of LinkedList would work better than an array for that.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Maybe give each Node a collection of connected Nodes. Then your Network could do things like:

Now you can randomly select two Nodes from your array and connect them.

Does that get you started?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Network nodes simulation using arrays
It's not a secret anymore!