I have a chart with a variable amount of dots. All dots are connected to one or more other dots via a line. The x values of these dots are fixed, but the y-values may vary.
How do I get the optimal configuration of y-values for these dots?
A simple example with four dots and three lines. The bottom configuration is not optimal since one or more lines are overlapping. The top configuration is optimal, since no lines are overlapping.
A more complex example (not optimized):

