How to untangle edges between nodes from different subgraphs

I have made a dot graph that includes several subgraphs; both nodes within a same subgraph and in different subgraphs are connected. However, edges connecting nodes in different subgraphs are some times messy and tangled. How could I untangle them?
Attached is the dot file. Edges defined in lines after the comment, "// time 42 to 43" (line 446) are specially tangled. I have tried using "weight", as described in dotguide.pdf, to straigthen the edges, and "remincross" to minimize crossing, but to no avail. Help will be appreciated.

test1_af_0_M_S.txt17.76 KB

How to untangle edges between

The problem arises because of the edge labels, which in dot are treated like pseudo-nodes. This guarantees adequate spacing but sometimes can lead to skewed graph layouts. In your case, crossing reduction is not sufficient to pull the  edge labels back close to the related nodes.
The simplest solution is to use xlabels rather than labels, the former being lightweight labels added after the graph is laid out. You will need a version of Graphviz that is 2.29 or later.

Recent comments