Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000833graphvizNeatopublic2005-03-14 18:332011-04-28 04:03
ReporterDustin Lang 
Assigned Toerg 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOS*-*-*OS Version
Summary0000833: neato: nearby pinned nodes cause incorrect PostScript output
Description



Hi,



I encountered this problem while using neato to draw a real graph where
the nodes are pinned and their positions are chosen randomly. This small
graph demonstrates the bug.



(run: "neato -Tps -o graph.ps graph.dot")



Note that the two nodes are very near each other and are pinned. It
seems that if only one of the edges is listed, then it works fine, but
if both are listed, then the resulting PostScript contains a "curveto"
command with coordinates like 2147483638. The bounding box is also
completely wrong, with the result that a blank page is displayed when
it's viewed with "gv" - the whole graph is a tiny little point in the
corner, if it's even visible at all.



The problem seems to arise from the function "makeStraightEdge" in
"neatosplines.c". The "p" and "q" coordinates end up having the same
integer values, so the "l_perp" variable becomes zero, then in
assigning the values to "dumb[1]" and "dumb[2]" a divide-by-zero occurs.



I put in a quick-and-dirty fix, just after "perp.x" and "perp.y" are
assigned values:
<CD>
    if (!perp.x && !perp.y) {
        for (i = 0; i < 4; i++) {
            dumber[i] = p;
        }
        for (i = 0; i < e_cnt; i++) {
            clip_and_install(e0, e0, dumber, 4, &sinfo);
            addEdgeLabels(e0, p, q);
            e0 = ED_to_virt(e0);
        }
        return;
    }
</CD>



This seems to fix the problem, at least for PostScript output.



By the way, if my undergrad students wrote code with variables named
"dumb" and "dumber", they would get a slap on the wrist



Cheers, and thanks for a great set of programs,
dustin.






PS - my machine architecture is PowerPC (Apple PowerBook G4), though
presumably this bug should be portable to most architectures that can't
divide by zero.
Steps To Reproduce

graph G {
  N1 [ pos="-0.996558,-0.082895!" ];
  N2 [ pos="-0.996507,-0.0835055!" ];
  N1 -- N2
  N2 -- N1
}
TagsNo tags attached.
AUXILLARY-FILES
DATE-FIXED
FIX-COMMENT See message text.
FORMER-ID646
INPUT-FILE
OUTPUT-FILE
STATUS-COMMENTFixed (14 Mar 2005)
VERSION     2.3.20050307.0530 (Wed Mar 9 21:28:59 UTC 2005)
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-04-28 04:03 user1 New Issue
2011-04-28 04:03 user1 Assigned To => erg


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