From: ellson Date: Tue, 18 Oct 2005 19:10:13 +0000 (+0000) Subject: Fix mode=hier in neato to allow mixed undirected and directed edges X-Git-Tag: LAST_LIBGRAPH~32^2~7144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b91959d585f85bf498155682b5595b404168fa1;p=graphviz Fix mode=hier in neato to allow mixed undirected and directed edges using the constraint attribute --- diff --git a/lib/neatogen/neatoinit.c b/lib/neatogen/neatoinit.c index 39a8530ce..2bcaec63b 100644 --- a/lib/neatogen/neatoinit.c +++ b/lib/neatogen/neatoinit.c @@ -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++;