]> granicus.if.org Git - graphviz/commitdiff
Expose shrink variable of prism. By default, prism will attempt to shrink the
authorEmden R. Gansner <erg@alum.mit.edu>
Mon, 28 Oct 2013 15:31:47 +0000 (11:31 -0400)
committerEmden R. Gansner <erg@alum.mit.edu>
Mon, 28 Oct 2013 15:31:47 +0000 (11:31 -0400)
graph to make the layout smaller. By setting overlap_shrink=false, this is not done.

doc/info/attrs.html
doc/infosrc/attrs
lib/neatogen/adjust.c
lib/neatogen/overlap.c
lib/sfdpgen/sfdpinit.c
lib/sfdpgen/spring_electrical.c
lib/sfdpgen/spring_electrical.h

index 9d00f49a85374e7e63f9a9d6cc2d13aeb4cf0917..06844122f3959fe5f1a7e76208ddbf255e126035 100644 (file)
@@ -342,6 +342,9 @@ This field indicates which graph component uses the attribute.
 </TD><TD ALIGN="CENTER">true</TD><TD></TD><TD>not dot</TD> </TR>
  <TR><TD><A NAME=a:overlap_scaling HREF=#d:overlap_scaling>overlap_scaling</A>
 </TD><TD>G</TD><TD>double</TD><TD ALIGN="CENTER">-4</TD><TD>-1.0e10</TD><TD>prism only</TD> </TR>
+ <TR><TD><A NAME=a:overlap_shrink HREF=#d:overlap_shrink>overlap_shrink</A>
+</TD><TD>G</TD><TD><A HREF=#k:bool>bool</A>
+</TD><TD ALIGN="CENTER">true</TD><TD></TD><TD>prism only</TD> </TR>
  <TR><TD><A NAME=a:pack HREF=#d:pack>pack</A>
 </TD><TD>G</TD><TD><A HREF=#k:bool>bool</A>
 <BR>int</TD><TD ALIGN="CENTER">false</TD><TD></TD><TD>not dot</TD> </TR>
@@ -1398,6 +1401,10 @@ This field indicates which graph component uses the attribute.
   <TT>overlap_scaling</TT>.
   If <TT>overlap_scaling</TT> is zero, no scaling is done.
 
+<DT><A NAME=d:overlap_shrink HREF=#a:overlap_shrink><STRONG>overlap_shrink</STRONG></A>
+<DD>  If true, the overlap removal algorithm will perform a compression pass to reduce the
+  size of the layout.
+
 <DT><A NAME=d:pack HREF=#a:pack><STRONG>pack</STRONG></A>
 <DD>  This is true if the value of pack is "true" (case-insensitive) or a
   non-negative integer. If true, each connected component of the graph is
index 0850a4612d3a4306d8e667364e06c8ac0e91c1d6..2302fea725b5c6004d90fc0ddbf66668da73cbc2 100644 (file)
@@ -849,6 +849,9 @@ If <TT>overlap_scaling</TT> is negative, the layout is scaled by
 If <TT>overlap_scaling</TT> is positive, the layout is scaled by
 <TT>overlap_scaling</TT>.
 If <TT>overlap_scaling</TT> is zero, no scaling is done.
+:overlap_shrink:G:bool:true; prism
+If true, the overlap removal algorithm will perform a compression pass to reduce the
+size of the layout.
 :pack:G:bool/int:false; notdot
 This is true if the value of pack is "true" (case-insensitive) or a
 non-negative integer. If true, each connected component of the graph is
index e2d8894984d6b105a4e27e67c6eca48a050055c7..75e9a317127910225b80975ff13a90220ab2623f 100644 (file)
@@ -806,7 +806,7 @@ fdpAdjust (graph_t* g, adjust_data* am)
     }
 
     remove_overlap(Ndim, A, pos, sizes, am->value, am->scaling, 
-                  ELSCHEME_NONE, 0, NULL, NULL, TRUE, &flag);
+                  ELSCHEME_NONE, 0, NULL, NULL, mapBool (agget(g, "overlap_shrink"), TRUE), &flag);
 
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        real *npos = pos + (Ndim * ND_id(n));
index a33a0da01b3ef0b506f4fb3356d010eb301faf8b..dad5dec1f6417682c6ab1838ca9b725297035516 100644 (file)
@@ -654,7 +654,7 @@ void remove_overlap(int dim, SparseMatrix A, real *x, real *label_sizes, int ntr
   if (has_penalty_terms){
     /* now do without penalty */
     remove_overlap(dim, A, x, label_sizes, ntry, 0.,
-                  ELSCHEME_NONE, 0, NULL, NULL, TRUE, flag);
+                  ELSCHEME_NONE, 0, NULL, NULL, do_shrinking, flag);
   }
 
 #ifdef DEBUG
