Re: [graphviz-interest] Intended behaviour of "canon" output

"Emden R. Gansner" <[email protected]> Tue, 13 May 2014 09:54:58 -0400
Newsgroups gmane.comp.video.graphviz
Message-ID <[email protected]>
On 5/13/14 9:21 AM, John Ellson wrote:
> The language definition in
> http://www.graphviz.org/content/dot-language
> hasn't changed, but the graph library that implements the core
> graph parsing and data structures has changed from libgraph to libcgraph
> in the three years or so.   So I suspect what you are seeing is some
> syntactically-inconsequential difference in output ordering.
>
Essentially, dot -Tcanon is equivalent to

    g = agread (infile,...);
    agwrite (g, outfile);

Pre-2.30, we used libgraph, whose agwrite wrote the nodes first, followed by the edges. The agwrite 
function
in libcgraph writes a node, followed by its out edges. Hence the difference.
> Your ordering assumptions are too strict, I believe. 
Our use of the word "canon" is probably misleading, especially to a community that has a formal 
semantics for its
language. As John noted, all that is intended is a pretty-printed version of the input, which is 
what we also state in
the documentation. We never meant that there was some well-defined document structure, unless this 
was something
in the back of Stephen's brain.

On a related note, the newer agwrite is more liberal in its use of newlines. If you have a tool that 
assumes a node or edge
definition is contained within a single line, it's going to break. In general, the only safe 
approach is to use a parser based
on the DOT grammar.

     Emden

_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest