Given an even number of vertices, how to find an optimum set of pairs based on proximity?

Posted by Alex Z on Stack Overflow See other posts from Stack Overflow or by Alex Z
Published on 2012-09-17T02:40:59Z Indexed on 2012/09/17 9:38 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

The problem:

  • We have a set of n vertices in 3D euclidean space, and there is an even number of these vertices.

  • We want to pair them up based on their proximity. In other words, we'd like to be able to find a set of vertex pairs, where the vertices in each pair are as close as possible together.

  • We want to minimise sacrificing the proximity between the vertices of any other pairs as much as possible in doing this.

  • I am not looking for the most optimal solution (if it even strictly exists/can be done), just a reasonable one that can be computed relatively quickly.

A relatively awful brute force approach involves choosing a vertex and looping through the rest to find its nearest neighbor and then repeating until there are none left. Of course as we near the end of the list the closest vertex could be very far away, but it is the only choice, therefore this can fail badly on the third point above.

© Stack Overflow or respective owner

Related posts about c++

Related posts about algorithm