]> granicus.if.org Git - graphviz/commitdiff
Fix bug 2225; change documentation to note that edge weights in
authorEmden Gansner <erg@research.att.com>
Thu, 3 May 2012 01:47:22 +0000 (21:47 -0400)
committerEmden Gansner <erg@research.att.com>
Thu, 3 May 2012 01:47:22 +0000 (21:47 -0400)
dot must be integers; change other uses of AGID to AGSEQ.

15 files changed:
cmd/tools/gv2gml.c
cmd/tools/gv2gxl.c
doc/info/attrs.html
doc/infosrc/attrs
lib/common/types.h
lib/dotgen/dotinit.c
lib/dotgen/dotsplines.c
lib/dotgen/fastgr.c
lib/dotgen/mincross.c
lib/fdpgen/layout.c
lib/neatogen/circuit.c
lib/neatogen/neatoinit.c
lib/ortho/ortho.c
plugin/core/gvrender_core_tk.c
plugin/gd/gvrender_gd_vrml.c

index feb75c06fb5fc1abe59b03f8822b330153b6b40a..d08e2d4c70acb3abf0bad04b78a3254e224a0bcf 100644 (file)
@@ -613,7 +613,7 @@ emitEdgeAttrs (Agraph_t* G, Agedge_t* ep, FILE* outFile, int ix)
 static void 
 emitEdge (Agraph_t* G, Agedge_t* e, FILE* outFile)
 {
-    fprintf (outFile, "  edge [\n    id %lu\n", AGID(e));
+    fprintf (outFile, "  edge [\n    id %lu\n", AGSEQ(e));
     fprintf (outFile, "    source %lu\n", ID(agtail(e)));
     fprintf (outFile, "    target %lu\n", ID(aghead(e)));
     emitEdgeAttrs (G, e, outFile, 2);
index 53cd04ee3f404e82cc36c02687a050009304505e..23714ce3e6c3618d810caa024ff96d9b8f68dc3e 100644 (file)
@@ -720,7 +720,7 @@ static void writeBody(gxlstate_t * stp, Agraph_t * g, FILE * gxlFile)
     writeSubgs(stp, g, gxlFile);
     dd = (Agdatadict_t *) agdatadict(g, FALSE);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-       realn = agidnode(stp->root, AGID(n), 0);
+       realn = agidnode(stp->root, AGSEQ(n), 0);
        if (!writeval(realn)) {
            writeval(realn) = 1;
            writeNode(stp, n, gxlFile, dd->dict.n);
index 3b88e6f072b87b89647256b8b6f8f45a9caa6d84..499f18c14443b78691873afca31226458ccfc894 100644 (file)
@@ -489,7 +489,7 @@ This field indicates which graph component uses the attribute.
  <TR><TD><A NAME=a:voro_margin HREF=#d:voro_margin>voro_margin</A>
 </TD><TD>G</TD><TD>double</TD><TD ALIGN="CENTER">0.05</TD><TD>0.0</TD><TD>not dot</TD> </TR>
  <TR><TD><A NAME=a:weight HREF=#d:weight>weight</A>
-</TD><TD>E</TD><TD>double</TD><TD ALIGN="CENTER">1.0</TD><TD>0(dot)<BR>1(neato,fdp)</TD><TD></TD> </TR>
+</TD><TD>E</TD><TD>int<BR>double</TD><TD ALIGN="CENTER">1</TD><TD>0(dot)<BR>1(neato,fdp)</TD><TD></TD> </TR>
  <TR><TD><A NAME=a:width HREF=#d:width>width</A>
 </TD><TD>N</TD><TD>double</TD><TD ALIGN="CENTER">0.75</TD><TD>0.01</TD><TD></TD> </TR>
  <TR><TD><A NAME=a:xlabel HREF=#d:xlabel>xlabel</A>
@@ -1863,6 +1863,9 @@ This field indicates which graph component uses the attribute.
 <DT><A NAME=d:weight HREF=#a:weight><STRONG>weight</STRONG></A>
 <DD>  Weight of edge. In dot, the heavier the weight, the shorter,
   straighter and more vertical the edge is.
+  For other layouts, a larger weight encourages the layout to 
+  make the edge length closer to that specified by the 
+  <A HREF=#d:len>len</A> attribute.
 
 <DT><A NAME=d:width HREF=#a:width><STRONG>width</STRONG></A>
 <DD>  Width of node, in inches. This is taken as the initial, minimum width
index 6ac5182ffc8e3075405a865423edbb7649c4b692..8eca88ebf3cdedaf6aab1295d32bec56b60e8a73 100644 (file)
@@ -1255,9 +1255,13 @@ Voronoi technique. dim' = (1+2*margin)*dim.
 #  Obsolete, replaced by sep
 #w:E:double:1.0; neato
 #  Redundant definition of weight in neato, cf. bug 9.
-:weight:E:double:1.0:0(dot)/1(neato,fdp);
+:weight:E:int/double:1:0(dot)/1(neato,fdp);
 Weight of edge. In dot, the heavier the weight, the shorter,
 straighter and more vertical the edge is.
+<B>N.B.</B> Weights in dot must be integers.
+For other layouts, a larger weight encourages the layout to 
+make the edge length closer to that specified by the 
+<A HREF=#d:len>len</A> attribute.
 :width:N:double:0.75:0.01;
 Width of node, in inches. This is taken as the initial, minimum width
 of the node. If <A HREF=#d:fixedsize><B>fixedsize</B></A> is true, this
index 85ed3ea06ab58785a8cf1f11ae130e43af918b46..2ba0583d755ef5182fcc1419e0fbca88539aa74d 100644 (file)
@@ -657,7 +657,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
        unsigned char showboxes;
        boolean conc_opp_flag;
        short xpenalty;
-       float weight;
+       int weight;
        int cutvalue, tree_index;
        short count;
        unsigned short minlen;
index c960c79e99f9670ddb3ce7c129a744965b7b5c03..423ba2fcfec85f8afcb25727bad3ae8b42062265 100644 (file)
@@ -56,7 +56,7 @@ dot_init_edge(edge_t * e)
 #endif /* WITH_CGRAPH */
     common_init_edge(e);
 
-    ED_weight(e) = late_double(e, E_weight, 1.0, 0.0);
+    ED_weight(e) = late_int(e, E_weight, 1, 0);
     tailgroup = late_string(agtail(e), N_group, "");
     headgroup = late_string(aghead(e), N_group, "");
     ED_count(e) = ED_xpenalty(e) = 1;
index 0e69e8e5a051af7be3a5d37a77669e833c33ae01..1c89ce0cfabeafb99eafbe040af1e76493bce390 100644 (file)
@@ -635,8 +635,8 @@ static int edgecmp(edge_t** ptr0, edge_t** ptr1)
        return (v0 - v1);
 
     /* This provides a cheap test for edges having the same set of endpoints.  */
-    if (AGID(le0) != AGID(le1))
-       return (AGID(le0) - AGID(le1));
+    if (AGSEQ(le0) != AGSEQ(le1))
+       return (AGSEQ(le0) - AGSEQ(le1));
 
     ea = (ED_tail_port(e0).defined || ED_head_port(e0).defined) ? e0 : le0;
     if (ED_tree_index(ea) & BWDEDGE) {
@@ -671,7 +671,7 @@ static int edgecmp(edge_t** ptr0, edge_t** ptr1)
     if (et0 == FLATEDGE && ED_label(e0) != ED_label(e1))
        return (int) (ED_label(e0) - ED_label(e1));
 
-    return (AGID(e0) - AGID(e1));
+    return (AGSEQ(e0) - AGSEQ(e1));
 }
 
 /* cloneGraph:
index 1bbe7811cdbc12f40f61f7f97fea36fc465b1e4d..23e7fbecbc2ff6f9063a4b07398982c80fa6cfd3 100644 (file)
@@ -177,9 +177,9 @@ edge_t *new_virtual_edge(node_t * u, node_t * v, edge_t * orig)
     ED_edge_type(e) = VIRTUAL;
 
     if (orig) {
-       AGID(e) = AGID(orig);
+       AGSEQ(e) = AGSEQ(orig);
 #ifdef WITH_CGRAPH
-       AGID(&(e2->in)) = AGID(orig);
+       AGSEQ(&(e2->in)) = AGSEQ(orig);
 #endif
        ED_count(e) = ED_count(orig);
        ED_xpenalty(e) = ED_xpenalty(orig);
index 06a16951984f32b278d966d13f10552f7ae8e54c..a3eb7e32f88ecfe64f8c3f2efcda57f5aff94c52 100644 (file)
@@ -1612,7 +1612,7 @@ static int nodeposcmpf(node_t ** n0, node_t ** n1)
 
 static int edgeidcmpf(edge_t ** e0, edge_t ** e1)
 {
-    return (AGID(*e0) - AGID(*e1));
+    return (AGSEQ(*e0) - AGSEQ(*e1));
 }
 
 /* following code deals with weights of edges of "virtual" nodes */
index 84c10d1498f9aa50f2d58b6811dc39b90bd2c983..b9da8e5cc35c69bf6785ce90c8344fad099124b1 100644 (file)
@@ -346,10 +346,10 @@ static char *portName(graph_t * g, bport_t * p)
     len += strlen(agnameof(g)) + strlen(agnameof(h)) + strlen(agnameof(t));
     if (len >= BSZ)
        sprintf(buf, "_port_%s_%s_%s_%ld", agnameof(g), agnameof(t), agnameof(h),
-               (unsigned long)AGID(e));
+               (unsigned long)AGSEQ(e));
     else
        sprintf(buf, "_port_%s_(%d)_(%d)_%ld",agnameof(g), ND_id(t), ND_id(h),
-               (unsigned long)AGID(e));
+               (unsigned long)AGSEQ(e));
     return buf;
 }
 
