Trouble with the library : neato works while dot does not

Hello,

I am currently having some trouble with the library.

Here is my code :

GVC_t* gvc = gvContext();
Agraph_t* G = agmemread(serializedData);
delete[] serializedData;

agset(G, (char*) "label", (char*)"");
gvLayout (gvc, G, "neato");

gvRenderData(gvc, G, "svg", &serializedData, &_size);
gvFreeLayout(gvc, G);

agclose (G);

gvFreeContext(gvc);

This code produces nice looking graphs for my input data, only if I use the neato algorithm. If I use dot, I get a mess. However if I use dot from the command line on the same graph, it works.

Here is what I want : the result of the command-line call to dot.
http://imageshack.com/a/img19/2030/n3th.png

Here is what I get if I set dot as the layout algorithm in my code :
http://imageshack.com/a/img203/7591/nd7j.png

And if I set the neato algorithm :
http://imageshack.com/a/img89/1651/t4z8.png

As you can see, I want to use the dot algorithm because it is much clearer.
Here is my DOT file :
http://pastebin.com/EaySENPQ

Thanks!

Hello, thanks for taking the

Hello, thanks for taking the time to answer.

I'm running graphviz 2.26.3-16.2 which is the version in the Debian jessie (testing) repositories.

Here is the full code : https://github.com/jcelerier/dpetri/blob/master/src/lib/petrinettools.h

However it requires Qt, oscpack, a dns_sh.h implementation and the Petri Net API (which is used to generate the DOT files from Petri Nets (a kind of automaton)) in order to build if you want to try.

Here I put three SVG's : 

http://pastebin.com/FL9cuYjm

* The SVG output by calling the dot algo from the library

* The SVG output by calling the dot algo from the CLI

* The SVG output by calling the neat algo from the library (not sure if it's useful)

 

Thanks !

 

 

 

I'm afraid you are going to

I'm afraid you are going to have to supply more information. I ran your code (supplying the missing pieces) and everything worked fine. In addition, the neato layout you provide is still wrong; try running neato from the command line and compare.

It would be good to have the version of Graphviz you are using, plus what machine and OS you are running. It might also be helpful to have an entire program, plus your dot output in svg or postscript. Consider using the bug tracker http://www.graphviz.org/content/graphviz-issue-tracker to supply this. Thanks.

I'm guessing you are using an older version of Graphviz because we've tightened the compiler to disallow a simple attribute name such as fixedsize as shorthand for fixedsize=true.

Hello, thanks for taking the

Hello, thanks for taking the time to answer.

I'm running graphviz 2.26.3-16.2 which is the version in the Debian jessie (testing) repositories.

Here is the full code : https://github.com/jcelerier/dpetri/blob/master/src/lib/petrinettools.h

However it requires Qt, oscpack, a dns_sh.h implementation and the Petri Net API (which is used to generate the DOT files from Petri Nets (a kind of automaton)) in order to build if you want to try.

Here I put three SVG's : 

http://pastebin.com/FL9cuYjm

* The SVG output by calling the dot algo from the library

* The SVG output by calling the dot algo from the CLI

* The SVG output by calling the neat algo from the library (not sure if it's useful)

 

Thanks !

So if you write out to a file

So if you write out to a file the contents of serializedData just after you get into toDot(), you claim that is identical to what is in http://pastebin.com/EaySENPQ?

Then please download the C program at http://pastebin.com/KaQzPK1x and compile it and run it, and see what you get on stdout.

Okay, I tried this and I came

Okay, I tried this and I came up to very weird things.

Your C program produces the good output. So I tried copy pasting it into my code and it did produce the wrong output again.

So I tried putting it in the main() like this : 

http://pastebin.com/wvnJDxW0

And here (lines 152, 153) it is VERY weird : 

  • if I put submain(); before QApplication app(argc, argv); it produces the good output
  • if I put submain(); after QApplication app(argc, argv); it produces the wrong output

So it looks like it's Qt who f**** things up, but I don't have any idea why.

I ran your code and, alas,

I ran your code and, alas, switching the two lines had no effect for me. The only change I made was to use a qmainwindow.h and QMainWindow, as I didn't have your include file. You could check in there, or send it along and I can try it also.

You can also make the test program simpler by replacing gvRenderData + fwrite with a single call to gvRenderFilename(gvc,G,"dot", "out.gv"); This would help show if the problem is occurring in the layout or the rendering. (I assume the former as you were also geting bad png output.) We might be able to get a better idea as to where to look. Or you can run gdb.

I fixed my problem by

I fixed my problem by compiling the latest Graphviz from source. Thanks for your time ! But it will always be a mystery for me !

I would assume there was some

I would assume there was some old library or something lying about. I'm just glad it is now working.

Hello, Sorry for taking some

Hello,

Sorry for taking some time to answer. I tried with your suggestions and if I try to make it output using gvRenderFilename I get another (wrong) output as DOT : http://pastebin.com/9LKL6ENc

I also checked the return values of the gv functions but they are always 0.

I am willing to use gdb, but I don't really know for what I should be looking :/ wouldn't there be an easy way to compare the "good" and "bad" execution paths to see where things go wrong ?

Also, for me here is a minimal non-working program : 

http://pastebin.com/Ayr6yBJ6

Compiled with -lgvc -lgraph.

Recent comments