[NOTE: I am not a Graphviz developer, just a “friend of the family”. I don’t speak for the developers]
Cool, I think you found a fascinating “accidental” result of a complex set of algorithms. Not documented that I know of, but not necessarily a bug. A gray area.
But can you depend on it, probably, but let me suggest a “more” legal alternative.
The basic idea is :
- you define the complete graph excluding all the “on-top” edges
- run it through dot with this command: dot -Tdot myfile.gv >myfile.dot
- you modify (edit) myfile.dot duplicating the “bottom” edges to create the “top” edges
- change attribute values (color, penwidth, style, …) as needed
- this process can be done manually (see below), with any programming language, or with the Graphviz GVPR language
Then run the edited myfile.dot through this command: neato -n2 -Tpng myfie.dot >myfile.png (note the -n2 option)
The FAQ has a section that helps explain, as does the documentation on dot as an output file format
Here is an example of the result of step 3:
graph {
graph [bb=“0,0,252,108”];
node [label="\N"];
A [height=0.5,
pos=“27,90”,
width=0.75];
X [height=0.5,
pos=“81,18”,
width=0.75];
A:e – X:w [color="#000000",
penwidth=9.0,
pos=“55,90 71.006,90 36.994,18 53,18”];
// duplicated by hand
A:e – X:w [color="#ff00ff",
penwidth=3.0,
pos=“55,90 71.006,90 36.994,18 53,18”];
B [height=0.5,
pos=“99,90”,
width=0.75];
Y [height=0.5,
pos=“153,18”,
width=0.75];
B:e – Y:w [color="#000000",
penwidth=9.0,
pos=“127,90 143.01,90 108.99,18 125,18”];
// again
B:e – Y:w [color="#ffff00",
penwidth=3.0,
pos=“127,90 143.01,90 108.99,18 125,18”];
C [height=0.5,
pos=“171,90”,
width=0.75];
Z [height=0.5,
pos=“225,18”,
width=0.75];
C:e – Z:w [color="#000000",
penwidth=9.0,
pos=“199,90 215.01,90 180.99,18 197,18”];
// number 3
C:e – Z:w [color="#00ffff",
penwidth=3.0,
pos=“199,90 215.01,90 180.99,18 197,18”];
}
Convoluted, yes. But definitely within the bounds of legal.
If you decide to try this, you could add “extra” attributes to the edges you wanted to duplicate like dup_pen=3 and dupcolor=blue (documented as legal). to give instructions to your script.