]> granicus.if.org Git - graphviz/commitdiff
Change neato so that the layout of a connected graph is done on the
authorerg <devnull@localhost>
Tue, 16 Feb 2010 22:35:23 +0000 (22:35 +0000)
committererg <devnull@localhost>
Tue, 16 Feb 2010 22:35:23 +0000 (22:35 +0000)
graph itself, not an induced subgraph. I can't recall why I made this
change, but I remember it was necessary to fix a problem. At the worst,
it will make this case faster without changing the overall semantics.

lib/neatogen/neatoinit.c

index ca0a3dd1f6a5aa30f0aec911e20c09ed3770c47e..599d4a489c434a104f245c4563a90d5aaf36c367 100644 (file)
@@ -1521,16 +1521,16 @@ void neato_layout(Agraph_t * g)
 
            cc = pccomps(g, &n_cc, cc_pfx, &pin);
 
-           for (i = 0; i < n_cc; i++) {
-               gc = cc[i];
-               nodeInduce(gc);
-               neatoLayout(g, gc, layoutMode, model, &am);
-               removeOverlapWith(gc, &am);
-               setEdgeType (gc, ET_LINE);
-               spline_edges(gc);
-           }
            if (n_cc > 1) {
                boolean *bp;
+               for (i = 0; i < n_cc; i++) {
+                   gc = cc[i];
+                   nodeInduce(gc);
+                   neatoLayout(g, gc, layoutMode, model, &am);
+                   removeOverlapWith(gc, &am);
+                   setEdgeType (gc, ET_LINE);
+                   spline_edges(gc);
+               }
                if (pin) {
                    bp = N_NEW(n_cc, boolean);
                    bp[0] = TRUE;
@@ -1543,6 +1543,11 @@ void neato_layout(Agraph_t * g)
                if (bp)
                    free(bp);
            }
+           else {
+               neatoLayout(g, g, layoutMode, model, &am);
+               removeOverlapWith(g, &am);
+               spline_edges(g);
+           }
            compute_bb(g);
            addZ (g);