]> granicus.if.org Git - graphviz/commitdiff
efficiency improvement for agsubrep on mainnnode
authornorth <devnull@localhost>
Tue, 16 Feb 2010 00:35:03 +0000 (00:35 +0000)
committernorth <devnull@localhost>
Tue, 16 Feb 2010 00:35:03 +0000 (00:35 +0000)
lib/cgraph/edge.c

index 415c5da95c297612c1b647edb578340434431ab3..5b4a0ef0dc36c267974c135713bbe51d6440077d 100644 (file)
@@ -161,8 +161,11 @@ Agsubnode_t *agsubrep(Agraph_t * g, Agnode_t * n)
 {
     Agsubnode_t *sn, template;
 
-    template.node = n;
-    sn = dtsearch(g->n_id, &template);
+       if (g == n->root) sn = &(n->mainsub);
+       else {
+                       template.node = n;
+                       sn = dtsearch(g->n_id, &template);
+       }
     return sn;
 }