Spacing nodes by moving the shortest distance possible.

85 Views Asked by At

I have a list of N nodes with positions $(x, y)$ each.

I want to move each node the shortest possible distance such that every node is placed on the radius $R$ from at least one other node, and is at least $R$ distance away from every node.

I figure the ideal pairs of coordinates will be calculated somehow using a system of equations.

For instance, this should hold:

some_node = random node
for every node in nodes, that is not ideal_node:
    ((some_node_x - node_x)**2 + (some_node_y - node_y) ** 2 >= R**2) is True

I'm not exactly sure how to proceed though, which is why I asked here.