@@ -687,6 +687,11 @@ void remove_overlap(int dim, SparseMatrix A, real *x, real *label_sizes, int ntr
 #include "SparseMatrix.h"
 void remove_overlap(int dim, SparseMatrix A, int m, real *x, real *label_sizes, int ntry, real initial_scaling, int do_shrinking, int *flag)
 {
-    agerr(AGERR, "remove_overlap: Graphviz not built with triangulation library\n");
+    static int once;
+
+    if (once == 0) {
+       once = 1;
+       agerr(AGERR, "remove_overlap: Graphviz not built with triangulation library\n");
+    }
 }
 #endif
index 370a934ba48808d5e70a123e815af7a6a84f3de3..834ad50cfa5814be739926ed5e6631c1a08c20cd 100644 (file)
@@ -313,6 +313,7 @@ tuneControl (graph_t* g, spring_electrical_control ctrl)
     /* ctrl->method = late_mode(g, agfindgraphattr(g, "mode"), METHOD_SPRING_ELECTRICAL); */
     ctrl->method = METHOD_SPRING_ELECTRICAL;
     ctrl->beautify_leaves = mapBool (agget(g, "beautify"), FALSE);
+    ctrl->do_shrinking = mapBool (agget(g, "overlap_shrink"), TRUE);
     ctrl->rotation = late_double(g, agfindgraphattr(g, "rotation"), 0.0, -MAXDOUBLE);
     ctrl->edge_labeling_scheme = late_int(g, agfindgraphattr(g, "label_scheme"), 0, 0);
     if (ctrl->edge_labeling_scheme > 4) {
index 2c8ebd96ca7faa3f4605cd9a3d4f340a285cb866..0360a64659aaf474cfe780bc19de264fef5308e0 100644 (file)
@@ -63,6 +63,7 @@ spring_electrical_control spring_electrical_control_new(){
   ctrl->use_node_weights = FALSE;
   ctrl->smoothing = SMOOTHING_NONE;
   ctrl->overlap = 0;
+  ctrl->do_shrinking = 1;
   ctrl->tscheme = QUAD_TREE_HYBRID;
   ctrl->method = METHOD_SPRING_ELECTRICAL;
   ctrl->initial_scaling = -4;
@@ -2041,7 +2042,7 @@ static void multilevel_spring_electrical_embedding_core(int dim, SparseMatrix A0
     assert(!(*flag));
     attach_edge_label_coordinates(dim, A, n_edge_label_nodes, edge_label_nodes, x, x2);
     remove_overlap(dim, A, x, label_sizes, ctrl->overlap, ctrl->initial_scaling,
-                  ctrl->edge_labeling_scheme, n_edge_label_nodes, edge_label_nodes, A, TRUE, flag);
+                  ctrl->edge_labeling_scheme, n_edge_label_nodes, edge_label_nodes, A, ctrl->do_shrinking, flag);
     SparseMatrix_delete(A2);
     FREE(x2);
     if (A != A0) SparseMatrix_delete(A);
@@ -2159,7 +2160,7 @@ static void multilevel_spring_electrical_embedding_core(int dim, SparseMatrix A0
   if (Verbose) fprintf(stderr, "ctrl->overlap=%d\n",ctrl->overlap);
 
   remove_overlap(dim, A, x, label_sizes, ctrl->overlap, ctrl->initial_scaling,
-                ctrl->edge_labeling_scheme, n_edge_label_nodes, edge_label_nodes, A, TRUE, flag);
+                ctrl->edge_labeling_scheme, n_edge_label_nodes, edge_label_nodes, A, ctrl->do_shrinking, flag);
 
  RETURN:
   *ctrl = ctrl0;
index b9d01a95d762668f05a94a8ecf55c265bfb39382..861c77ae1007056a4461b438f5646f54fe1e53ca 100644 (file)
@@ -51,6 +51,7 @@ struct spring_electrical_control_struct {
   int use_node_weights;
   int smoothing;
   int overlap;
+  int do_shrinking;
   int tscheme; /* octree scheme. 0 (no octree), 1 (normal), 2 (fast) */
   int method;/* spring_electical, spring_maxent */
   real initial_scaling;/* how to scale the layout of the graph before passing to overlap removal algorithm.