Re: [graphviz-interest] Meaning of "canon" output
Ivan Lazar Miljenovic <[email protected]> Tue, 13 May 2014 23:15:45 +1000
| Newsgroups | gmane.comp.video.graphviz |
|---|---|
| Message-ID | <CA+u6gbwJ9JbuHjmZJe9zW_SGkD5w8J52cUF+NUSGm5SacPA1Gw@mail.gmail.com> |
I maintain the Haskell graphviz library that helps people generate Dot graphs and calls dot, neato, etc.: http://hackage.haskell.org/package/graphviz . It also supports parsing most of the Dot language. As part of it (primarily because this was how the original author wrote it), it has the notion of a "canonical representation" that was based upon how `dot -Tcanon` worked: namely that Dot code followed the general order of: 1. Attributes 2. Sub-graphs 3. Nodes 4. Edges The library itself no longer relies upon this behaviour (but this representation is still used by default for bulk conversions of other data structures into Dot code); it's just that I haven't touched it since Graphviz-2.30.0 came out, and as part of my testing process I run `dot -Tcanon` on the various sample graphs and make sure that the Canonical representation can parse them. As of at least 2.32.0 (which was the oldest version my package manager had available) it no longer can, as `dot -Tcanon` now intersperses nodes amongst the edges. I don't _need_ this actual behaviour from `dot -Tcanon`; the fact that it seems to have changed just piqued my interest into whether or not there is a formal definition of the "canonical representation of Dot code" it claims to produce. On 13 May 2014 23:04, John Ellson <[email protected]> wrote: > You would have to look at the code. Basically its just a pretty-printer. > Why does it matter? > > If you want to extract information from it your should use a DOT-syntax > parser that can deal with the > language definition: > http://www.graphviz.org/content/dot-language > > Can you ask your question a different way? What are you looking for? > > > > On 05/13/2014 08:31 AM, Ivan Lazar Miljenovic wrote: >> >> Right, but what is the definition of "canonically-formatted"? >> >> On 13 May 2014 22:27, John Ellson <[email protected]> wrote: >>> >>> The default output from dot is -Tdot, which is DOT syntax annotated with >>> layout information. >>> With -Tcanon the layout is not done; the output is still in DOT syntax, >>> but >>> it >>> is just a canonically-formatted rewrite of the input. >>> >>> $ echo "digraph {hello->world}" | dot -Tdot >>> digraph { >>> graph [bb="0,0,62.394,108"]; >>> node [label="\N"]; >>> hello [height=0.5, >>> pos="31.197,90", >>> width=0.79437]; >>> world [height=0.5, >>> pos="31.197,18", >>> width=0.86659]; >>> hello -> world [pos="e,31.197,36.104 31.197,71.697 31.197,63.983 >>> 31.197,54.712 31.197,46.112"]; >>> } >>> >>> >>> $ echo "digraph {hello->world}" | dot -Tcanon >>> digraph { >>> node [label="\N"]; >>> hello -> world; >>> } >>> >>> >>> John >>> >>> >>> >>> On 05/13/2014 05:40 AM, Ivan Lazar Miljenovic wrote: >>>> >>>> My understanding of the canon output for dot, etc. was that it >>>> pretty-printed Dot code into the following format: >>>> >>>> <graph or subgraph declaration> { >>>> >>>> >>> _______________________________________________ >>> [email protected] >>> http://lists.research.att.com/mailman/listinfo/graphviz-interest >> >> >> > -- Ivan Lazar Miljenovic [email protected] http://IvanMiljenovic.wordpress.com _______________________________________________ [email protected] http://lists.research.att.com/mailman/listinfo/graphviz-interest