I have the following sets of 2D points. Each point represents a node.

x=[0 1 1 3 4 4 5];

y=[0 0 1 3 4 5 6];

If a point is within 1 unit of distance from another point they are considered neighbors. The following code creates a neighborhood matrix A in which 1 indicates that the corresponding nodes(points) are neighbors.

for i=1:n

       for j=1:n

                if dist(i,j)

More Tariq Islam's questions See All
Similar questions and discussions