Efficient algorithm for generating graph edges

41 Views Asked by At

Given a set of vertices with 3D spatial coordinates $\{\vec{v}_n\}$ of size $N$ and a maximum connection distance $d$, is there an efficient algorithm to find all the undirected edges connecting the vertices with distance less than $d$; loops are not considered. A naive approach would simply loop on all possible pairs, requiring $N(N-1)/2$ distance calculations. Is there an existing algorithm for finding all possible edges with scaling complexity less than $\mathcal{O}(N^2)$?