index 0133035b04e375c9e299b648238d23b9842d8f0c..d04fa058125a1ebbae09baf562c104511091bd4f 100644 (file)
@@ -53,8 +53,8 @@ int circuit_model(graph_t * g, int nG)
     /* set non-diagonal entries */
     for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
        for (e = agfstedge(g, v); e; e = agnxtedge(g, e, v)) {
-           i = AGID(agtail(e));
-           j = AGID(aghead(e));
+           i = AGSEQ(agtail(e));
+           j = AGSEQ(aghead(e));
            if (i == j)
                continue;
            /* conductance is 1/resistance */
index c245fecb15b7d0b67a53c1ad66898880e368ecc9..ea30167d2a8ccb6f38e179d52d24340fbeea8bc7 100644 (file)
@@ -263,7 +263,7 @@ static cluster_data* cluster_map(graph_t *mastergraph, graph_t *g)
                 node_t *gn;
                 int ind = 0;
                 for (gn = agfstnode(g); gn; gn = agnxtnode(g, gn)) {
-                    if(AGID(gn)==AGID(n)) break;
+                    if(AGSEQ(gn)==AGSEQ(n)) break;
                     ind++;
                 }
                 /* fprintf(stderr,"  node=%s, id=%d, ind=%d\n",agnameof(n),n->id,ind); */
@@ -1474,8 +1474,8 @@ static void mds_model(graph_t * g, int nG)
 
     for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
        for (e = agfstout(g, v); e; e = agnxtout(g, e)) {
-           i = AGID(agtail(e));
-           j = AGID(aghead(e));
+           i = AGSEQ(agtail(e));
+           j = AGSEQ(aghead(e));
            if (i == j)
                continue;
            GD_dist(g)[i][j] = GD_dist(g)[j][i] = ED_dist(e);
index e0ddbe2c1864c6ef8a44055b12ce4da308e0e622..bebde6e3aac0c8afd3f309bdf98c3fcadc96285d 100644 (file)
@@ -1300,8 +1300,8 @@ orthoEdges (Agraph_t* g, int doLbls)
         for (e = agfstout(g, n); e; e = agnxtout(g,e)) {
            if ((Nop == 2) && ED_spl(e)) continue;
            if (Concentrate) {
-               int ti = AGID(agtail(e));
-               int hi = AGID(aghead(e));
+               int ti = AGSEQ(agtail(e));
+               int hi = AGSEQ(aghead(e));
                if (ti <= hi) {
                    if (isInPS (ps,ti,hi)) continue;
                    else addPS (ps,ti,hi);
index 492124eb89e408736fe79b3665225c39562922ed..686c1949349c28ae0e583c663dc3846c4b4fcd6e 100644 (file)
@@ -67,7 +67,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjType = "node";
        ObjPart = "shape";
        ObjFlag = 1;
-        ObjId = AGID(obj->u.n);
+        ObjId = AGSEQ(obj->u.n);
 #ifndef WITH_CGRAPH
        ObjHandle = obj->u.n->handle;
 #endif
@@ -76,7 +76,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjType = "node";
        ObjPart = "label";
        ObjFlag = 0;
-        ObjId = AGID(obj->u.n);
+        ObjId = AGSEQ(obj->u.n);
 #ifndef WITH_CGRAPH
        ObjHandle = obj->u.n->handle;
 #endif
@@ -87,7 +87,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjType = "edge";
        ObjPart = "shape";
        ObjFlag = 1;
-        ObjId = AGID(obj->u.e);
+        ObjId = AGSEQ(obj->u.e);
 #ifndef WITH_CGRAPH
        ObjHandle = obj->u.e->handle;
 #endif
@@ -98,7 +98,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjType = "edge";
        ObjPart = "label";
        ObjFlag = 0;
-        ObjId = AGID(obj->u.e);
+        ObjId = AGSEQ(obj->u.e);
 #ifndef WITH_CGRAPH
        ObjHandle = obj->u.e->handle;
 #endif
@@ -130,7 +130,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjId = obj->u.sg->meta_node->id;
        ObjHandle = obj->u.sg->handle;
 #else
-       ObjId = AGID(obj->u.sg);
+       ObjId = AGSEQ(obj->u.sg);
 #endif
        break;
     case EMIT_CLABEL:
@@ -141,7 +141,7 @@ static void tkgen_print_tags(GVJ_t *job)
        ObjId = obj->u.sg->meta_node->id;
        ObjHandle = obj->u.sg->handle;
 #else
-       ObjId = AGID(obj->u.sg);
+       ObjId = AGSEQ(obj->u.sg);
 #endif
        break;
     default:
index 31c731355abac9fe47bebc4566c15fcd45fcb89b..a44c5731155c14c1a38e2f7bf2e6e7b35edca906 100644 (file)
@@ -111,9 +111,9 @@ static char *nodefilename(const char *filename, node_t * n, char *buf)
            dir = ".";
     }
 #ifndef WITH_CGRAPH
-    sprintf(buf, "%s/node%d.png", dir, AGID(n));
+    sprintf(buf, "%s/node%d.png", dir, AGSEQ(n));
 #else
-    sprintf(buf, "%s/node%ld.png", dir, AGID(n));
+    sprintf(buf, "%s/node%ld.png", dir, AGSEQ(n));
 #endif
     return buf;
 }
@@ -510,7 +510,7 @@ vrml_bezier(GVJ_t *job, pointf * A, int n, int arrow_at_start, int arrow_at_end,
            (obj->penwidth), -(obj->penwidth), -(obj->penwidth),
            (obj->penwidth), -(obj->penwidth));
     gvputs(job,   "}\n");
-    gvprintf(job, " appearance DEF E%ld Appearance {\n", AGID(e));
+    gvprintf(job, " appearance DEF E%ld Appearance {\n", AGSEQ(e));
     gvputs(job,   "   material Material {\n");
     gvputs(job,   "   ambientIntensity 0.33\n");
     gvprintf(job, "   diffuseColor %.3f %.3f %.3f\n",
@@ -611,7 +611,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
        gvputs(job,   "      ambientIntensity 0.33\n");
        gvputs(job,   "        diffuseColor 1 1 1\n");
        gvputs(job,   "    }\n");
-       gvprintf(job, "    texture ImageTexture { url \"node%ld.png\" }\n", AGID(n));
+       gvprintf(job, "    texture ImageTexture { url \"node%ld.png\" }\n", AGSEQ(n));
        gvputs(job,   "  }\n");
        gvputs(job,   "  geometry Extrusion {\n");
        gvputs(job,   "    crossSection [");
@@ -668,7 +668,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
        gvputs(job,   "        Shape {\n");
        gvprintf(job, "          geometry Cone {bottomRadius %.3f height %.3f }\n",
                obj->penwidth * 2.5, obj->penwidth * 10.0);
-       gvprintf(job, "          appearance USE E%ld\n", AGID(e));
+       gvprintf(job, "          appearance USE E%ld\n", AGSEQ(e));
        gvputs(job,   "        }\n");
        gvputs(job,   "      ]\n");
        gvputs(job,   "    }\n");
@@ -771,7 +771,7 @@ static void vrml_ellipse(GVJ_t * job, pointf * A, int filled)
        gvputs(job,   "              ambientIntensity 0.33\n");
        gvputs(job,   "              diffuseColor 1 1 1\n");
        gvputs(job,   "            }\n");
-       gvprintf(job, "            texture ImageTexture { url \"node%ld.png\" }\n", AGID(n));
+       gvprintf(job, "            texture ImageTexture { url \"node%ld.png\" }\n", AGSEQ(n));
        gvputs(job,   "          }\n");
        gvputs(job,   "        }\n");
        gvputs(job,   "      ]\n");
@@ -788,7 +788,7 @@ static void vrml_ellipse(GVJ_t * job, pointf * A, int filled)
        gvputs(job,   "  children [\n");
        gvputs(job,   "    Shape {\n");
        gvprintf(job, "      geometry Sphere {radius %.3f }\n", (double) rx);
-       gvprintf(job, "      appearance USE E%d\n", AGID(e));
+       gvprintf(job, "      appearance USE E%d\n", AGSEQ(e));
        gvputs(job,   "    }\n");
        gvputs(job,   "  ]\n");
        gvputs(job,   "}\n");