char *s;
switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
case AGGRAPH:
+#else
+ case AGRAPH:
+#endif
sg = (graph_t*)obj;
g = sg->root;
break;
case AGNODE:
n = (node_t*)obj;
+#ifndef WITH_CGRAPH
g = n->graph->root;
+#else
+ g = agroot(agraphof(n));
+#endif
break;
case AGEDGE:
e = (edge_t*)obj;
+#ifndef WITH_CGRAPH
g = e->head->graph->root;
+#else
+ g = agroot(agraphof(aghead(e)));
+#endif
break;
}
rv->fontname = fontname;
rv->html = TRUE;
if (make_html_label(obj, rv)) {
switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
case AGGRAPH:
agerr(AGPREV, "in label of graph %s\n",sg->name);
+#else
+ case AGRAPH:
+ agerr(AGPREV, "in label of graph %s\n",agnameof(sg));
+#endif
break;
case AGNODE:
+#ifndef WITH_CGRAPH
agerr(AGPREV, "in label of node %s\n", n->name);
+#else
+ agerr(AGPREV, "in label of node %s\n", agnameof(n));
+#endif
break;
case AGEDGE:
-#ifdef WITH_CGRAPH
+#ifndef WITH_CGRAPH
agerr(AGPREV, "in label of edge %s %s %s\n",
e->tail->name, agisdirected(g)?"->":"--", e->head->name);
#else
agerr(AGPREV, "in label of edge %s %s %s\n",
- e->tail->name, AG_IS_DIRECTED(g)?"->":"--", e->head->name);
+ agnameof(agtail(e)), AG_IS_DIRECTED(g)?"->":"--", agnameof(aghead(e)));
#endif
break;
}
/* prepare substitution strings */
switch (agobjkind(obj)) {
+#ifndef WITH_CGRAPH
case AGGRAPH:
g_str = ((graph_t *)obj)->name;
+#else
+ case AGRAPH:
+ g_str = agnameof((graph_t *)obj);
+#endif
g_len = strlen(g_str);
tl = GD_label((graph_t *)obj);
if (tl) {
}
break;
case AGNODE:
+#ifndef WITH_CGRAPH
g_str = ((node_t *)obj)->graph->name;
g_len = strlen(g_str);
n_str = ((node_t *)obj)->name;
+#else
+ g_str = agnameof(agraphof((node_t *)obj));
+ g_len = strlen(g_str);
+ n_str = agnameof((node_t *)obj);
+#endif
n_len = strlen(n_str);
tl = ND_label((node_t *)obj);
if (tl) {
}
break;
case AGEDGE:
+#ifndef WITH_CGRAPH
g_str = ((edge_t *)obj)->tail->graph->root->name;
g_len = strlen(g_str);
t_str = ((edge_t *)obj)->tail->name;
if ((tp_str = pt.name))
tp_len = strlen(tp_str);
h_str = ((edge_t *)obj)->head->name;
+#else
+ g_str = agnameof(agroot(agraphof(agtail(((edge_t *)obj)))));
+ g_len = strlen(g_str);
+ t_str = agnameof(agtail(((edge_t *)obj)));
+ t_len = strlen(t_str);
+ pt = ED_tail_port((edge_t *)obj);
+ if ((tp_str = pt.name))
+ tp_len = strlen(tp_str);
+ h_str = agnameof(aghead(((edge_t *)obj)));
+#endif
h_len = strlen(h_str);
pt = ED_head_port((edge_t *)obj);
if ((hp_str = pt.name))
l_str = tl->text;
if (str) l_len = strlen(l_str);
}
+#ifndef WITH_CGRAPH
if (((edge_t *)obj)->tail->graph->root->kind & AGFLAG_DIRECTED)
+#else
+ if (agisdirected(agroot(agraphof(agtail(((edge_t*)obj))))))
+#endif
e_str = "->";
else
e_str = "--";
static void check_cycles(graph_t * g);
#endif
+#ifndef WITH_CGRAPH
#define LENGTH(e) (ND_rank(e->head) - ND_rank(e->tail))
+#else /* WITH_CGRAPH */
+#define LENGTH(e) (ND_rank(aghead(e)) - ND_rank(agtail(e)))
+#endif /* WITH_CGRAPH */
#define SLACK(e) (LENGTH(e) - ED_minlen(e))
#define SEQ(a,b,c) (((a) <= (b)) && ((b) <= (c)))
#define TREE_EDGE(e) (ED_tree_index(e) >= 0)
abort();
ED_tree_index(e) = Tree_edge.size;
Tree_edge.list[Tree_edge.size++] = e;
+#ifndef WITH_CGRAPH
if (ND_mark(e->tail) == FALSE)
Tree_node.list[Tree_node.size++] = e->tail;
if (ND_mark(e->head) == FALSE)
Tree_node.list[Tree_node.size++] = e->head;
n = e->tail;
+#else /* WITH_CGRAPH */
+ if (ND_mark(agtail(e)) == FALSE)
+ Tree_node.list[Tree_node.size++] = agtail(e);
+ if (ND_mark(aghead(e)) == FALSE)
+ Tree_node.list[Tree_node.size++] = aghead(e);
+ n = agtail(e);
+#endif /* WITH_CGRAPH */
ND_mark(n) = TRUE;
ND_tree_out(n).list[ND_tree_out(n).size++] = e;
ND_tree_out(n).list[ND_tree_out(n).size] = NULL;
if (ND_out(n).list[ND_tree_out(n).size - 1] == 0)
abort();
+#ifndef WITH_CGRAPH
n = e->head;
+#else /* WITH_CGRAPH */
+ n = aghead(e);
+#endif /* WITH_CGRAPH */
ND_mark(n) = TRUE;
ND_tree_in(n).list[ND_tree_in(n).size++] = e;
ND_tree_in(n).list[ND_tree_in(n).size] = NULL;
Tree_edge.list[ED_tree_index(e)] = f;
ED_tree_index(e) = -1;
+#ifndef WITH_CGRAPH
n = e->tail;
+#else /* WITH_CGRAPH */
+ n = agtail(e);
+#endif /* WITH_CGRAPH */
i = --(ND_tree_out(n).size);
for (j = 0; j <= i; j++)
if (ND_tree_out(n).list[j] == e)
break;
ND_tree_out(n).list[j] = ND_tree_out(n).list[i];
ND_tree_out(n).list[i] = NULL;
+#ifndef WITH_CGRAPH
n = e->head;
+#else /* WITH_CGRAPH */
+ n = aghead(e);
+#endif /* WITH_CGRAPH */
i = --(ND_tree_in(n).size);
for (j = 0; j <= i; j++)
if (ND_tree_in(n).list[j] == e)
ND_tree_in(n).list[j] = ND_tree_in(n).list[i];
ND_tree_in(n).list[i] = NULL;
+#ifndef WITH_CGRAPH
n = f->tail;
+#else /* WITH_CGRAPH */
+ n = agtail(f);
+#endif /* WITH_CGRAPH */
ND_tree_out(n).list[ND_tree_out(n).size++] = f;
ND_tree_out(n).list[ND_tree_out(n).size] = NULL;
+#ifndef WITH_CGRAPH
n = f->head;
+#else /* WITH_CGRAPH */
+ n = aghead(f);
+#endif /* WITH_CGRAPH */
ND_tree_in(n).list[ND_tree_in(n).size++] = f;
ND_tree_in(n).list[ND_tree_in(n).size] = NULL;
}
ND_rank(v) = 0;
ctr++;
for (i = 0; (e = ND_in(v).list[i]); i++)
+#ifndef WITH_CGRAPH
ND_rank(v) = MAX(ND_rank(v), ND_rank(e->tail) + ED_minlen(e));
+#else /* WITH_CGRAPH */
+ ND_rank(v) = MAX(ND_rank(v), ND_rank(agtail(e)) + ED_minlen(e));
+#endif /* WITH_CGRAPH */
for (i = 0; (e = ND_out(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
if (--(ND_priority(e->head)) <= 0)
enqueue(Q, e->head);
+#else /* WITH_CGRAPH */
+ if (--(ND_priority(aghead(e))) <= 0)
+ enqueue(Q, aghead(e));
+#endif /* WITH_CGRAPH */
}
}
if (ctr != N_nodes) {
agerr(AGERR, "trouble in init_rank\n");
for (v = GD_nlist(G); v; v = ND_next(v))
if (ND_priority(v))
+#ifndef WITH_CGRAPH
agerr(AGPREV, "\t%s %d\n", v->name, ND_priority(v));
+#else /* WITH_CGRAPH */
+ agerr(AGPREV, "\t%s %d\n", agnameof(v), ND_priority(v));
+#endif /* WITH_CGRAPH */
}
free_queue(Q);
}
static node_t *incident(edge_t * e)
{
+#ifndef WITH_CGRAPH
if (ND_mark(e->tail)) {
if (ND_mark(e->head) == FALSE)
return e->tail;
+#else /* WITH_CGRAPH */
+ if (ND_mark(agtail(e))) {
+ if (ND_mark(aghead(e)) == FALSE)
+ return agtail(e);
+#endif /* WITH_CGRAPH */
} else {
+#ifndef WITH_CGRAPH
if (ND_mark(e->head))
return e->head;
+#else /* WITH_CGRAPH */
+ if (ND_mark(aghead(e)))
+ return aghead(e);
+#endif /* WITH_CGRAPH */
}
return NULL;
}
j = S_i;
while (S_i < Tree_edge.size) {
+#ifndef WITH_CGRAPH
if ((f = Tree_edge.list[S_i])->u.cutvalue < 0) {
+#else /* WITH_CGRAPH */
+ if (ED_cutvalue(f = Tree_edge.list[S_i]) < 0) {
+#endif /* WITH_CGRAPH */
if (rv) {
if (ED_cutvalue(rv) > ED_cutvalue(f))
rv = f;
if (j > 0) {
S_i = 0;
while (S_i < j) {
+#ifndef WITH_CGRAPH
if ((f = Tree_edge.list[S_i])->u.cutvalue < 0) {
+#else /* WITH_CGRAPH */
+ if (ED_cutvalue(f = Tree_edge.list[S_i]) < 0) {
+#endif /* WITH_CGRAPH */
if (rv) {
if (ED_cutvalue(rv) > ED_cutvalue(f))
rv = f;
for (i = 0; (e = ND_out(v).list[i]); i++) {
if (TREE_EDGE(e) == FALSE) {
+#ifndef WITH_CGRAPH
if (!SEQ(Low, ND_lim(e->head), Lim)) {
+#else /* WITH_CGRAPH */
+ if (!SEQ(Low, ND_lim(aghead(e)), Lim)) {
+#endif /* WITH_CGRAPH */
slack = SLACK(e);
if ((slack < Slack) || (Enter == NULL)) {
Enter = e;
Slack = slack;
}
}
+#ifndef WITH_CGRAPH
} else if (ND_lim(e->head) < ND_lim(v))
dfs_enter_outedge(e->head);
+#else /* WITH_CGRAPH */
+ } else if (ND_lim(aghead(e)) < ND_lim(v))
+ dfs_enter_outedge(aghead(e));
+#endif /* WITH_CGRAPH */
}
for (i = 0; (e = ND_tree_in(v).list[i]) && (Slack > 0); i++)
+#ifndef WITH_CGRAPH
if (ND_lim(e->tail) < ND_lim(v))
dfs_enter_outedge(e->tail);
+#else /* WITH_CGRAPH */
+ if (ND_lim(agtail(e)) < ND_lim(v))
+ dfs_enter_outedge(agtail(e));
+#endif /* WITH_CGRAPH */
}
static void dfs_enter_inedge(node_t * v)
for (i = 0; (e = ND_in(v).list[i]); i++) {
if (TREE_EDGE(e) == FALSE) {
+#ifndef WITH_CGRAPH
if (!SEQ(Low, ND_lim(e->tail), Lim)) {
+#else /* WITH_CGRAPH */
+ if (!SEQ(Low, ND_lim(agtail(e)), Lim)) {
+#endif /* WITH_CGRAPH */
slack = SLACK(e);
if ((slack < Slack) || (Enter == NULL)) {
Enter = e;
Slack = slack;
}
}
+#ifndef WITH_CGRAPH
} else if (ND_lim(e->tail) < ND_lim(v))
dfs_enter_inedge(e->tail);
+#else /* WITH_CGRAPH */
+ } else if (ND_lim(agtail(e)) < ND_lim(v))
+ dfs_enter_inedge(agtail(e));
+#endif /* WITH_CGRAPH */
}
for (i = 0; (e = ND_tree_out(v).list[i]) && (Slack > 0); i++)
+#ifndef WITH_CGRAPH
if (ND_lim(e->head) < ND_lim(v))
dfs_enter_inedge(e->head);
+#else /* WITH_CGRAPH */
+ if (ND_lim(aghead(e)) < ND_lim(v))
+ dfs_enter_inedge(aghead(e));
+#endif /* WITH_CGRAPH */
}
static edge_t *enter_edge(edge_t * e)
int outsearch;
/* v is the down node */
+#ifndef WITH_CGRAPH
if (ND_lim(e->tail) < ND_lim(e->head)) {
v = e->tail;
+#else /* WITH_CGRAPH */
+ if (ND_lim(agtail(e)) < ND_lim(aghead(e))) {
+ v = agtail(e);
+#endif /* WITH_CGRAPH */
outsearch = FALSE;
} else {
+#ifndef WITH_CGRAPH
v = e->head;
+#else /* WITH_CGRAPH */
+ v = aghead(e);
+#endif /* WITH_CGRAPH */
outsearch = TRUE;
}
Enter = NULL;
edge_t *e;
for (i = 0; (e = ND_out(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
if ((ND_mark(e->head) == FALSE) && (SLACK(e) == 0)) {
+#else /* WITH_CGRAPH */
+ if ((ND_mark(aghead(e)) == FALSE) && (SLACK(e) == 0)) {
+#endif /* WITH_CGRAPH */
add_tree_edge(e);
+#ifndef WITH_CGRAPH
if ((Tree_edge.size == N_nodes - 1) || treesearch(e->head))
+#else /* WITH_CGRAPH */
+ if ((Tree_edge.size == N_nodes - 1) || treesearch(aghead(e)))
+#endif /* WITH_CGRAPH */
return TRUE;
}
}
for (i = 0; (e = ND_in(v).list[i]); i++) {
+#ifndef WITH_CGRAPH
if ((ND_mark(e->tail) == FALSE) && (SLACK(e) == 0)) {
+#else /* WITH_CGRAPH */
+ if ((ND_mark(agtail(e)) == FALSE) && (SLACK(e) == 0)) {
+#endif /* WITH_CGRAPH */
add_tree_edge(e);
+#ifndef WITH_CGRAPH
if ((Tree_edge.size == N_nodes - 1) || treesearch(e->tail))
+#else /* WITH_CGRAPH */
+ if ((Tree_edge.size == N_nodes - 1) || treesearch(agtail(e)))
+#endif /* WITH_CGRAPH */
return TRUE;
}
}
ND_tree_in(n).size = ND_tree_out(n).size = 0;
}
for (i = 0; i < Tree_edge.size; i++)
+#ifndef WITH_CGRAPH
Tree_edge.list[i]->u.tree_index = -1;
+#else /* WITH_CGRAPH */
+ ED_tree_index(Tree_edge.list[i]) = -1;
+#endif /* WITH_CGRAPH */
Tree_node.size = Tree_edge.size = 0;
for (n = GD_nlist(G); n && (Tree_edge.size == 0); n = ND_next(n))
if (e) {
delta = SLACK(e);
if (delta) {
+#ifndef WITH_CGRAPH
if (incident(e) == e->head)
+#else /* WITH_CGRAPH */
+ if (incident(e) == aghead(e))
+#endif /* WITH_CGRAPH */
delta = -delta;
for (i = 0; i < Tree_node.size; i++)
+#ifndef WITH_CGRAPH
Tree_node.list[i]->u.rank += delta;
+#else /* WITH_CGRAPH */
+ ND_rank(Tree_node.list[i]) += delta;
+#endif /* WITH_CGRAPH */
}
} else {
#ifdef DEBUG
while (!SEQ(ND_low(v), ND_lim(w), ND_lim(v))) {
e = ND_par(v);
+#ifndef WITH_CGRAPH
if (v == e->tail)
+#else /* WITH_CGRAPH */
+ if (v == agtail(e))
+#endif /* WITH_CGRAPH */
d = dir;
else
d = NOT(dir);
ED_cutvalue(e) += cutvalue;
else
ED_cutvalue(e) -= cutvalue;
+#ifndef WITH_CGRAPH
if (ND_lim(e->tail) > ND_lim(e->head))
v = e->tail;
+#else /* WITH_CGRAPH */
+ if (ND_lim(agtail(e)) > ND_lim(aghead(e)))
+ v = agtail(e);
+#endif /* WITH_CGRAPH */
else
+#ifndef WITH_CGRAPH
v = e->head;
+#else /* WITH_CGRAPH */
+ v = aghead(e);
+#endif /* WITH_CGRAPH */
}
return v;
}
ND_rank(v) -= delta;
for (i = 0; (e = ND_tree_out(v).list[i]); i++)
if (e != ND_par(v))
+#ifndef WITH_CGRAPH
rerank(e->head, delta);
+#else /* WITH_CGRAPH */
+ rerank(aghead(e), delta);
+#endif /* WITH_CGRAPH */
for (i = 0; (e = ND_tree_in(v).list[i]); i++)
if (e != ND_par(v))
+#ifndef WITH_CGRAPH
rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+ rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
}
/* e is the tree edge that is leaving and f is the nontree edge that
/* "for (v = in nodes in tail side of e) do ND_rank(v) -= delta;" */
if (delta > 0) {
int s;
+#ifndef WITH_CGRAPH
s = ND_tree_in(e->tail).size + ND_tree_out(e->tail).size;
+#else /* WITH_CGRAPH */
+ s = ND_tree_in(agtail(e)).size + ND_tree_out(agtail(e)).size;
+#endif /* WITH_CGRAPH */
if (s == 1)
+#ifndef WITH_CGRAPH
rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+ rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
else {
+#ifndef WITH_CGRAPH
s = ND_tree_in(e->head).size + ND_tree_out(e->head).size;
+#else /* WITH_CGRAPH */
+ s = ND_tree_in(aghead(e)).size + ND_tree_out(aghead(e)).size;
+#endif /* WITH_CGRAPH */
if (s == 1)
+#ifndef WITH_CGRAPH
rerank(e->head, -delta);
+#else /* WITH_CGRAPH */
+ rerank(aghead(e), -delta);
+#endif /* WITH_CGRAPH */
else {
+#ifndef WITH_CGRAPH
if (ND_lim(e->tail) < ND_lim(e->head))
rerank(e->tail, delta);
+#else /* WITH_CGRAPH */
+ if (ND_lim(agtail(e)) < ND_lim(aghead(e)))
+ rerank(agtail(e), delta);
+#endif /* WITH_CGRAPH */
else
+#ifndef WITH_CGRAPH
rerank(e->head, -delta);
+#else /* WITH_CGRAPH */
+ rerank(aghead(e), -delta);
+#endif /* WITH_CGRAPH */
}
}
}
cutvalue = ED_cutvalue(e);
+#ifndef WITH_CGRAPH
lca = treeupdate(f->tail, f->head, cutvalue, 1);
if (treeupdate(f->head, f->tail, cutvalue, 0) != lca)
+#else /* WITH_CGRAPH */
+ lca = treeupdate(agtail(f), aghead(f), cutvalue, 1);
+ if (treeupdate(aghead(f), agtail(f), cutvalue, 0) != lca)
+#endif /* WITH_CGRAPH */
abort();
ED_cutvalue(f) = -cutvalue;
ED_cutvalue(e) = 0;
delta = SLACK(f);
if (delta <= 1)
continue;
+#ifndef WITH_CGRAPH
if (ND_lim(e->tail) < ND_lim(e->head))
rerank(e->tail, delta / 2);
+#else /* WITH_CGRAPH */
+ if (ND_lim(agtail(e)) < ND_lim(aghead(e)))
+ rerank(agtail(e), delta / 2);
+#endif /* WITH_CGRAPH */
else
+#ifndef WITH_CGRAPH
rerank(e->head, -delta / 2);
+#else /* WITH_CGRAPH */
+ rerank(aghead(e), -delta / 2);
+#endif /* WITH_CGRAPH */
}
}
freeTreeList (G);
high = Maxrank;
for (i = 0; (e = ND_in(n).list[i]); i++) {
inweight += ED_weight(e);
+#ifndef WITH_CGRAPH
low = MAX(low, ND_rank(e->tail) + ED_minlen(e));
+#else /* WITH_CGRAPH */
+ low = MAX(low, ND_rank(agtail(e)) + ED_minlen(e));
+#endif /* WITH_CGRAPH */
}
for (i = 0; (e = ND_out(n).list[i]); i++) {
outweight += ED_weight(e);
+#ifndef WITH_CGRAPH
high = MIN(high, ND_rank(e->head) - ED_minlen(e));
+#else /* WITH_CGRAPH */
+ high = MIN(high, ND_rank(aghead(e)) - ED_minlen(e));
+#endif /* WITH_CGRAPH */
}
if (low < 0)
low = 0; /* vnodes can have ranks < 0 */
ED_cutvalue(e) = 0;
ED_tree_index(e) = -1;
if (feasible
+#ifndef WITH_CGRAPH
&& (ND_rank(e->head) - ND_rank(e->tail) < ED_minlen(e)))
+#else /* WITH_CGRAPH */
+ && (ND_rank(aghead(e)) - ND_rank(agtail(e)) < ED_minlen(e)))
+#endif /* WITH_CGRAPH */
feasible = FALSE;
}
ND_tree_in(n).list = N_NEW(i + 1, edge_t *);
int i, sum, dir;
/* set v to the node on the side of the edge already searched */
+#ifndef WITH_CGRAPH
if (ND_par(f->tail) == f) {
v = f->tail;
+#else /* WITH_CGRAPH */
+ if (ND_par(agtail(f)) == f) {
+ v = agtail(f);
+#endif /* WITH_CGRAPH */
dir = 1;
} else {
+#ifndef WITH_CGRAPH
v = f->head;
+#else /* WITH_CGRAPH */
+ v = aghead(f);
+#endif /* WITH_CGRAPH */
dir = -1;
}
node_t *other;
int d, rv, f;
+#ifndef WITH_CGRAPH
if (e->tail == v)
other = e->head;
+#else /* WITH_CGRAPH */
+ if (agtail(e) == v)
+ other = aghead(e);
+#endif /* WITH_CGRAPH */
else
+#ifndef WITH_CGRAPH
other = e->tail;
+#else /* WITH_CGRAPH */
+ other = agtail(e);
+#endif /* WITH_CGRAPH */
if (!(SEQ(ND_low(v), ND_lim(other), ND_lim(v)))) {
f = 1;
rv = ED_weight(e);
rv -= ED_weight(e);
}
if (dir > 0) {
+#ifndef WITH_CGRAPH
if (e->head == v)
+#else /* WITH_CGRAPH */
+ if (aghead(e) == v)
+#endif /* WITH_CGRAPH */
d = 1;
else
d = -1;
} else {
+#ifndef WITH_CGRAPH
if (e->tail == v)
+#else /* WITH_CGRAPH */
+ if (agtail(e) == v)
+#endif /* WITH_CGRAPH */
d = 1;
else
d = -1;
for (i = 0; (e = ND_tree_out(v).list[i]); i++)
if (e != par)
+#ifndef WITH_CGRAPH
dfs_cutval(e->head, e);
+#else /* WITH_CGRAPH */
+ dfs_cutval(aghead(e), e);
+#endif /* WITH_CGRAPH */
for (i = 0; (e = ND_tree_in(v).list[i]); i++)
if (e != par)
+#ifndef WITH_CGRAPH
dfs_cutval(e->tail, e);
+#else /* WITH_CGRAPH */
+ dfs_cutval(agtail(e), e);
+#endif /* WITH_CGRAPH */
if (par)
x_cutval(par);
}
ND_low(v) = low;
for (i = 0; (e = ND_tree_out(v).list[i]); i++)
if (e != par)
+#ifndef WITH_CGRAPH
lim = dfs_range(e->head, e, lim);
+#else /* WITH_CGRAPH */
+ lim = dfs_range(aghead(e), e, lim);
+#endif /* WITH_CGRAPH */
for (i = 0; (e = ND_tree_in(v).list[i]); i++)
if (e != par)
+#ifndef WITH_CGRAPH
lim = dfs_range(e->tail, e, lim);
+#else /* WITH_CGRAPH */
+ lim = dfs_range(agtail(e), e, lim);
+#endif /* WITH_CGRAPH */
ND_lim(v) = lim;
return lim + 1;
}
for (n = GD_nlist(G); n; n = ND_next(n)) {
for (i = 0; (e = ND_out(n).list[i]); i++) {
cost += (ED_weight(e)) * abs(LENGTH(e));
+#ifndef WITH_CGRAPH
if (ND_rank(e->head) - ND_rank(e->tail) - ED_minlen(e) < 0)
+#else /* WITH_CGRAPH */
+ if (ND_rank(aghead(e)) - ND_rank(agtail(e)) - ED_minlen(e) < 0)
+#endif /* WITH_CGRAPH */
abort();
}
}
void check_fast_node(node_t * n)
{
node_t *nptr;
+#ifndef WITH_CGRAPH
nptr = GD_nlist(n->graph);
+#else /* WITH_CGRAPH */
+ nptr = GD_nlist(agraphof(n));
+#endif /* WITH_CGRAPH */
while (nptr && nptr != n)
nptr = ND_next(nptr);
assert(nptr != NULL);
ND_mark(n) = TRUE;
ND_onstack(n) = TRUE;
for (i = 0; (e = ND_out(n).list[i]); i++) {
+#ifndef WITH_CGRAPH
w = e->head;
+#else
+ w = aghead(e);
+#endif
if (ND_onstack(w)) {
+#ifndef WITH_CGRAPH
+ fprintf(stderr, "cycle: last edge %lx %s(%lx) %s(%lx)\n",
+ (unsigned long int)e,
+ n->name, (unsigned long int)n,
+ w->name, (unsigned long int)w);
+#else
fprintf(stderr, "cycle: last edge %lx %s(%lx) %s(%lx)\n",
(unsigned long int)e,
- n->name,
- (unsigned long int)n,
- w->name,
- (unsigned long int)w);
+ agnameof(n), (unsigned long int)n,
+ agnameof(w), (unsigned long int)w);
+#endif
return w;
}
else {
if (ND_mark(w) == FALSE) {
x = checkdfs(w);
if (x) {
+#ifndef WITH_CGRAPH
fprintf(stderr,"unwind %lx %s(%lx)\n",
(unsigned long int)e,
- n->name,
- (unsigned long int)n);
+ n->name, (unsigned long int)n);
+#else
+ fprintf(stderr,"unwind %lx %s(%lx)\n",
+ (unsigned long int)e,
+ agnameof(n), (unsigned long int)n);
+#endif
if (x != n) return x;
fprintf(stderr,"unwound to root\n");
fflush(stderr);
if (ED_spl(e) == NULL) {
if ((Concentrate == FALSE) || (ED_edge_type(e) != IGNORED))
+#ifndef WITH_CGRAPH
agerr(AGERR, "lost %s %s edge\n", e->tail->name,
e->head->name);
+#else /* WITH_CGRAPH */
+ agerr(AGERR, "lost %s %s edge\n",agnameof(agtail(e)),\r
+ agnameof(aghead(e)));\r
+#endif /* WITH_CGRAPH */
return;
}
for (j = 0; j < ED_spl(e)->size; j++) {
int c;
pointf p, d;
+#ifndef WITH_CGRAPH
if ((g != g->root) && (GD_label(g)) && !GD_label(g)->set) {
+#else /* WITH_CGRAPH */
+ if ((g != agroot(g)) && (GD_label(g)) && !GD_label(g)->set) {\r
+#endif /* WITH_CGRAPH */
if (GD_label_pos(g) & LABEL_AT_TOP) {
d = GD_border(g)[RIGHT_IX];
int c;
pointf p, d;
+#ifndef WITH_CGRAPH
if ((g != g->root) && (GD_label(g)) && !GD_label(g)->set) {
+#else /* WITH_CGRAPH */
+ if ((g != agroot(g)) && (GD_label(g)) && !GD_label(g)->set) {\r
+#endif /* WITH_CGRAPH */
if (GD_label_pos(g) & LABEL_AT_TOP) {
d = GD_border(g)[TOP_IX];
p.y = GD_bb(g).UR.y - d.y / 2;
desc->offset.x = -us->x - (dx) / 2;
desc->offset.y = -us->y - (dy) / 2;
} else
+#ifndef WITH_CGRAPH
agerr(AGWARN, "shapefile not set for epsf node %s\n", n->name);
+#else /* WITH_CGRAPH */
+ agerr(AGWARN, "shapefile not set for epsf node %s\n", agnameof(n));
+#endif /* WITH_CGRAPH */
}
void epsf_free(node_t * n)
}
else flip = 0;
+#ifndef WITH_CGRAPH
if (realedge->tail != realedge->head) {
+#else /* WITH_CGRAPH */
+ if (agtail(realedge) != aghead(realedge)) {\r
+#endif /* WITH_CGRAPH */
/* I assume that the path goes either down only or
up - right - down */
for (bi = 0, pi = 0; bi < boxn; bi++) {
#ifdef DEBUG
static int debugleveln(edge_t* e, int i)
{
+#ifndef WITH_CGRAPH
return (GD_showboxes(e->head->graph) == i ||
GD_showboxes(e->tail->graph) == i ||
+#else /* WITH_CGRAPH */
+ return (GD_showboxes(aghead(e)->graph) == i ||
+ GD_showboxes(agtail(e)->graph) == i ||
+#endif /* WITH_CGRAPH */
ED_showboxes(e) == i ||
+#ifndef WITH_CGRAPH
ND_showboxes(e->head) == i ||
ND_showboxes(e->tail) == i);
+#else /* WITH_CGRAPH */
+ ND_showboxes(aghead(e)) == i ||
+ ND_showboxes(agtail(e)) == i);
+#endif /* WITH_CGRAPH */
}
static void showPoints(pointf ps[], int pn)
arrow_flags(e, &sflag, &eflag);
if (info->splineMerge(hn))
eflag = ARR_NONE;
+#ifndef WITH_CGRAPH
if (info->splineMerge(fe->tail))
+#else /* WITH_CGRAPH */
+ if (info->splineMerge(agtail(fe)))
+#endif /* WITH_CGRAPH */
sflag = ARR_NONE;
if (j) {
i = sflag;
bezier *new_spline(edge_t * e, int sz)
{
bezier *rv;
+#ifndef WITH_CGRAPH
+#else /* WITH_CGRAPH */
+ splines* sp_test;
+#endif /* WITH_CGRAPH */
while (ED_edge_type(e) != NORMAL)
e = ED_to_orig(e);
if (ED_spl(e) == NULL)
/* clip_and_install:
* Given a raw spline (pn control points in ps), representing
- * a path from edge fe->tail ending in node hn, clip the ends to
+ * a path from edge agtail(fe) ending in node hn, clip the ends to
* the node boundaries and attach the resulting spline to the
* edge.
*/
boxf *tbox, *hbox;
inside_t inside_context;
+#ifndef WITH_CGRAPH
tn = fe->tail;
g = tn->graph;
+#else /* WITH_CGRAPH */
+ tn = agtail(fe);
+ g = agraphof(tn);
+#endif /* WITH_CGRAPH */
newspl = new_spline(fe, pn);
for (orig = fe; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
/* may be a reversed flat edge */
+#ifndef WITH_CGRAPH
if ((tn->u.rank == hn->u.rank) && (tn->u.order > hn->u.order)) {
+#else /* WITH_CGRAPH */
+ if ((ND_rank(tn) == ND_rank(hn)) && (ND_order(tn) > ND_order(hn))) {
+#endif /* WITH_CGRAPH */
node_t *tmp;
tmp = hn;
hn = tn;
tn = tmp;
}
+#ifndef WITH_CGRAPH
if (tn == orig->tail) {
+#else /* WITH_CGRAPH */
+ if (tn == agtail(orig)) {
+#endif /* WITH_CGRAPH */
clipTail = ED_tail_port(orig).clip;
clipHead = ED_head_port(orig).clip;
tbox = ED_tail_port(orig).bp;
s_in = s_out = 0.0;
for (cnt_in = 0; (e = ND_in(n).list[cnt_in]); cnt_in++)
+#ifndef WITH_CGRAPH
s_in += ND_coord(e->tail).x;
+#else /* WITH_CGRAPH */
+ s_in += ND_coord(agtail(e)).x;
+#endif /* WITH_CGRAPH */
for (cnt_out = 0; (e = ND_out(n).list[cnt_out]); cnt_out++)
+#ifndef WITH_CGRAPH
s_out += ND_coord(e->head).x;
+#else /* WITH_CGRAPH */
+ s_out += ND_coord(aghead(e)).x;
+#endif /* WITH_CGRAPH */
p.x = ND_coord(n).x - (s_in / cnt_in);
+#ifndef WITH_CGRAPH
p.y = ND_coord(n).y - ND_coord(ND_in(n).list[0]->tail).y;
+#else /* WITH_CGRAPH */
+ p.y = ND_coord(n).y - ND_coord(agtail(ND_in(n).list[0])).y;
+#endif /* WITH_CGRAPH */
m_in = atan2(p.y, p.x);
p.x = (s_out / cnt_out) - ND_coord(n).x;
+#ifndef WITH_CGRAPH
p.y = ND_coord(ND_out(n).list[0]->head).y - ND_coord(n).y;
+#else /* WITH_CGRAPH */
+ p.y = ND_coord(aghead(ND_out(n).list[0])).y - ND_coord(n).y;
+#endif /* WITH_CGRAPH */
m_out = atan2(p.y, p.x);
return ((m_in + m_out) / 2.0);
}
node_t *n;
int (*pboxfn) (node_t*, port*, int, boxf*, int*);
+#ifndef WITH_CGRAPH
n = e->tail;
+#else /* WITH_CGRAPH */
+ n = agtail(e);
+#endif /* WITH_CGRAPH */
if (ED_tail_port(e).dyna)
+#ifndef WITH_CGRAPH
ED_tail_port(e) = resolvePort(e->tail, e->head, &ED_tail_port(e));
+#else
+ ED_tail_port(e) = resolvePort(agtail(e), aghead(e), &ED_tail_port(e));
+#endif
if (ND_shape(n))
pboxfn = ND_shape(n)->fns->pboxfn;
else
P->start.p = add_pointf(ND_coord(n), ED_tail_port(e).p);
if (merge) {
/*P->start.theta = - M_PI / 2; */
+#ifndef WITH_CGRAPH
P->start.theta = conc_slope(e->tail);
+#else /* WITH_CGRAPH */
+ P->start.theta = conc_slope(agtail(e));
+#endif /* WITH_CGRAPH */
P->start.constrained = TRUE;
} else {
if (ED_tail_port(e).constrained) {
/* b0.LL.y = ND_coord(n).y + ND_ht(n)/2; */
b0.LL.y = P->start.p.y;
b0.UR.x = b.UR.x;
+#ifndef WITH_CGRAPH
b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.UR.x = ND_coord(n).x - ND_lw(n) - (FUDGE-2);
b.UR.y = b0.LL.y;
b.LL.y = ND_coord(n).y - ND_ht(n)/2;
b0.LL.y = P->start.p.y;
/* b0.LL.y = ND_coord(n).y + ND_ht(n)/2; */
b0.UR.x = b.UR.x+1;
+#ifndef WITH_CGRAPH
b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.UR.y = ND_coord(n).y + ND_ht(n)/2 + GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
b.UR.y = b0.LL.y;
b.LL.y = ND_coord(n).y - ND_ht(n)/2;
P->start.p.x += 1;
}
for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
if (n == orig->tail)
+#else /* WITH_CGRAPH */
+ if (n == agtail(orig))
+#endif /* WITH_CGRAPH */
ED_tail_port(orig).clip = FALSE;
else
ED_head_port(orig).clip = FALSE;
b0.UR.y = ND_coord(n).y - ND_ht(n)/2;
b0.UR.x = b.UR.x+1;
b0.LL.x = P->start.p.x;
+#ifndef WITH_CGRAPH
b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.LL.y = b0.UR.y - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
b.LL.y = b0.UR.y;
b.UR.y = ND_coord(n).y + ND_ht(n)/2;
endp->boxn = 1;
}
for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
if (n == orig->tail)
+#else /* WITH_CGRAPH */
+ if (n == agtail(orig))
+#endif /* WITH_CGRAPH */
ED_tail_port(orig).clip = FALSE;
else
ED_head_port(orig).clip = FALSE;
node_t *n;
int (*pboxfn) (node_t* n, port*, int, boxf*, int*);
+#ifndef WITH_CGRAPH
n = e->head;
+#else /* WITH_CGRAPH */
+ n = aghead(e);
+#endif /* WITH_CGRAPH */
if (ED_head_port(e).dyna)
+#ifndef WITH_CGRAPH
ED_head_port(e) = resolvePort(e->head, e->tail, &ED_head_port(e));
+#else /* WITH_CGRAPH */
+ ED_head_port(e) = resolvePort(aghead(e), agtail(e), &ED_head_port(e));
+#endif /* WITH_CGRAPH */
if (ND_shape(n))
pboxfn = ND_shape(n)->fns->pboxfn;
else
P->end.p = add_pointf(ND_coord(n), ED_head_port(e).p);
if (merge) {
/*P->end.theta = M_PI / 2; */
+#ifndef WITH_CGRAPH
P->end.theta = conc_slope(e->head) + M_PI;
+#else /* WITH_CGRAPH */
+ P->end.theta = conc_slope(aghead(e)) + M_PI;
+#endif /* WITH_CGRAPH */
assert(P->end.theta < 2 * M_PI);
P->end.constrained = TRUE;
} else {
/* b0.UR.y = ND_coord(n).y - ND_ht(n)/2; */
b0.UR.y = P->end.p.y;
b0.UR.x = b.UR.x;
+#ifndef WITH_CGRAPH
b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.UR.x = ND_coord(n).x - ND_lw(n) - (FUDGE-2);
b.LL.y = b0.UR.y;
b.UR.y = ND_coord(n).y + ND_ht(n)/2;
b0.UR.y = P->end.p.y;
/* b0.UR.y = ND_coord(n).y - ND_ht(n)/2; */
b0.UR.x = b.UR.x+1;
+#ifndef WITH_CGRAPH
b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.LL.y = ND_coord(n).y - ND_ht(n)/2 - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.LL.x = ND_coord(n).x + ND_rw(n) + (FUDGE-2);
b.LL.y = b0.UR.y;
b.UR.y = ND_coord(n).y + ND_ht(n)/2;
P->start.p.x -= 1;
}
for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
if (n == orig->head)
+#else /* WITH_CGRAPH */
+ if (n == aghead(orig))
+#endif /* WITH_CGRAPH */
ED_head_port(orig).clip = FALSE;
else
ED_tail_port(orig).clip = FALSE;
b0.LL.x = b.LL.x-1;
b0.UR.y = ND_coord(n).y - ND_ht(n)/2;
b0.UR.x = P->end.p.x;
+#ifndef WITH_CGRAPH
b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
+#else /* WITH_CGRAPH */
+ b0.LL.y = b0.UR.y - GD_ranksep(agraphof(n))/2;
+#endif /* WITH_CGRAPH */
b.UR.x = ND_coord(n).x - ND_lw(n) - 2;
b.LL.y = b0.UR.y;
b.UR.y = ND_coord(n).y + ND_ht(n)/2;
break;
}
for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
+#ifndef WITH_CGRAPH
if (n == orig->head)
+#else /* WITH_CGRAPH */
+ if (n == aghead(orig))
+#endif /* WITH_CGRAPH */
ED_head_port(orig).clip = FALSE;
else
ED_tail_port(orig).clip = FALSE;
int pointn;
e = edges[ind];
+#ifndef WITH_CGRAPH
n = e->tail;
+#else
+ n = agtail(e);
+#endif
stepx = (sizex / 2.) / cnt;
stepx = MAX(stepx,2.);
points[pointn++] = pointfof(hp.x - dx, hp.y - hy / 3);
points[pointn++] = hp;
if (ED_label(e)) {
+#ifndef WITH_CGRAPH
if (GD_flip(e->tail->graph)) {
+#else
+ if (GD_flip(agraphof(agtail(e)))) {
+#endif
width = ED_label(e)->dimen.y;
height = ED_label(e)->dimen.x;
} else {
if (dx + stepx < width)
dx += width - stepx;
}
+#ifndef WITH_CGRAPH
clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+ clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
#ifdef DEBUG
if (debugleveln(e,1))
showPoints (points, pointn);
int pointn;
e = edges[ind];
+#ifndef WITH_CGRAPH
n = e->tail;
+#else
+ n = agtail(e);
+#endif
stepx = (sizex / 2.) / cnt;
stepx = MAX(stepx, 2.);
points[pointn++] = pointfof(hp.x - dx, hp.y + hy / 3);
points[pointn++] = hp;
if (ED_label(e)) {
- if (GD_flip(e->tail->graph)) {
+#ifndef WITH_CGRAPH
+ if (GD_flip(e->tail->graph)) {
+#else
+ if (GD_flip(agraphof(agtail(e)))) {
+#endif
width = ED_label(e)->dimen.y;
height = ED_label(e)->dimen.x;
} else {
if (dx + stepx < width)
dx += width - stepx;
}
+#ifndef WITH_CGRAPH
clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+ clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
#ifdef DEBUG
if (debugleveln(e,1))
showPoints (points, pointn);
int pointn;
e = edges[ind];
+#ifndef WITH_CGRAPH
n = e->tail;
+#else
+ n = agtail(e);
+#endif
stepy = (sizey / 2.) / cnt;
stepy = MAX(stepy, 2.);
points[pointn++] = pointfof(hp.x + hx / 3, hp.y - dy);
points[pointn++] = hp;
if (ED_label(e)) {
+#ifndef WITH_CGRAPH
if (GD_flip(e->tail->graph)) {
+#else
+ if (GD_flip(agraphof(agtail(e)))) {
+#endif
width = ED_label(e)->dimen.y;
height = ED_label(e)->dimen.x;
} else {
if (dy + stepy < height)
dy += height - stepy;
}
+#ifndef WITH_CGRAPH
clip_and_install(e, e->head, points, pointn, sinfo);
+#else
+ clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif
#ifdef DEBUG
if (debugleveln(e,1))
showPoints (points, pointn);
int pointn;
e = edges[ind];
+#ifndef WITH_CGRAPH
n = e->tail;
+#else /* WITH_CGRAPH */
+ n = agtail(e);
+#endif /* WITH_CGRAPH */
stepy = (sizey / 2.) / cnt;
stepy = MAX(stepy,2.);
points[pointn++] = pointfof(hp.x - hx / 3, hp.y - dy);
points[pointn++] = hp;
if (ED_label(e)) {
+#ifndef WITH_CGRAPH
if (GD_flip(e->tail->graph)) {
+#else /* WITH_CGRAPH */
+ if (GD_flip(agraphof(agtail(e)))) {
+#endif /* WITH_CGRAPH */
width = ED_label(e)->dimen.y;
height = ED_label(e)->dimen.x;
} else {
if (dy + stepy < height)
dy += height - stepy;
}
+#ifndef WITH_CGRAPH
clip_and_install(e, e->head, points, pointn, sinfo);
+#else /* WITH_CGRAPH */
+ clip_and_install(e, aghead(e), points, pointn, sinfo);
+#endif /* WITH_CGRAPH */
#ifdef DEBUG
if (debugleveln(e,1))
showPoints (points, pointn);
(!(ED_tail_port(e).side & (TOP|BOTTOM)))))) {
sw = SELF_EDGE_SIZE;
if (l) {
+#ifndef WITH_CGRAPH
label_width = GD_flip(e->head->graph) ? l->dimen.y : l->dimen.x;
+#else /* WITH_CGRAPH */
+ label_width = GD_flip(agraphof(aghead(e))) ? l->dimen.y : l->dimen.x;
+#endif /* WITH_CGRAPH */
sw += label_width;
}
}
#define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size)
#define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb)
#define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust)
-#define ND_coord_i(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
+#define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
#define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist)
#define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in)
#define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out)
#define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex)
#define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height)
#define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops)
-#define ND_ht_i(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
+#define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
#define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in)
#define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf)
#define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label)
#define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim)
#define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low)
-#define ND_lw_i(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
+#define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
#define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark)
#define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval)
#define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster)
#define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority)
#define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank)
#define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype)
-#define ND_rw_i(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
+#define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
#define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in)
#define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out)
#define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape)