daveray / dorothy

Hiccup-style generation of Graphviz graphs in Clojure
244 stars 25 forks source link

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

Open Engelberg opened 10 years ago

Engelberg commented 10 years ago
=> (-> [[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!)
daveray commented 10 years ago

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
Engelberg commented 10 years ago

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 commented 10 years ago

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.

daveray commented 10 years ago

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.

Engelberg commented 10 years ago

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

daveray commented 10 years ago

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?

Engelberg commented 10 years ago

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 notifications@github.com 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 .