There are a number of well-established algorithms / libraries that have been developed for graphical drawing applications, you can get a little background here .
For drawing undirected graphs, a popular choice is the force-based layout algorithm, in which graph graphs are treated as springs (attractive forces), while vertices are treated as charged particles (using repulsive forces). The algorithm works by updating the positions of the vertices based on these forces until a steady state is reached. You can learn more about power methods here . Since these algorithms seek an equilibrium solution, they often lead to pseudo-optimal layouts, without much edge bending.
You may be interested in using one of the many graphics libraries available. The Graphviz package is usually pretty good and supports a number of different algorithms for different graphical applications.
Darren engwirda
source share