{
Agnode_t *next;
Agedge_t *ep;
+
int nsteps = SLEAF(n) + 1;
for (ep = agfstedge(g, n); ep; ep = agnxtedge(g, ep, n)) {
- if ((next = ep->tail) == n)
- next = ep->head;
+ if ((next = agtail(ep)) == n)
+ next = aghead(ep);
if (prev == next)
continue;
Agnode_t *np;
for (ep = agfstedge(g, n); ep; ep = agnxtedge(g, ep, n)) {
- if ((np = ep->tail) == n)
- np = ep->head;
+ if ((np = agtail(ep)) == n)
+ np = aghead(ep);
if (n == np)
continue; /* loop */
if (neighp) {
int nsteps = SCENTER(n) + 1;
for (ep = agfstedge(g, n); ep; ep = agnxtedge(g, ep, n)) {
- if ((next = ep->tail) == n)
- next = ep->head;
+ if ((next = agtail(ep)) == n)
+ next = aghead(ep);
if (prev == next)
continue;
ratio = SPAN(n) / STSIZE(n);
for (ep = agfstedge(g, n); ep; ep = agnxtedge(g, ep, n)) {
- if ((next = ep->tail) == n)
- next = ep->head;
+ if ((next = agtail(ep)) == n)
+ next = aghead(ep);
if (SPARENT(next) != n)
continue; /* handles loops */
theta = THETA(n) - SPAN(n) / 2;
for (ep = agfstedge(sg, n); ep; ep = agnxtedge(sg, ep, n)) {
- if ((next = ep->tail) == n)
- next = ep->head;
+ if ((next = agtail(ep)) == n)
+ next = aghead(ep);
if (SPARENT(next) != n)
continue; /* handles loops */
if (THETA(next) != UNSET)
double xf;
double hyp;
+#ifndef WITH_CGRAPH
p = late_string(g, agfindattr(g->root, "ranksep"), NULL);
+#else /* WITH_CGRAPH */
+ p = late_string(g, agattr(g->root,AGRAPH, "ranksep",(char*)0), NULL);
+#endif /* WITH_CGRAPH */
if (p) {
if (sscanf(p, "%lf", &xf) == 0)
xf = DEF_RANKSEP;
if (!center)
center = findCenterNode(sg);
if (Verbose)
- fprintf(stderr, "root = %s\n", center->name);
+ fprintf(stderr, "root = %s\n", agnameof(center));
/* maxNStepsToCenter = setParentNodes(sg,center); */
setParentNodes(sg, center);
static void twopi_init_edge(edge_t * e)
{
+#ifdef WITH_CGRAPH
+ agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
+#endif /* WITH_CGRAPH */
common_init_edge(e);
-
ED_factor(e) = late_double(e, E_weight, 1.0, 0.0);
}
GD_neato_nlist(g) = N_NEW(agnnodes(g) + 1, node_t *);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
+ neato_init_node(n);
ND_alg(n) = alg + i;
GD_neato_nlist(g)[i++] = n;
- neato_init_node(n);
}
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
twopi_init_graph(g);
s = agget(g, "root");
if (s && (*s != '\0')) {
+#ifndef WITH_CGRAPH
ctr = agfindnode(g, s);
+#else /* WITH_CGRAPH */
+ ctr = agnode(g, s,0);
+#endif /* WITH_CGRAPH */
if (!ctr) {
agerr(AGWARN, "specified root node \"%s\" was not found.", s);
agerr(AGPREV, "Using default calculation for root node\n");
static void twopi_cleanup_graph(graph_t * g)
{
free(GD_neato_nlist(g));
- if (g != g->root) memset(&(g->u), 0, sizeof(Agraphinfo_t));
+ if (g != agroot(g))
+#ifndef WITH_CGRAPH
+ memset(&(g->u), 0, sizeof(Agraphinfo_t));
+#else /* WITH_CGRAPH */
+ agclean(g,AGRAPH,"Agraphinfo_t");
+#endif /* WITH_CGRAPH */
}
void twopi_cleanup(graph_t * g)