title: Finding near neighbors
body: <p>I need to find "near" neighbors among a set of points.</p>
  
  <p><img src="https://i.stack.imgur.com/fR5pn.png" alt="pointSet"></p>
  
  <p>There are 10 points in the above image. Red lines are edges from the <a href="http://www.mathworks.com/help/techdoc/ref/delaunay.html" rel="noreferrer">Delaunay Triangulation</a>, black stars mark the mid-lines of the edges, blue lines are the <a href="http://www.mathworks.com/help/techdoc/ref/voronoi.html" rel="noreferrer">Voronoi tesselation</a>. Point 1 has three "near" neighbors, i.e. 4, 6, and 7, but not 2 and 3, who are almost in line with the edge 1-7, but much further away. </p>
  
  <p>What is a good way to identify the near neighbors (or "good" edges)? Looking at the figure, it seems to me that either selecting edges whose mid-point falls onto the intersection with the Voronoi lines, or considering as "near" neighbors those with touching Voronoi cells could be a good solution (the classification of 3-5 can go either way). Is there an efficient way of implementing either of the solutions in Matlab (I'd be happy to get a good general algorithm that I can then translate to Matlab, btw)? </p>