To calculate the optimal placement of a node:

optimize the distance equation (when n>2):

where CN is the edge width between nodes N and 0, and xN and yN are points connected to x0, y0

with partial derivatives:

df/dx0=

and

df/dy0= ...

which we can solve for numerically.