Calculation of the layout of the graph that minimizes the intersection of edges, NP-hard, so there is no single algorithm; There are different algorithms with different trade-offs. A force - based layout ( Fruchterman-Reingold ) is one of the layered approaches ( Sugiyama ). There are also layouts for certain types of graphs, such as trees ( Reingold-Tilford ) and small worlds ( van Ham-van Wijk ). A limited layout such as Dig-CoLa ( Dwyer-Koren ) is another class of algorithm.
If you need an algorithm that specifically seeks to minimize the number of edge intersections, you can use simulated annealing . Although this will eventually find the right answer, it can be quite slow.
source
share