Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002318graphvizOutput Generationpublic2013-07-29 05:352013-08-01 12:30
Reporterryandesign 
Assigned Toerg 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionreopened 
Platformx86_64OSOS XOS Version10.8.4
Summary0002318: Improve precision of xdot output by not rounding coordinates so much
DescriptionMost coordinates in xdot output are rounded to integers, resulting in imprecise output in some situations. See 0002317 for one example. While allowing arbitrary precision floating point numbers would bloat the output considerably, I think the increased file size caused by using one or two digits after the decimal point would be a worthwhile tradeoff for the increased accuracy.

I suggest all numbers in xdot output should be displayed with 2 digits after the decimal place, removing any trailing zeroes.

Not all numbers in xdot are rounded to integers, even when some should be. Font sizes, for example, are specified unnecessarily precisely with no benefit, i.e.:

_ldraw_="F 14.000000 11 -Times-Roman c 9 -#000000ff T 27 12 0 19 3 -red "

could have just as accurately been represented as:

_ldraw_="F 14 11 -Times-Roman c 9 -#000000ff T 27 12 0 19 3 -red "

Come to think of it, when a color's opacity is 100%, that doesn't need be to listed either, does it?

_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 12 0 19 3 -red "
TagsNo tags attached.
AUXILLARY-FILES
DATE-FIXED
FIX-COMMENT
FORMER-ID
INPUT-FILE
OUTPUT-FILE
STATUS-COMMENT
VERSION2.31.20130729.0446
Attached Files

- Relationships

-  Notes
User avatar (0000412)
erg (administrator)
2013-07-31 13:38

These fits with our conversion of a few years ago to almost all floating point. The sizes and coordinates now provide 2 digits after the decimal point. And the precision of font size is trimmed. As the xdot specification never stated the type of values generated, and the geometric context suggest floating point anyway, the xdot version number is left unchanged.
User avatar (0000415)
ryandesign (reporter)
2013-08-01 03:13

Thanks. The documentation may not explicitly state that numbers can be floating point, but the font size always was, and at least in my case for Canviz, I only have a single function for dealing with numbers anywhere they might occur in _*draw_ attributes, and that function handles decimal numbers fine.


In the changes you made to numbers in the _*draw_ attributes yesterday, could you omit trailing zero decimal places? The old output for a test graph included this line:

_ldraw_="F 14.000000 11 -Times-Roman c 9 -#000000ff T 27 84 0 7 1 -a ",

With the new version, this line is:

_ldraw_="F 14.0 11 -Times-Roman c 9 -#000000ff T 27.00 83.50 0 7.00 1 -a ",

This could be more efficiently represented as:

_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 27 83.5 0 7 1 -a ",

My goal for Canviz is to have an xdot file that is precise enough to produce a drawing equivalent to a Graphviz-generated png, while taking as few bytes possible for quick transmission over the wire.


One other place in the output where floating point numbers were already included is in the "pos" attribute. For example, "-Tdot" output for the simple graph "graph {a--b}" produces in part this output:

    a -- b [pos="27,71.697 27,60.846 27,46.917 27,36.104"];

These coordinates appear to be rounded to at most three decimal places. For consistency with the _*draw_ attributes perhaps this could be changed to use at most two decimal places.
User avatar (0000417)
erg (administrator)
2013-08-01 12:30

Okay, I've stripped away unnecessary 0's and decimal points, and removed alpha in color if it equals FF. The pos will wait.

- Issue History
Date Modified Username Field Change
2013-07-29 05:35 ryandesign New Issue
2013-07-31 13:38 erg Note Added: 0000412
2013-07-31 13:38 erg Assigned To => erg
2013-07-31 13:38 erg Status new => resolved
2013-07-31 13:38 erg Resolution open => fixed
2013-08-01 03:13 ryandesign Note Added: 0000415
2013-08-01 03:13 ryandesign Status resolved => feedback
2013-08-01 03:13 ryandesign Resolution fixed => reopened
2013-08-01 12:30 erg Note Added: 0000417
2013-08-01 12:30 erg Status feedback => resolved


MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker