LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Neighbour list simulation

hi

 

i need to simulate simple thing in  LV ,

 

i have a few number of nodes(each defined by x,y coordinates) that are placed randomly in the X,Y coordinate system..

i need to find neighbours of each node by calculating distances between two nodes and if the distance is within range then that node  should be stored in the neighbour list of the node in consideration...

 

How can i do that in LV,

 

0 Kudos
Message 1 of 2
(2,479 Views)

This is the same problem whether it's in LabVIEW or a text based language.

 

There are brute force ways of doing this and there are also elegant algorithms which will be more efficient if your number of nodes is very large.

 

Brute force Method 1:

Make a typedef cluster (call it "node" or something descriptive) with x and y

Read your x,y coordinates into an array of nodes.

Write a subVI which takes two nodes as inputs and calculates distance.

Loop over the array of nodes and find distances to your node of interest.  If distance is less than your threshold, use a shift register and build array to add items to the list.

 

This method will be horribly slow and inefficient if you have a large number of nodes.

 

0 Kudos
Message 2 of 2
(2,472 Views)