dorothy icon indicating copy to clipboard operation
dorothy copied to clipboard

digraph sometimes doesn't render parallel edges, depending on order.

Open Engelberg opened this issue 11 years ago • 7 comments

=> (-> [[1 3 {:color :blue, :dir :none}]
        [1 3 {:color :red, :dir :none}]
        [1 2 {:color :green, :dir :none}]]
     digraph
     dot
     show!)

This renders the graph correctly, but simply swap two of the edges and it no longer works properly:

=> (-> [[1 3 {:color :blue, :dir :none}]
        [1 2 {:color :green, :dir :none}]
        [1 3 {:color :red, :dir :none}]]
     digraph
     dot
     show!)

Engelberg avatar Apr 06 '14 22:04 Engelberg

Hey Mark. I don't get any difference in the rendering of the two.

screen shot 2014-04-08 at 8 16 06 am

Could it be a graphviz issue? Here's my version info:

$ dot -v
dot - graphviz version 2.28.0 (20111028.1807)
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_quartz.6.dylib
Using textlayout: textlayout:quartz
Activated plugin library: libgvplugin_dot_layout.6.dylib
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.6.dylib
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
    /usr/local/lib/graphviz/config6
        was successfully loaded.
    render  :  dot fig gd map ps quartz svg tk vml vrml xdot
    layout  :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device  :  bmp canon cgimage cmap cmapx cmapx_np dot eps exr fig gd gd2 gif gv imap imap_np ismap jp2 jpe jpeg jpg pct pdf pict plain plain-ext png ps ps2 psd sgi svg svgz tga tif tiff tk vml vmlz vrml wbmp xdot
    loadimage   :  (lib) bmp eps gd gd2 gif jpe jpeg jpg pdf png ps svg

daveray avatar Apr 08 '14 15:04 daveray

I'm on version 2.30.1.

Through more testing, I've found that the parallel edge does get drawn as long as all the edges between a given pair of vertexes are grouped together, but doesn't get drawn when they are separated by info about other edges.

Engelberg avatar Apr 08 '14 15:04 Engelberg

I've worked around the problem by sorting the edges first before passing them to digraph, but if you need me to do anything to further troubleshoot this so others are not affected, let me know.

Engelberg avatar Apr 10 '14 02:04 Engelberg

Can you try feeding the output of the dot function directly to the Graphviz dot command?

I'll also try upgrading Graphviz to see if I can reproduce it, although I'm not sure what to do about it.

daveray avatar Apr 10 '14 02:04 daveray

I get the same problem when I feed the output directly to dot at the command prompt.

Dorothy generates the following string:

=> (-> [[1 3 {:color :blue, :dir :none}]
           [1 2 {:color :green, :dir :none}]
           [1 3 {:color :red, :dir :none}]]
        digraph
        dot)
"digraph {\n\"1\" -> \"3\" [color=blue,dir=none];\n\"1\" -> \"2\" [color=green,dir=none];\n\"1\" -> \"3\" [color=red,dir=none];\n} "

and when I feed it to dot at the command prompt, I get the following png:

graph

Engelberg avatar Apr 13 '14 18:04 Engelberg

Feeding that input directly to dot versions 2.28.0 and 2.38.0 gives the correct output (both red and blue edges between 1 and 3). Maybe there was a bug in 2.30.0 that has since been fixed?

daveray avatar Apr 14 '14 03:04 daveray

OK, good to know it's not an issue in the newer versions of dot. Thanks for investigating.

On Sun, Apr 13, 2014 at 8:51 PM, Dave Ray [email protected] wrote:

Feeding that input directly to dot versions 2.28.0 and 2.38.0 gives the correct output (both red and blue edges between 1 and 3). Maybe there was a bug in 2.30.0 that has since been fixed?

Reply to this email directly or view it on GitHubhttps://github.com/daveray/dorothy/issues/5#issuecomment-40331508 .

Engelberg avatar Apr 14 '14 04:04 Engelberg