]> granicus.if.org Git - graphviz/commitdiff
Fix mode=hier in neato to allow mixed undirected and directed edges
authorellson <devnull@localhost>
Tue, 18 Oct 2005 19:10:13 +0000 (19:10 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 19:10:13 +0000 (19:10 +0000)
using the constraint attribute

lib/neatogen/neatoinit.c

index 39a8530ceb2a810d6dca4275615f004559c07ac7..2bcaec63b87404c39e93a11760e9627bd8d07088 100644 (file)
@@ -745,6 +745,7 @@ static vtx_data *makeGraphData(graph_t * g, int nv, int *nedges, int mode, int m
     int haveLen;
     int haveWt;
     int haveDir;
+    int dfltConstr;
     PointMap *ps = newPM();
     int i, i_nedges, idx;
 
@@ -791,6 +792,11 @@ static vtx_data *makeGraphData(graph_t * g, int nv, int *nedges, int mode, int m
 #ifdef DIGCOLA
        if (haveDir) {
            graph[i].edists = edists++;
+               /* if g is directed, use edge direction by default
+                * if g is undirected, don't.
+                */
+           if (AG_IS_DIRECTED(g)) dfltConstr = 1;
+           else dfltConstr = 0;
        }
        else
            graph[i].edists = NULL;
@@ -822,7 +828,10 @@ static vtx_data *makeGraphData(graph_t * g, int nv, int *nedges, int mode, int m
                    *ewgts++ = 1.0;
 #ifdef DIGCOLA
                if (haveDir) {
-                   *edists++ = (np == ep->head ? 1.0 : -1.0);
+                   if (late_bool(ep,E_constr,dfltConstr))
+                       *edists++ = (np == ep->head ? 1.0 : -1.0);
+                   else
+                       *edists++ = 0.0;
                }
 #endif
                i_nedges++;