The problem: Looking for quite some time for a js graph library to create a directed graph (e.g. using dagre
layout), with the constrain of non-overlapping edges.
svg
based solution (considering that all elements are in the DOM), d3.js using the dagre-d3, but still the information in the DOM is the path route.canvas
or svg
based.Below a graphical representation of the objective.
I want to detect that edges 0>1
and 2>3
are overlapping.
Any ideas, thoughts are welcome.
If there is something wrong with my logic, corrections/suggestions are more than welcome.
Finding edge crossings (line intersections) is a fairly simple bit of geometry which is explained here --> https://stackoverflow.com/a/18234609/368214
But then minimising such edge crossings in a graph (zero edge crossings are only possible in planar graphs) is one of the great research challenges of graph layout - https://cs.stackexchange.com/questions/14901/how-to-reduce-the-number-of-crossing-edges-in-a-diagram
Some graph layouts for specific graph types like DAGS such as Sugiyama aim to reduce crossings and similar cytoscape layouts are available at yfiles if that helps (i.e. the hierarchic layout) --> http://apps.cytoscape.org/apps/yfileslayoutalgorithms