]> granicus.if.org Git - graphviz/commitdiff
eliminate some duplicate edges in "dot -P" output
authorellson <devnull@localhost>
Sun, 3 May 2009 02:49:25 +0000 (02:49 +0000)
committerellson <devnull@localhost>
Sun, 3 May 2009 02:49:25 +0000 (02:49 +0000)
lib/gvc/gvplugin.c

index 7271618c62eee985e8691317b27e16afc90e8b82..2f4d1ea82721fd2a819935e2691b8d72d65df7d0 100644 (file)
@@ -670,12 +670,19 @@ Agraph_t * gvplugin_graph(GVC_t * gvc)
                        if (p && *p) {
                            strcpy(bufb, "render_");
                            strcat(bufb, p);
+                           m = agfindnode(ssg, bufb);
+                           if (!m)
 #ifndef WITH_CGRAPH
-                           m = agnode(g, bufb);
-                           agedge(g, m, n);
+                               m = agnode(g, bufb);
 #else
-                           m = agnode(g, bufb, 1);
-                           agedge(g, m, n, NULL, 1);
+                               m = agnode(g, bufb, 1);
+#endif
+                           e = agfindedge(g, m, n);
+                           if (!e)
+#ifndef WITH_CGRAPH
+                               e = agedge(g, m, n);
+#else
+                               e = agedge(g, m, n, NULL, 1);
 #endif
                        }
                        break;
@@ -711,12 +718,19 @@ Agraph_t * gvplugin_graph(GVC_t * gvc)
 #endif
                        strcpy(bufb, "render_");
                        strcat(bufb, p);
+                       m = agfindnode(g, bufb);
+                       if (!m)
 #ifndef WITH_CGRAPH
-                       m = agnode(g, bufb); 
-                       agedge(g, n, m);
+                           m = agnode(g, bufb); 
 #else
-                       m = agnode(g, bufb, 1); 
-                       agedge(g, n, m, NULL, 1);
+                           m = agnode(g, bufb, 1); 
+#endif
+                       e = agfindedge(g, n, m);
+                       if (!e)
+#ifndef WITH_CGRAPH
+                           e = agedge(g, n, m);
+#else
+                           e = agedge(g, n, m, NULL, 1);
 #endif
                        break;
                    default: