Not sure if backward compatible with old libgraph.
edge_t *e;
for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
- fprintf(stderr, "%s\n", v->name);
+ fprintf(stderr, "%s\n", agnameof(v));
for (e = agfstout(g, v); e; e = agnxtout(g, e)) {
fprintf(stderr, " %s -- %s\n", agnameof(agtail(e)), agnameof(aghead(e)));
}
}
}
+#ifndef WITH_CGRAPH
void dumps(Agraph_t * g)
{
graph_t *subg;
fprintf(stderr, "====\n");
}
}
+#else
+void dumps(Agraph_t * g)
+{
+ graph_t *subg;
+
+ for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
+ dump(subg);
+ fprintf(stderr, "====\n");
+ }
+}
+#endif
#endif
int main(int argc, char *argv[])
Agnode_t *n;
char *p;
Agraph_t *g = bp->sub_graph;
- fprintf(stderr, "block=%s\n", g->name);
+ fprintf(stderr, "block=%s\n", agnameof(g));
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
Agedge_t *e;
if (PARENT(n))
- p = PARENT(n)->name;
+ p = agnameof(PARENT(n));
else
p = "<nil>";
- fprintf(stderr, " %s (%d %s)\n", n->name, VAL(n), p);
+ fprintf(stderr, " %s (%d %s)\n", agnameof(n), VAL(n), p);
for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) {
- fprintf(stderr, " %s--%s\n", e->tail->name,
- e->head->name);
+ fprintf(stderr, " %s--", agnameof(agtail(e)));
+ fprintf(stderr, "%s\n", agnameof(aghead(e)));
}
}
}
Agnode_t *n;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- if (TPARENT(n))
- fprintf(stderr, "%s -> %s\n", n->name, TPARENT(n)->name);
+ if (TPARENT(n)) {
+ fprintf(stderr, "%s ", agnameof(n));
+ fprintf(stderr, "-> %s\n", agnameof(TPARENT(n)));
+ }
}
}
#endif
indent(depth);
g = sn->sub_graph;
- fprintf(stderr, "%s:", g->name);
+ fprintf(stderr, "%s:", agnameof(g));
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- fprintf(stderr, " %s", n->name);
+ fprintf(stderr, " %s", agnameof(n));
}
fputs("\n", stderr);
Agnode_t *n;
Agedge_t *e;
- fprintf(stderr, "%s\n", g->name);
+ fprintf(stderr, "%s\n", agnameof(g));
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- fprintf(stderr, "%s (%x)\n", n->name, (unsigned int) n);
+ fprintf(stderr, "%s (%x)\n", agnameof(n), (unsigned int) n);
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- fprintf(stderr, "%s -- %s (%x)\n", n->name, e->head->name,
+ fprintf(stderr, "%s", agnameof(n));
+ fprintf(stderr, " -- %s (%x)\n", agnameof(aghead(e)),
(unsigned int) e);
}
}
int dist1, dist2;
if (PARENT(n))
- pname = PARENT(n)->name;
+ pname = agnameof(PARENT(n));
else
pname = "<P0>";
if (BLOCK(n))
- bname = BLOCK(n)->sub_graph->name;
+ bname = agnameof(BLOCK(n)->sub_graph);
else
pname = "<B0>";
- fprintf(stderr, "%s: %x %s %s ", n->name, FLAGS(n), pname, bname);
+ fprintf(stderr, "%s: %x %s %s ", agnameof(n), FLAGS(n), pname, bname);
switch (pass) {
case 0:
fprintf(stderr, "%d %d\n", VAL(n), LOWVAL(n));
break;
case 1:
if (TPARENT(n))
- tname = TPARENT(n)->name;
+ tname = agnameof(TPARENT(n));
else
tname = "<ROOT>";
dist1 = DISTONE(n);
if (dist1 > 0)
- name1 = LEAFONE(n)->name;
+ name1 = agnameof(LEAFONE(n));
else
name1 = "<null>";
dist2 = DISTTWO(n);
if (dist2 > 0)
- name2 = LEAFTWO(n)->name;
+ name2 = agnameof(LEAFTWO(n));
else
name2 = "<null>";
fprintf(stderr, "%s %s %d %s %d\n", tname, name1, dist1, name2,
if (np)
fprintf(stderr, " (%d)", ip->deg);
for (; np; np = ND_next(np)) {
- fprintf(stderr, " %s", np->name);
+ fprintf(stderr, " %s", agnameof(np));
}
fprintf(stderr, "\n");
}
for (temp = (edgelistitem *) dtflatten(list); temp;
temp = (edgelistitem *) dtlink(list, (Dtlink_t *) temp)) {
ep = temp->edge;
- fprintf(stderr, "%s--%s \n", ep->tail->name, ep->head->name);
+ fprintf(stderr, "%s--", agnameof(agtail(ep)));
+ fprintf(stderr, "%s \n", agnameof(aghead(ep)));
}
fputs("\n", stderr);
}
#ifdef OLD
nodelistitem_t *temp;
int i = 0;
- char *name = n->name;
+ char *name = agnameof(n);
for (temp = list->first; temp; temp = temp->next) {
- if (temp->curr->name == name) {
+ if (streq(agnameof(temp->curr),name)) {
return i;
}
i++;
temp = list->first;
while (temp != NULL) {
- fprintf(stderr, "%s ", temp->curr->name);
+ fprintf(stderr, "%s ", agnameof(temp->curr));
temp = temp->next;
}
fputs("\n", stderr);
if (Tree_node.list[i] == n)
break;
if (i >= Tree_node.size)
- fprintf(stderr, "\t%s\n", n->name);
+ fprintf(stderr, "\t%s\n", agnameof(n));
}
#endif
return 1;
edge_t *e;
node_t *n,*w;
FILE* fp = fopen ("ns.gv", "w");
- fprintf (fp, "digraph %s {\n", g->name);
+ fprintf (fp, "digraph %s {\n", agnameof(g));
for (n = GD_nlist(g); n; n = ND_next(n)) {
- if (streq(n->name,"virtual"))
+ if (streq(agnameof(n),"virtual"))
fprintf (fp, " \"%p\"\n", n);
else
- fprintf (fp, " \"%s\"\n", n->name);
+ fprintf (fp, " \"%s\"\n", agnameof(n));
}
for (n = GD_nlist(g); n; n = ND_next(n)) {
for (i = 0; (e = ND_out(n).list[i]); i++) {
- if (streq(n->name,"virtual"))
+ if (streq(agnameof(n),"virtual"))
fprintf (fp, " \"%p\"", n);
else
- fprintf (fp, " \"%s\"", n->name);
+ fprintf (fp, " \"%s\"", agnameof(n));
w = aghead(e);
- if (streq(w->name,"virtual"))
+ if (streq(agnameof(w),"virtual"))
fprintf (fp, " -> \"%p\"\n", w);
else
- fprintf (fp, " -> \"%s\"\n", w->name);
+ fprintf (fp, " -> \"%s\"\n", agnameof(w));
}
}
static int debugleveln(edge_t* realedge, int i)
{
- return (GD_showboxes(realedge->head->graph) == i ||
- GD_showboxes(realedge->tail->graph) == i ||
+ return (GD_showboxes(agraphof(aghead(realedge))) == i ||
+ GD_showboxes(agraphof(agtail(realedge))) == i ||
ED_showboxes(realedge) == i ||
- ND_showboxes(realedge->head) == i ||
- ND_showboxes(realedge->tail) == i);
+ ND_showboxes(aghead(realedge)) == i ||
+ ND_showboxes(agtail(realedge)) == i);
}
#endif /* DEBUG */
*npoints = spl.pn;
#ifdef DEBUG
- if (GD_showboxes(realedge->head->graph) == 2 ||
- GD_showboxes(realedge->tail->graph) == 2 ||
+ if (GD_showboxes(agraphof(aghead(realedge))) == 2 ||
+ GD_showboxes(agraphof(agtail(realedge))) == 2 ||
ED_showboxes(realedge) == 2 ||
- ND_showboxes(realedge->head) == 2 ||
- ND_showboxes(realedge->tail) == 2)
+ ND_showboxes(aghead(realedge)) == 2 ||
+ ND_showboxes(agtail(realedge)) == 2)
printboxes(boxn, boxes);
#endif
for (j = 0; j < rank[i].n; j++) {
u = rank[i].v[j];
rcnt++;
- if (streq(u->name,"virtual"))
+ if (streq(agnameof(u),"virtual"))
fprintf (stderr, " %x", u);
else
- fprintf (stderr, " %s", u->name);
+ fprintf (stderr, " %s", agnameof(u));
}
fprintf (stderr, "\n");
for (i = 0; (f = ND_out(agtail(e)).list[i]); i++) {
if (e == f) {
fprintf(stderr, "duplicate fast edge\n");
- return;
+ return 0;
}
assert(aghead(e) != aghead(f));
}
for (i = 0; (f = ND_in(aghead(e)).list[i]); i++) {
if (e == f) {
fprintf(stderr, "duplicate fast edge\n");
- return;
+ return 0;
}
assert(agtail(e) != agtail(f));
}
{
static char buf[20];
if (ND_node_type(n) == NORMAL)
- return n->name;
+ return agnameof(n);
sprintf(buf, "V%p", n);
return buf;
}
for (n = GD_nlist(g); n; n = ND_next(n)) {
fprintf(stderr, "%s %d: (", NAME(n), ND_rank(n));
- for (i = 0; e = ND_out(n).list[i]; i++) {
+ for (i = 0; (e = ND_out(n).list[i]); i++) {
fprintf(stderr, " %s:%d", NAME(aghead(e)), ED_count(e));
w = aghead(e);
if (g == g->root) {
- for (j = 0; f = ND_in(w).list[j]; j++)
+ for (j = 0; (f = ND_in(w).list[j]); j++)
if (e == f)
break;
assert(f != NULL);
}
}
fprintf(stderr, " ) (");
- for (i = 0; e = ND_in(n).list[i]; i++) {
+ for (i = 0; (e = ND_in(n).list[i]); i++) {
fprintf(stderr, " %s:%d", NAME(agtail(e)), ED_count(e));
w = agtail(e);
if (g == g->root) {
- for (j = 0; f = ND_out(w).list[j]; j++)
+ for (j = 0; (f = ND_out(w).list[j]); j++)
if (e == f)
break;
assert(f != NULL);
#define saveorder(v) (ND_coord(v)).x
#define flatindex(v) ND_low(v)
+static int gd_minrank(Agraph_t *g) {return GD_minrank(g);}
+static int gd_maxrank(Agraph_t *g) {return GD_maxrank(g);}
+static rank_t *gd_rank(Agraph_t *g, int r) {return &GD_rank(g)[r];}
+static int nd_order(Agnode_t *v) { return ND_order(v); }
+
/* forward declarations */
static boolean medians(graph_t * g, int r0, int r1);
static int nodeposcmpf(node_t ** n0, node_t ** n1);
node_t *rv;
rv = NULL;
+assert(v);
if (dir < 0) {
if (ND_order(v) > 0)
rv = GD_rank(Root)[ND_rank(v)].v[ND_order(v) - 1];
} else
rv = GD_rank(Root)[ND_rank(v)].v[ND_order(v) + 1];
+assert((rv == 0) || (ND_order(rv)-ND_order(v))*dir > 0);
return rv;
}
}
}
+static int constraining_flat_edge(Agraph_t *g, Agnode_t *v, Agedge_t *e)
+{
+ if (ED_weight(e) == 0) return FALSE;
+ if (!inside_cluster(g,agtail(e))) return FALSE;
+ if (!inside_cluster(g,aghead(e))) return FALSE;
+ return TRUE;
+}
+
+
/* construct nodes reachable from 'here' in post-order.
* This is the same as doing a topological sort in reverse order.
*/
MARK(v) = TRUE;
if (ND_flat_out(v).size > 0) {
for (i = 0; (e = ND_flat_out(v).list[i]); i++) {
- if (ED_weight(e) == 0)
- continue;
- if ((ND_node_type(aghead(e)) == NORMAL) &
- (NOT(agcontains(g, aghead(e)))))
- continue;
- if (ND_clust(aghead(e)) != ND_clust(agtail(e)))
- continue;
-
+ if (!constraining_flat_edge(g,v,e)) continue;
if (MARK(aghead(e)) == FALSE)
cnt += postorder(g, aghead(e), list + cnt, r);
}
static void flat_reorder(graph_t * g)
{
- int i, j, r, pos, n_search, local_in_cnt, local_out_cnt;
+ int i, j, r, pos, n_search, local_in_cnt, local_out_cnt, base_order;
node_t *v, **left, **right, *t;
node_t **temprank = NULL;
edge_t *flat_e, *e;
if (GD_has_flat_edges(g) == FALSE)
return;
for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
+ if (GD_rank(g)[r].n == 0) continue;
+ base_order = ND_order(GD_rank(g)[r].v[0]);
for (i = 0; i < GD_rank(g)[r].n; i++)
MARK(GD_rank(g)[r].v[i]) = FALSE;
temprank = ALLOC(i + 1, temprank, node_t *);
local_in_cnt = local_out_cnt = 0;
for (j = 0; j < ND_flat_in(v).size; j++) {
flat_e = ND_flat_in(v).list[j];
- if ((ED_weight(flat_e) > 0)
- && (inside_cluster(g, agtail(flat_e))))
- local_in_cnt++;
+ if (constraining_flat_edge(g,v,flat_e)) local_in_cnt++;
}
for (j = 0; j < ND_flat_out(v).size; j++) {
flat_e = ND_flat_out(v).list[j];
- if ((ED_weight(flat_e) > 0)
- && (inside_cluster(g, aghead(flat_e))))
- local_out_cnt++;
+ if (constraining_flat_edge(g,v,flat_e)) local_out_cnt++;
}
if ((local_in_cnt == 0) && (local_out_cnt == 0))
temprank[pos++] = v;
if (pos) {
for (i = 0; i < GD_rank(g)[r].n; i++) {
v = GD_rank(g)[r].v[i] = temprank[i];
- ND_order(v) = i + (GD_rank(g)[r].v - GD_rank(Root)[r].v);
+ ND_order(v) = i + base_order;
}
/* nonconstraint flat edges must be made LR */
v = GD_rank(g)[r].v[i];
if (ND_flat_out(v).list) {
for (j = 0; (e = ND_flat_out(v).list[j]); j++) {
- if (ND_order(aghead(e)) < ND_order(agtail(e))) {
- /*assert(ED_weight(e) == 0); */
+ if ( ((GD_flip(g) == FALSE) && (ND_order(aghead(e)) < ND_order(agtail(e)))) ||
+ ( GD_flip(g)) && (ND_order(aghead(e)) > ND_order(agtail(e)) )) {
+ assert(constraining_flat_edge(g,v,e) == FALSE);
delete_flat_edge(e);
j--;
flat_rev(g, e);
int i, r;
node_t *v, *prev;
- fprintf(stderr, "\n\n%s:\n", g->name);
+ fprintf(stderr, "\n\n%s:\n", agnameof(g));
for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
fprintf(stderr, "%d: ", r);
prev = NULL;
if (null_ok == FALSE)
abort();
} else {
- fprintf(stderr, "%s(%d)\t", v->name, ND_mval(v));
+ fprintf(stderr, "%s(%d)\t", agnameof(v), ND_mval(v));
assert(ND_rank(v) == r);
assert(v != prev);
prev = v;
r = ND_rank(v);
for (i = ND_order(v) + 1; i < ND_order(w); i++) {
- u = GD_rank(v->graph)[r].v[i];
+ u = GD_rank(agraphof(v))[r].v[i];
if (ND_clust(u))
abort();
}
el = ND_out(n);
for (i = 0; i < el.size; i++) {
e = el.list[i];
- fprintf (stderr, "%s(%x) -> %s(%x) : %d\n", agtail(e)->name,agtail(e), aghead(e)->name, aghead(e),
+ fprintf (stderr, "%s(%x) -> ", agnameof(agtail(e)),agtail(e));
+ fprintf (stderr, "%s(%x) : %d\n", agnameof(aghead(e)), aghead(e),
ED_minlen(e));
}
n = ND_next(n);
fputs(" ", stderr);
}
+void prEdge(edge_t *e,char *s)
+{
+ fprintf(stderr,"%s --", agnameof(agtail(e)));
+ fprintf(stderr,"%s%s", agnameof(aghead(e)),s);
+}
+
static void dumpBB(graph_t * g)
{
boxf bb;
for (i = 1; i <= GD_n_cluster(g); i++) {
subg = (GD_clust(g))[i];
prIndent();
- fprintf(stderr, " subgraph %s : %d nodes\n", subg->name,
+ fprintf(stderr, " subgraph %s : %d nodes\n", agnameof(subg),
agnnodes(subg));
dumpBB(subg);
incInd ();
int deg;
prIndent();
- fprintf(stderr, "Graph %s : %d nodes %d edges\n", g->name, agnnodes(g),
+ fprintf(stderr, "Graph %s : %d nodes %d edges\n", agnameof(g), agnnodes(g),
agnedges(g));
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
deg = 0;
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
deg++;
prIndent();
- fprintf(stderr, " %s -- %s\n", e->tail->name, e->head->name);
+ prEdge(e,"\n");
if (derived) {
for (i = 0, ep = (Agedge_t **) ED_to_virt(e);
i < ED_count(e); i++, ep++) {
el = *ep;
prIndent();
- fprintf(stderr, " %s -- %s\n", el->tail->name,
- el->head->name);
+ prEdge(el,"\n");
}
}
}
if (deg == 0) { /* no out edges */
if (!agfstin(g, n)) /* no in edges */
- fprintf(stderr, " %s\n", n->name);
+ fprintf(stderr, " %s\n", agnameof(n));
}
}
if (!derived) {
int sz = NPORTS(g);
fprintf(stderr, " %d ports\n", sz);
while (pp->e) {
- fprintf(stderr, " %s : %s -- %s\n", pp->n->name,
- pp->e->tail->name, pp->e->head->name);
+ fprintf(stderr, " %s : ", agnameof(pp->n));
+ prEdge(pp->e,"\n");
pp++;
}
}
if (Verbose < level)
return;
prIndent();
- fprintf(stderr, "Graph %s : %d nodes\n", g->name, agnnodes(g));
+ fprintf(stderr, "Graph %s : %d nodes\n", agnameof(g), agnnodes(g));
dumpBB(g);
if (Verbose > level) {
incInd();
bb.UR.x = bb.LL.x + w;
bb.UR.y = bb.LL.y + h;
fprintf(stderr, "%s: (%f,%f) ((%f,%f) , (%f,%f))\n",
- n->name, pos.x, pos.y, bb.LL.x, bb.LL.y, bb.UR.x,
+ agnameof(n), pos.x, pos.y, bb.LL.x, bb.LL.y, bb.UR.x,
bb.UR.y);
} else {
fprintf(stderr, "%s: (%f,%f) (%f,%f) \n",
- n->name, pos.x, pos.y, w, h);
+ agnameof(n), pos.x, pos.y, w, h);
}
}
}
Agnode_t *n;
Agnode_t *h;
Agedge_t *e;
- Agnodeinfo_t *data;
- Agnodeinfo_t *hdata;
double minx, miny, maxx, maxy;
double scale, width, height;
int do_arrow;
do_arrow = 0;
n = agfstnode(g);
- data = &(n->u);
- minx = data->pos[0];
- miny = data->pos[1];
- maxx = data->pos[0];
- maxy = data->pos[1];
+ minx = ND_pos(n)[0];
+ miny = ND_pos(n)[1];
+ maxx = ND_pos(n)[0];
+ maxy = ND_pos(n)[1];
n = agnxtnode(g, n);
for (; n; n = agnxtnode(g, n)) {
- data = &(n->u);
- if (data->pos[0] < minx)
- minx = data->pos[0];
- if (data->pos[1] < miny)
- miny = data->pos[1];
- if (data->pos[0] > maxx)
- maxx = data->pos[0];
- if (data->pos[1] > maxy)
- maxy = data->pos[1];
+ if (ND_pos(n)[0] < minx)
+ minx = ND_pos(n)[0];
+ if (ND_pos(n)[1] < miny)
+ miny = ND_pos(n)[1];
+ if (ND_pos(n)[0] > maxx)
+ maxx = ND_pos(n)[0];
+ if (ND_pos(n)[1] > maxy)
+ maxy = ND_pos(n)[1];
}
/* Convert to points
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (IS_PORT(n)) {
double r;
- data = &(n->u);
- r = sqrt(data->pos[0] * data->pos[0] +
- data->pos[1] * data->pos[1]);
+ r = sqrt(ND_pos(n)[0] * ND_pos(n)[0] +
+ ND_pos(n)[1] * ND_pos(n)[1]);
fprintf(fp, "0 0 %f inch drawCircle\n", r);
break;
}
}
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- data = &(n->u);
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- h = e->head;
- hdata = &(h->u);
+ h = aghead(e);
fprintf(fp, "%f inch %f inch moveto %f inch %f inch lineto\n",
- data->pos[0], data->pos[1], hdata->pos[0],
- hdata->pos[1]);
+ ND_pos(n)[0], ND_pos(n)[1], ND_pos(h)[0],
+ ND_pos(h)[1]);
fprintf(fp, "stroke\n");
if (do_arrow) {
theta =
- atan2(data->pos[1] - hdata->pos[1],
- data->pos[0] - hdata->pos[0]);
+ atan2(ND_pos(n)[1] - ND_pos(h)[1],
+ ND_pos(n)[0] - ND_pos(h)[0]);
fprintf(fp, "%f %f %.2f %.2f %.2f doArrow\n",
- hdata->pos[0], hdata->pos[1], DEGREES(theta),
+ ND_pos(h)[0], ND_pos(h)[1], DEGREES(theta),
arrow_l, arrow_w);
}
}
#else
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- data = &(n->u);
- fprintf(fp, "%% %s\n", n->name);
+ fprintf(fp, "%% %s\n", agnameof(n));
if (expMode) {
double wd, ht;
double r;
- wd = data->width;
- ht = data->height;
+ wd = ND_width(n);
+ ht = ND_height(n);
r = sqrt((wd * wd / 4) + ht * ht / 4);
fprintf(fp, "%f inch %f inch %f inch %f inch doBox\n", wd, ht,
- data->pos[0] - (wd / 2), data->pos[1] - (ht / 2));
+ ND_pos(n)[0] - (wd / 2), ND_pos(n)[1] - (ht / 2));
fprintf(fp, "%f inch %f inch %f inch drawCircle\n",
- data->pos[0], data->pos[1], r);
+ ND_pos(n)[0], ND_pos(n)[1], r);
} else {
if (IS_PORT(n)) {
if (!portColor) {
}
}
}
- fprintf(fp, "%f inch %f inch %f fillCircle\n", data->pos[0],
- data->pos[1], 3 / scale);
+ fprintf(fp, "%f inch %f inch %f fillCircle\n", ND_pos(n)[0],
+ ND_pos(n)[1], 3 / scale);
}
#endif
fprintf(fp, "0.667 1.000 1.000 sethsbcolor\n");
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- data = &(n->u);
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
- h = e->head;
- hdata = &(h->u);
+ h = aghead(e);
fprintf(fp, "%f inch %f inch moveto %f inch %f inch lineto\n",
- data->pos[0], data->pos[1], hdata->pos[0],
- hdata->pos[1]);
+ ND_pos(n)[0], ND_pos(n)[1], ND_pos(h)[0],
+ ND_pos(h)[1]);
fprintf(fp, "stroke\n");
if (do_arrow) {
theta =
- atan2(data->pos[1] - hdata->pos[1],
- data->pos[0] - hdata->pos[0]);
+ atan2(ND_pos(n)[1] - ND_pos(h)[1],
+ ND_pos(n)[0] - ND_pos(h)[0]);
fprintf(fp, "%f %f %.2f %.2f %.2f doArrow\n",
- hdata->pos[0], hdata->pos[1], DEGREES(theta),
+ ND_pos(h)[0], ND_pos(h)[1], DEGREES(theta),
arrow_l, arrow_w);
}
#include <fdp.h>
#include <stdio.h>
-#include <graph.h>
+#include <cgraph.h>
extern double Scale;
extern void outputGraph(Agraph_t *, FILE *, int);
#ifdef DEBUG
if (Verbose) {
prIndent();
- fprintf(stderr, "tlayout %s(%s) : T0 %f\n", g->name, GORIG(g->root)->name, T_T0);
+ fprintf(stderr, "tlayout %s", agnameof(g));
+ fprintf(stderr, "(%s) : T0 %f\n", agnameof(GORIG(g->root)), T_T0);
}
#endif
ret = 1;
prIndent();
fprintf(stderr,
"Params %s : K %f T0 %f Tfact %f maxIters %d unscaled %d\n",
- g->name,
+ agnameof(g),
T_K, T_T0, T_Tfact, T_maxIters, T_unscaled);
}
#endif
static double X_nonov;
static double X_ov;
+void pr2graphs(Agraph_t *g0, Agraph_t *g1)
+{
+ fprintf(stderr,"%s",agnameof(g0));
+ fprintf(stderr,"(%s)",agnameof(g1));
+}
+
static double RAD(Agnode_t * n)
{
double w = WD2(n);
#ifdef DEBUG
if (Verbose) {
prIndent();
- fprintf(stderr,
- "xLayout %s(%s) : n = %d K = %f T0 = %f loop %d C %f\n",
- g->name, GORIG(g->root)->name,
+ fprintf(stderr, "xLayout ");
+ pr2graphs(g,GORIG(agroot(g)));
+ fprintf(stderr, " : n = %d K = %f T0 = %f loop %d C %f\n",
xParams.numIters, xParams.K, xParams.T0, xParams.loopcnt,
xParams.C);
}
#ifdef DEBUG
if (Verbose) {
prIndent();
- fprintf(stderr, "try %d (%d): %d overlaps on %s(%s) \n", try, tries, ov,
- g->name, GORIG(g->root)->name);
+ fprintf(stderr, "try %d (%d): %d overlaps on ", try, tries, ov);
+ pr2graphs(g,GORIG(agroot(g)));
+ fprintf(stderr," \n");
}
#endif
}
#ifdef DEBUG
if (Verbose && ov)
- fprintf(stderr, "Warning: %d overlaps remain on %s(%s)\n", ov,
- g->name, GORIG(g->root)->name);
+ fprintf(stderr, "Warning: %d overlaps remain on ", ov);
+ pr2graphs(g,GORIG(agroot(g)));
+ fprintf(stderr,"\n");
#endif
return ov;
for (n = GD_nlist(g);n; n = ND_next(n)) {
assert(outdegree(g,n) == ND_out(n).size);
for (i = 0; (e = ND_out(n).list[i]); i++) {
- assert(e->tail == n);
- assert( e == agfindedge(g, n, e->head));
+ assert(agtail(e) == n);
+ assert( e == agfindedge(g, n, aghead(e)));
}
assert(indegree(g,n) == ND_in(n).size);
for (i = 0; (e = ND_in(n).list[i]); i++) {
- assert(e->head == n);
- assert( e == agfindedge(g, e->tail, n));
+ assert(aghead(e) == n);
+ assert( e == agfindedge(g, agtail(e), n));
}
cnt++;
}
edge_t *e;
for (n = agfstnode(cg); n; n = agnxtnode(cg, n)) {
sprintf(buf, "%d", ND_rank(n));
+#ifndef WITH_CGRAPH
agxset(n, rksym->index, buf);
+#else
+ agxset(n, rksym, buf);
+#endif
for (e = agfstedge(cg, n); e; e = agnxtedge(cg, e, n)) {
sprintf(buf, "%d", ED_minlen(e));
+#ifndef WITH_CGRAPH
agxset(e, mlsym->index, buf);
+#else
+ agxset(e, mlsym, buf);
+#endif
}
}
}