# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-SUBDIRS = cdt graph cgraph pathplan sfio vmalloc ast \
+SUBDIRS = cdt cgraph pathplan sfio vmalloc ast \
vpsc rbtree ortho sparse patchwork expr common \
pack xdot label gvc ingraphs topfish glcomp mingle \
circogen dotgen dotgen2 fdpgen neatogen twopigen sfdpgen osage gvpr
-I$(top_srcdir) \
-I$(top_srcdir)/lib/cdt
-# Always build cgraph, regardless of --without-cgraph, because gvpr needs it
-# if WITH_CGRAPH
pkginclude_HEADERS = cgraph.h
noinst_HEADERS = agxbuf.h cghdr.h malloc.h vmstub.h
noinst_LTLIBRARIES = libcgraph_C.la
pkgconfig_DATA = libcgraph.pc
man_MANS = cgraph.3
pdf_DATA = cgraph.3.pdf
-# endif
libcgraph_C_la_SOURCES = agerror.c agxbuf.c apply.c attr.c edge.c \
flatten.c graph.c grammar.y id.c imap.c io.c mem.c node.c \
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
pkgconfigdir = $(libdir)/pkgconfig
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
-I$(top_srcdir)/lib/sparse \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = block.h blockpath.h blocktree.h circo.h \
static int id = 0;
sprintf(gname, "_clone_%d", id++);
-#ifndef WITH_CGRAPH
- clone = agsubg(ing, gname);
-#else /* WITH_CGRAPH */
clone = agsubg(ing, gname,1);
agbindrec(clone, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
sprintf(gname, "_clone_%d", id++);
-#ifndef WITH_CGRAPH
- xclone = agopen(gname, ing->kind);
- for (n = agfstnode(ing); n; n = agnxtnode(ing, n)) {
- aginsert(clone, n);
- xn = agnode(xclone, agnameof(n));
-#else /* WITH_CGRAPH */
xclone = agopen(gname, ing->desc,NIL(Agdisc_t *));
for (n = agfstnode(ing); n; n = agnxtnode(ing, n)) {
agsubnode(clone,n,1);
xn = agnode(xclone, agnameof(n),1);
agbindrec(xn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
CLONE(n) = xn;
}
for (n = agfstnode(ing); n; n = agnxtnode(ing, n)) {
xn = CLONE(n);
-#ifndef WITH_CGRAPH
- for (e = agfstout(ing, n); e; e = agnxtout(ing, e)) {
- aginsert(clone, e);
- xh = CLONE(e->head);
- xe = agedge(xclone, xn, xh);
-#else /* WITH_CGRAPH */
for (e = agfstout(ing, n); e; e = agnxtout(ing, e)) {
agsubedge(clone,e,1);
xh = CLONE(aghead(e));
xe = agedge(xclone, xn, xh, NULL, 1);
agbindrec(xe, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
ORIGE(xe) = e;
DEGREE(xn) += 1;
DEGREE(xh) += 1;
break;
tp = neighbors_without[mark];
hp = neighbors_without[mark + 1];
-#ifndef WITH_CGRAPH
- agedge(g, tp, hp);
-#else /* WITH_CGRAPH */
agbindrec(agedge(g, tp, hp, NULL, 1), "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); // edge custom data
-
-#endif /* WITH_CGRAPH */
DEGREE(tp)++;
DEGREE(hp)++;
diff--;
while (diff > 0) {
tp = neighbors_without[0];
hp = neighbors_without[mark];
-#ifndef WITH_CGRAPH
- agedge(g, tp, hp);
-#else /* WITH_CGRAPH */
-
agbindrec(agedge(g, tp, hp, NULL, 1), "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); // edge custom data
-
-#endif /* WITH_CGRAPH */
DEGREE(tp)++;
DEGREE(hp)++;
mark++;
tp = neighbors_with[0];
for (mark = 0; mark < no_pair_count; mark++) {
hp = neighbors_without[mark];
-#ifndef WITH_CGRAPH
- agedge(g, tp, hp);
-#else /* WITH_CGRAPH */
agbindrec(agedge(g, tp, hp, NULL, 1), "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
-
-#endif /* WITH_CGRAPH */
DEGREE(tp)++;
DEGREE(hp)++;
}
if (!VISITED(neighbor)) {
/* add the edge to the dfs tree */
-#ifndef WITH_CGRAPH
- aginsert(tree, e);
-#else /* WITH_CGRAPH */
agsubedge(tree,e,1);
-#endif /* WITH_CGRAPH */
TPARENT(neighbor) = n;
dfs(g, neighbor, tree);
}
static int id = 0;
sprintf(gname, "_span_%d", id++);
-#ifndef WITH_CGRAPH
- tree = agsubg(g, gname);
-#else /* WITH_CGRAPH */
tree = agsubg(g, gname,1);
agbindrec(tree, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-#ifndef WITH_CGRAPH
- aginsert(tree, n);
-#else /* WITH_CGRAPH */
agsubnode(tree,n,1);
-#endif /* WITH_CGRAPH */
DISTONE(n) = 0;
DISTTWO(n) = 0;
UNSET_VISITED(n);
for (n = agfstnode(subg); n; n = agnxtnode(subg, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
if (BLOCK(aghead(e)) == sn)
-#ifndef WITH_CGRAPH
- aginsert(subg, e);
-#else /* WITH_CGRAPH */
agsubedge(subg,e,1);
-#endif /* WITH_CGRAPH */
}
}
}
static void addNode(block_t * bp, Agnode_t * n)
{
-#ifndef WITH_CGRAPH
- aginsert(bp->sub_graph, n);
-#else /* WITH_CGRAPH */
agsubnode(bp->sub_graph, n,1);
-#endif /* WITH_CGRAPH */
BLOCK(n) = bp;
}
Agraph_t *subg;
sprintf(name, "_block_%d", state->blockCount++);
-#ifndef WITH_CGRAPH
- subg = agsubg(g, name);
-#else /* WITH_CGRAPH */
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
return subg;
}
if (rg != rootg) { /* new root graph */
state->blockCount = 0;
rootg = rg;
-#ifndef WITH_CGRAPH
- G_mindist = agfindattr(rootg, "mindist");
-#else /* WITH_CGRAPH */
G_mindist = agattr(rootg,AGRAPH, "mindist", NULL);
-#endif /* WITH_CGRAPH */
min_dist = late_double(rootg, G_mindist, MINDIST, 0.0);
-#ifndef WITH_CGRAPH
- N_artpos = agfindattr(rootg->proto->n, "articulation_pos");
- N_root = agfindattr(rootg->proto->n, "root");
-#else /* WITH_CGRAPH */
N_artpos = agattr(rootg,AGNODE, "articulation_pos", NULL);
N_root = agattr(rootg,AGNODE, "root", NULL);
-#endif /* WITH_CGRAPH */
rootname = agget(rootg, "root");
}
initBlocklist(&state->bl);
Agnode_t* n;
sprintf(name, "_block_%d", state->blockCount++);
-#ifdef WITH_CGRAPH
subg = agsubg(g, name, 1);
-#else
- subg = agsubg(g, name);
-#endif
bp = mkBlock(subg);
for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
-#ifdef WITH_CGRAPH
agsubnode(bp->sub_graph, n, 1);
-#else
- aginsert(bp->sub_graph, n);
-#endif
BLOCK(n) = bp;
}
static void circular_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);
static node_t *makeDerivedNode(graph_t * dg, char *name, int isNode,
void *orig)
{
-#ifndef WITH_CGRAPH
- node_t *n = agnode(dg, name);
-#else /* WITH_CGRAPH */
node_t *n = agnode(dg, name,1);
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
ND_alg(n) = (void *) NEW(cdata);
if (isNode) {
ND_pos(n) = N_NEW(Ndim, double);
Agedge_t *ep;
Agnode_t *p;
-#ifndef WITH_CGRAPH
- dg = agopen("derived", AGFLAG_STRICT);
-#else /* WITH_CGRAPH */
dg = agopen("derived", Agstrictundirected,NIL(Agdisc_t *));
agbindrec (dg, "info", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
GD_alg(g) = dg; /* store derived graph for closing later */
for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
dt = DNODE(agtail(e));
dh = DNODE(aghead(e));
if (dt != dh) {
-#ifndef WITH_CGRAPH
- agedge(dg, dt, dh);
-#else /* WITH_CGRAPH */
agbindrec(agedge(dg, dt, dh, NULL, 1), "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
}
}
}
/* n = DNODE(agtail(e)); by construction since agtail(e) == p */
dh = DNODE(aghead(e));
if (n != dh) {
-#ifndef WITH_CGRAPH
- ep = agedge(dg, n, dh);
- aginsert(sg, ep);
-#else /* WITH_CGRAPH */
ep = agedge(dg, n, dh, NULL, 1);
agbindrec(ep, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
agsubedge(sg,ep,1);
-#endif /* WITH_CGRAPH */
}
}
}
}
free(GD_neato_nlist(g));
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 */
}
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/gvc \
-I$(top_srcdir)/lib/xdot \
-I$(top_srcdir)/lib/fdpgen \
-I$(top_srcdir)/lib/pathplan \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt $(GD_INCLUDES) $(EXPAT_INCLUDES) $(Z_INCLUDES)
if WITH_WIN32
arrowdir_t *arrowdir;
*sflag = ARR_TYPE_NONE;
-#ifdef WITH_CGRAPH
*eflag = agisdirected(agraphof(e)) ? ARR_TYPE_NORM : ARR_TYPE_NONE;
if (E_dir && ((attr = agxget(e, E_dir)))[0]) {
-#else
- *eflag = AG_IS_DIRECTED(e->tail->graph) ? ARR_TYPE_NORM : ARR_TYPE_NONE;
- if (E_dir && ((attr = agxget(e, E_dir->index)))[0]) {
-#endif
for (arrowdir = Arrowdirs; arrowdir->dir; arrowdir++) {
if (streq(attr, arrowdir->dir)) {
*sflag = arrowdir->sflag;
}
}
}
-#ifdef WITH_CGRAPH
if (E_arrowhead && (*eflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowhead)))[0])
arrow_match_name(attr, eflag);
if (E_arrowtail && (*sflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowtail)))[0])
arrow_match_name(attr, sflag);
-#else
- if (E_arrowhead && (*eflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowhead->index)))[0])
- arrow_match_name(attr, eflag);
- if (E_arrowtail && (*sflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowtail->index)))[0])
- arrow_match_name(attr, sflag);
-#endif
if (ED_conc_opp_flag(e)) {
edge_t *f;
int s0, e0;
}
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
- idnum = ((graph_t*)obj)->meta_node->id;
-#else
case AGRAPH:
idnum = AGSEQ(obj);
-#endif
if (root == obj)
pfx = "graph";
else
if (job->numLayers <= 1)
return TRUE;
-#ifndef WITH_CGRAPH
- pg = late_string(sg, agfindattr(sg, "layer"), "");
-#else
pg = late_string(sg, agattr(sg, AGRAPH, "layer", 0), "");
-#endif
if (selectedlayer(job, pg))
return TRUE;
if (pg[0])
rv = parseSegs (colors, num, &segs);
if (rv > 1) {
-#ifndef WITH_CGRAPH
- Agraph_t* g = e->tail->graph;
- agerr (AGPREV, "in edge %s%s%s\n", agnameof(e->tail), (AG_IS_DIRECTED(g)?" -> ":" -- "), agnameof(e->head));
-#else
Agraph_t* g = agraphof(agtail(e));
agerr (AGPREV, "in edge %s%s%s\n", agnameof(agtail(e)), (agisdirected(g)?" -> ":" -- "), agnameof(aghead(e)));
-#endif
if (rv == 2)
return 1;
}
taperfun (edge_t* e)
{
char* attr;
-#ifdef WITH_CGRAPH
if (E_dir && ((attr = agxget(e, E_dir)))[0]) {
-#else
- if (E_dir && ((attr = agxget(e, E_dir->index)))[0]) {
-#endif
if (streq(attr, "forward")) return forfunc;
if (streq(attr, "back")) return revfunc;
if (streq(attr, "both")) return bothfunc;
*/
if (styles && ED_spl(e)) gvrender_set_style(job, styles);
-#ifndef WITH_CGRAPH
- if (E_penwidth && ((s=agxget(e,E_penwidth->index)) && s[0])) {
-#else
if (E_penwidth && ((s=agxget(e,E_penwidth)) && s[0])) {
-#endif
penwidth = late_double(e, E_penwidth, 1.0, 0.0);
gvrender_set_penwidth(job, penwidth);
}
G_penwidth = agfindgraphattr(g, "penwidth");
/* default font */
-#ifndef WITH_CGRAPH
- gvc->defaultfontname = late_nnstring(g->proto->n,
- N_fontname, DEFAULT_FONTNAME);
- gvc->defaultfontsize = late_double(g->proto->n,
- N_fontsize, DEFAULT_FONTSIZE, MIN_FONTSIZE);
-#else
gvc->defaultfontname = late_nnstring(NULL,
N_fontname, DEFAULT_FONTNAME);
gvc->defaultfontsize = late_double(NULL,
N_fontsize, DEFAULT_FONTSIZE, MIN_FONTSIZE);
-#endif
/* default line style */
gvc->defaultlinestyle = defaultlinestyle;
job->focus.x, job->focus.y, job->view.x, job->view.y);
#endif
-#ifndef WITH_CGRAPH
- s = late_string(g, agfindattr(g, "comment"), "");
-#else
s = late_string(g, agattr(g, AGRAPH, "comment", 0), "");
-#endif
gvrender_comment(job, s);
job->layerNum = 0;
/* support for stderr_once */
static void free_string_entry(Dict_t * dict, char *key, Dtdisc_t * disc)
{
-#ifndef WITH_CGRAPH
- agstrfree(key);
-#else
free(key);
-#endif
}
static Dict_t *strings;
if (strings == 0)
strings = dtopen(&stringdict, Dtoset);
if (!dtsearch(strings, str)) {
-#ifndef WITH_CGRAPH
- dtinsert(strings, agstrdup(str));
-#else
dtinsert(strings, strdup(str));
-#endif
return TRUE;
}
return FALSE;
t = GD_nlist(g);
for (h = ND_next(t); h; h = ND_next(h)) {
if (!agfindedge(g, t, h)) {
-#ifdef WITH_CGRAPH
e = agedge(g, t, h, NULL, 1);
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#else
- e = agedge(g, t, h);
-#endif
ED_minlen(e) = 0;
elist_append(e, ND_out(t));
elist_append(e, ND_in(h));
if (e)
ED_minlen(e) = MAX(ED_minlen(e), sz);
else {
-#ifdef WITH_CGRAPH
e = agedge(g, t, h, NULL, 1);
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#else
- e = agedge(g, t, h);
-#endif
ED_minlen(e) = sz;
elist_append(e, ND_out(t));
elist_append(e, ND_in(h));
lastn = NULL;
for (i = 0; i <= tbl->cc; i++) {
-#ifdef WITH_CGRAPH
t = agnode(colg, nToName(i), 1);
agbindrec(t, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#else
- t = agnode(colg, nToName(i));
-#endif
alloc_elist(tbl->rc, ND_in(t));
alloc_elist(tbl->rc, ND_out(t));
if (lastn) {
}
lastn = NULL;
for (i = 0; i <= tbl->rc; i++) {
-#ifdef WITH_CGRAPH
t = agnode(rowg, nToName(i), 1);
agbindrec(t, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#else
- t = agnode(rowg, nToName(i));
-#endif
alloc_elist(tbl->cc, ND_in(t));
alloc_elist(tbl->cc, ND_out(t));
if (lastn) {
tbl->heights = N_NEW(tbl->rc + 1, int);
tbl->widths = N_NEW(tbl->cc + 1, int);
-#ifdef WITH_CGRAPH
rowg = agopen("rowg", dir, NIL(Agdisc_t *));
colg = agopen("colg", dir, NIL(Agdisc_t *));
/* Only need GD_nlist */
agbindrec(rowg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); // graph custom data
agbindrec(colg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); // graph custom data
-#else
- rowg = agopen("rowg", AGDIGRAPH);
- colg = agopen("colg", AGDIGRAPH);
-#endif
makeGraphs(tbl, rowg, colg);
rank(rowg, 2, INT_MAX);
rank(colg, 2, INT_MAX);
{
Agedge_t *ep;
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
-#else
case AGRAPH:
-#endif
agxbput(xb, agnameof(((Agraph_t *) obj)));
break;
case AGNODE:
env.obj = obj;
switch (agobjkind(obj)) {
-#ifdef WITH_CGRAPH
case AGRAPH:
-#else
- case AGGRAPH:
-#endif
env.g = ((Agraph_t *) obj)->root;
break;
case AGNODE:
gvc->common.lib = Lib;
}
-#ifdef WITH_CGRAPH
static void global_def(agxbuf* xb, char *dcl, int kind,
attrsym_t * ((*dclfun) (Agraph_t *, int kind, char *, char *)) )
{
sym = dclfun(NULL, kind, agxbuse (xb), rhs);
sym->fixed = 1;
}
-#else
-static void global_def(agxbuf* xb, char *dcl,
- attrsym_t * ((*dclfun) (Agraph_t *, char *, char *)))
-{
- char *p;
- char *rhs = "true";
-
- attrsym_t *sym;
- if ((p = strchr(dcl, '='))) {
- agxbput_n (xb, dcl, p-dcl);
- rhs = p+1;
- }
- else
- agxbput (xb, dcl);
- sym = dclfun(NULL, agxbuse (xb), rhs);
- sym->fixed = 1;
-}
-#endif
static int gvg_init(GVC_t *gvc, graph_t *g, char *fn, int gidx)
{
Verbose = gvc->common.verbose;
CmdName = gvc->common.cmdname;
-#ifndef WITH_CGRAPH
- aginit();
-#endif
nfiles = 0;
for (i = 1; i < argc; i++)
if (argv[i] && argv[i][0] != '-')
switch (c = argv[i][1]) {
case 'G':
if (*rest)
-#ifdef WITH_CGRAPH
global_def(&xb, rest, AGRAPH, agattr);
-#else
- global_def(&xb, rest, agraphattr);
-#endif
else {
fprintf(stderr, "Missing argument for -G flag\n");
return (dotneato_usage(1));
break;
case 'N':
if (*rest)
-#ifdef WITH_CGRAPH
global_def(&xb, rest, AGNODE,agattr);
-#else
- global_def(&xb, rest, agnodeattr);
-#endif
else {
fprintf(stderr, "Missing argument for -N flag\n");
return (dotneato_usage(1));
break;
case 'E':
if (*rest)
-#ifdef WITH_CGRAPH
global_def(&xb, rest, AGEDGE,agattr);
-#else
- global_def(&xb, rest, agedgeattr);
-#endif
else {
fprintf(stderr, "Missing argument for -E flag\n");
return (dotneato_usage(1));
}
/* set persistent attributes here (if not already set from command line options) */
-#ifdef WITH_CGRAPH
if (!agattr(NULL, AGNODE, "label", 0))
agattr(NULL, AGNODE, "label", NODENAME_ESC);
-#else
- if (!(agfindnodeattr(agprotograph(), "label")))
- agnodeattr(NULL, "label", NODENAME_ESC);
-#endif
return 0;
}
#ifdef EXPERIMENTAL_MYFGETS
g = agread_usergets(fp, myfgets);
#else
-#ifdef WITH_CGRAPH
g = agread(fp,NIL(Agdisc_t*));
-#else
- g = agread(fp);
-#endif
#endif
if (g) {
gvg_init(gvc, g, fn, gidx++);
N_fontcolor = agfindnodeattr(g, "fontcolor");
N_label = agfindnodeattr(g, "label");
if (!N_label)
-#ifdef WITH_CGRAPH
N_label = agattr(g, AGNODE, "label", NODENAME_ESC);
-#else
- N_label = agnodeattr(g, "label", NODENAME_ESC);
-#endif
N_xlabel = agfindnodeattr(g, "xlabel");
N_showboxes = agfindnodeattr(g, "showboxes");
N_penwidth = agfindnodeattr(g, "penwidth");
free(GD_drawing(g));
GD_drawing(g) = NULL;
free_label(GD_label(g));
-#ifdef WITH_CGRAPH
//FIX HERE , STILL SHALLOW
//memset(&(g->u), 0, sizeof(Agraphinfo_t));
agclean(g, AGRAPH,"Agraphinfo_t");
-#else
- memset(&(g->u), 0, sizeof(Agraphinfo_t));
-#endif
}
/* charsetToStr:
char *s;
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
-#else
case AGRAPH:
-#endif
sg = (graph_t*)obj;
g = sg->root;
break;
rv->html = TRUE;
if (make_html_label(obj, rv)) {
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
-#else
case AGRAPH:
-#endif
agerr(AGPREV, "in label of graph %s\n",agnameof(sg));
break;
case AGNODE:
/* prepare substitution strings */
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
-#else
case AGRAPH:
-#endif
g_str = agnameof((graph_t *)obj);
g_len = strlen(g_str);
tl = GD_label((graph_t *)obj);
return YDIR(y);
}
-#ifdef WITH_CGRAPH
static int (*putstr) (void *chan, const char *str);
static void agputs (const char* s, FILE* fp)
putstr ((void*)fp, buf);
}
-#endif
static void printstring(FILE * f, char *prefix, char *s)
{
*/
static char* canon (graph_t *g, char* s)
{
-#ifndef WITH_CGRAPH
- char* ns = agstrdup (s);
- char* cs = agcanonStr (ns);
- agstrfree (ns);
-#else
char* ns = agstrdup (g, s);
char* cs = agcanonStr (ns);
agstrfree (g, ns);
-#endif
return cs;
}
char *lbl;
char* fillcolor;
-#ifdef WITH_CGRAPH
putstr = g->clos->disc.io->putstr;
-#endif
// setup_graph(job, g);
setYInvert(g);
pt = GD_bb(g).UR;
printstring(f, "node ", agcanonStr(agnameof(n)));
printpoint(f, ND_coord(n));
if (ND_label(n)->html) /* if html, get original text */
-#ifndef WITH_CGRAPH
- lbl = agcanonStr (agxget(n, N_label->index));
-#else
lbl = agcanonStr (agxget(n, N_label));
-#endif
else
lbl = canon(agraphof(n),ND_label(n)->text);
printdouble(f, " ", ND_width(n));
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-#ifndef WITH_CGRAPH
-/* FIXME - there must be a proper way to get port info - these are
- * supposed to be private to libgraph - from libgraph.h */
-#define TAILX 1
-#define HEADX 2
-
- if (extend && e->attr) {
- tport = e->attr[TAILX];
- hport = e->attr[HEADX];
- }
-#else /* WITH_CGRAPH */
if (extend) { //assuming these two attrs have already been created by cgraph
if (!(tport = agget(e,"tailport")))
tport = "";
if (!(hport = agget(e,"headport")))
hport = "";
}
-#endif /* WITH_CGRAPH */
else
tport = hport = "";
if (ED_spl(e)) {
sprintf(buf, "%.5g,%.5g,%.5g,%.5g", GD_bb(g).LL.x, YDIR(GD_bb(g).LL.y),
GD_bb(g).UR.x, YDIR(GD_bb(g).UR.y));
-#ifndef WITH_CGRAPH
- agxset(g, bbsym->index, buf);
-#else
agxset(g, bbsym, buf);
-#endif
if (GD_label(g) && GD_label(g)->text[0]) {
pt = GD_label(g)->pos;
sprintf(buf, "%.5g,%.5g", pt.x, YDIR(pt.y));
e_arrows = s_arrows = 0;
setYInvert(g);
agxbinit(&xb, BUFSIZ, xbuffer);
-#ifndef WITH_CGRAPH
- safe_dcl(g, g->proto->n, "pos", "", agnodeattr);
- safe_dcl(g, g->proto->n, "rects", "", agnodeattr);
- N_width = safe_dcl(g, g->proto->n, "width", "", agnodeattr);
- N_height = safe_dcl(g, g->proto->n, "height", "", agnodeattr);
- safe_dcl(g, g->proto->e, "pos", "", agedgeattr);
- if (GD_has_labels(g) & NODE_XLABEL)
- safe_dcl(g, g->proto->n, "xlp", "", agnodeattr);
- if (GD_has_labels(g) & EDGE_LABEL)
- safe_dcl(g, g->proto->e, "lp", "", agedgeattr);
- if (GD_has_labels(g) & EDGE_XLABEL)
- safe_dcl(g, g->proto->e, "xlp", "", agedgeattr);
- if (GD_has_labels(g) & HEAD_LABEL)
- safe_dcl(g, g->proto->e, "head_lp", "", agedgeattr);
- if (GD_has_labels(g) & TAIL_LABEL)
- safe_dcl(g, g->proto->e, "tail_lp", "", agedgeattr);
- if (GD_label(g)) {
- safe_dcl(g, g, "lp", "", agraphattr);
- safe_dcl(g, g, "lwidth", "", agraphattr);
- safe_dcl(g, g, "lheight", "", agraphattr);
- if (GD_label(g)->text[0]) {
- ptf = GD_label(g)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
- agset(g, "lp", buf);
- ptf = GD_label(g)->dimen;
- sprintf(buf, "%.2f", PS2INCH(ptf.x));
- agset(g, "lwidth", buf);
- sprintf(buf, "%.2f", PS2INCH(ptf.y));
- agset(g, "lheight", buf);
- }
- }
- bbsym = safe_dcl(g, g, "bb", "", agraphattr);
-#else
safe_dcl(g, AGNODE, "pos", "");
safe_dcl(g, AGNODE, "rects", "");
N_width = safe_dcl(g, AGNODE, "width", "");
}
}
bbsym = safe_dcl(g, AGRAPH, "bb", "");
-#endif
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (dim3) {
int k;
agset(n, "pos", buf);
}
sprintf(buf, "%.5g", PS2INCH(ND_ht(n)));
-#ifndef WITH_CGRAPH
- agxset(n, N_height->index, buf);
- sprintf(buf, "%.5g", PS2INCH(ND_lw(n) + ND_rw(n)));
- agxset(n, N_width->index, buf);
-#else
agxset(n, N_height, buf);
sprintf(buf, "%.5g", PS2INCH(ND_lw(n) + ND_rw(n)));
agxset(n, N_width, buf);
-#endif
if (ND_xlabel(n) && ND_xlabel(n)->set) {
ptf = ND_xlabel(n)->pos;
sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
YFDIR(ND_height(n) / 2.0 * sin(i / (double) sides * M_PI * 2.0)));
agxbput(&xb, buf);
}
-#ifndef WITH_CGRAPH
- agxset(n, N_vertices->index, agxbuse(&xb));
-#else /* WITH_CGRAPH */
agxset(n, N_vertices, agxbuse(&xb));
-#endif /* WITH_CGRAPH */
}
}
if (State >= GVSPLINES) {
if ((pstyle = checkStyle(n, &istyle)))
gvrender_set_style(job, pstyle);
-#ifndef WITH_CGRAPH
- if (N_penwidth && ((s = agxget(n, N_penwidth->index)) && s[0])) {
-#else
if (N_penwidth && ((s = agxget(n, N_penwidth)) && s[0])) {
-#endif
penwidth = late_double(n, N_penwidth, 1.0, 0.0);
gvrender_set_penwidth(job, penwidth);
}
makePortLabels(e);
}
-#ifndef WITH_CGRAPH
-#define AGXGET(o,a) agxget(o,a->index)
-#else /* WITH_CGRAPH */
#define AGXGET(o,a) agxget(o,a)
-#endif /* WITH_CGRAPH */
/* vladimir */
/* place_portlabel:
typedef int (*qsort_cmpf) (const void *, const void *);
typedef int (*bsearch_cmpf) (const void *, const void *);
-#ifdef WITH_CGRAPH
#include <cgraph.h>
typedef struct Agraph_s graph_t;
typedef struct Agnode_s node_t;
typedef struct Agsym_s attrsym_t;
#define TAIL_ID "tailport"
#define HEAD_ID "headport"
-#else
- typedef struct Agraph_t graph_t;
- typedef struct Agnode_t node_t;
- typedef struct Agedge_t edge_t;
- typedef struct Agsym_t attrsym_t;
-#endif
typedef struct htmllabel_t htmllabel_t;
typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
typedef struct Agraphinfo_t {
-#ifdef WITH_CGRAPH
Agrec_t hdr;
-#endif
/* to generate code */
layout_t *drawing;
textlabel_t *label; /* if the cluster has a title */
node_t *nlist;
rank_t *rank;
graph_t *parent; /* containing cluster (not parent subgraph) */
-#ifdef WITH_CGRAPH
int level; /* cluster nesting level (not node level!) */
node_t *minrep, *maxrep; /* set leaders for min and max rank */
-#endif
/* fast graph node list */
nlist_t comp;
/* various flags */
boolean has_flat_edges;
-#ifdef WITH_CGRAPH
boolean has_sourcerank;
boolean has_sinkrank;
-#endif
unsigned char showboxes;
fontname_kind fontnames; /* to override mangling in SVG */
} Agraphinfo_t;
-#ifdef WITH_CGRAPH
#define GD_parent(g) (((Agraphinfo_t*)AGDATA(g))->parent)
#define GD_level(g) (((Agraphinfo_t*)AGDATA(g))->level)
#define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing)
#define GD_sum_t(g) (((Agraphinfo_t*)AGDATA(g))->sum_t)
#define GD_t(g) (((Agraphinfo_t*)AGDATA(g))->t)
-#else
-
-#define GD_alg(g) (g)->u.alg
-#define GD_bb(g) (g)->u.bb
-#define GD_border(g) (g)->u.border
-#define GD_cl_cnt(g) (g)->u.cl_cnt
-#define GD_cleanup(g) (g)->u.cleanup
-#define GD_clust(g) (g)->u.clust
-#define GD_comp(g) (g)->u.comp
-#define GD_dist(g) (g)->u.dist
-#define GD_drawing(g) (g)->u.drawing
-#define GD_exact_ranksep(g) (g)->u.exact_ranksep
-#define GD_expanded(g) (g)->u.expanded
-#define GD_flags(g) (g)->u.flags
-#define GD_gui_state(g) (g)->u.gui_state
-#define GD_gvc(g) (g)->u.gvc
-#define GD_charset(g) (g)->u.charset
-#define GD_has_labels(g) (g)->u.has_labels
-#define GD_has_images(g) (g)->u.has_images
-#define GD_has_flat_edges(g) (g)->u.has_flat_edges
-#define GD_ht1(g) (g)->u.ht1
-#define GD_ht2(g) (g)->u.ht2
-#define GD_inleaf(g) (g)->u.inleaf
-#define GD_installed(g) (g)->u.installed
-#define GD_label(g) (g)->u.label
-#define GD_leader(g) (g)->u.leader
-#define GD_parent(g) (g)->u.parent
-#define GD_rankdir(g) ((g)->u.rankdir & 0x3)
-#define GD_flip(g) (GD_rankdir(g) & 1)
-#define GD_realrankdir(g) ((g)->u.rankdir >> 2)
-#define GD_realflip(g) (GD_realrankdir(g) & 1)
-#define GD_ln(g) (g)->u.ln
-#define GD_maxrank(g) (g)->u.maxrank
-#define GD_maxset(g) (g)->u.maxset
-#define GD_minrank(g) (g)->u.minrank
-#define GD_minset(g) (g)->u.minset
-#define GD_move(g) (g)->u.move
-#define GD_n_cluster(g) (g)->u.n_cluster
-#define GD_n_nodes(g) (g)->u.n_nodes
-#define GD_ndim(g) (g)->u.ndim
-#define GD_odim(g) (g)->u.odim
-#define GD_neato_nlist(g) (g)->u.neato_nlist
-#define GD_nlist(g) (g)->u.nlist
-#define GD_nodesep(g) (g)->u.nodesep
-#define GD_outleaf(g) (g)->u.outleaf
-#define GD_rank(g) (g)->u.rank
-#define GD_rankleader(g) (g)->u.rankleader
-#define GD_ranksep(g) (g)->u.ranksep
-#define GD_rn(g) (g)->u.rn
-#define GD_set_type(g) (g)->u.set_type
-#define GD_label_pos(g) (g)->u.label_pos
-#define GD_showboxes(g) (g)->u.showboxes
-#define GD_fontnames(g) (g)->u.fontnames
-#define GD_spring(g) (g)->u.spring
-#define GD_sum_t(g) (g)->u.sum_t
-#define GD_t(g) (g)->u.t
-#endif
-
typedef struct Agnodeinfo_t {
-#ifdef WITH_CGRAPH
Agrec_t hdr;
-#endif
shape_desc *shape;
void *shape_info;
pointf coord;
#ifndef NEATO_ONLY
unsigned char showboxes;
boolean has_port;
-#ifdef WITH_CGRAPH
node_t* rep;
node_t *set;
-#endif
/* fast graph */
char node_type, mark, onstack;
} Agnodeinfo_t;
-#ifdef WITH_CGRAPH
#define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id)
#define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg)
#define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent)
#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
#define ND_ysize(n) (ND_ht(n))
-#else
-
-#define ND_UF_parent(n) (n)->u.UF_parent
-#define ND_UF_size(n) (n)->u.UF_size
-#define ND_alg(n) (n)->u.alg
-#define ND_bb(n) (n)->u.bb
-#define ND_clust(n) (n)->u.clust
-#define ND_coord(n) (n)->u.coord
-#define ND_dist(n) (n)->u.dist
-#define ND_flat_in(n) (n)->u.flat_in
-#define ND_flat_out(n) (n)->u.flat_out
-#define ND_gui_state(n) (n)->u.gui_state
-#define ND_has_port(n) (n)->u.has_port
-#define ND_heapindex(n) (n)->u.heapindex
-#define ND_height(n) (n)->u.height
-#define ND_hops(n) (n)->u.hops
-#define ND_ht(n) (n)->u.ht
-#define ND_id(n) (n)->u.id
-#define ND_in(n) (n)->u.in
-#define ND_inleaf(n) (n)->u.inleaf
-#define ND_label(n) (n)->u.label
-#define ND_xlabel(n) (n)->u.xlabel
-#define ND_lim(n) (n)->u.lim
-#define ND_low(n) (n)->u.low
-#define ND_lw(n) (n)->u.lw
-#define ND_mark(n) (n)->u.mark
-#define ND_mval(n) (n)->u.mval
-#define ND_n_cluster(n) (n)->u.n_cluster
-#define ND_next(n) (n)->u.next
-#define ND_node_type(n) (n)->u.node_type
-#define ND_onstack(n) (n)->u.onstack
-#define ND_order(n) (n)->u.order
-#define ND_other(n) (n)->u.other
-#define ND_out(n) (n)->u.out
-#define ND_outleaf(n) (n)->u.outleaf
-#define ND_par(n) (n)->u.par
-#define ND_pinned(n) (n)->u.pinned
-#define ND_pos(n) (n)->u.pos
-#define ND_prev(n) (n)->u.prev
-#define ND_priority(n) (n)->u.priority
-#define ND_rank(n) (n)->u.rank
-#define ND_ranktype(n) (n)->u.ranktype
-#define ND_rw(n) (n)->u.rw
-#define ND_save_in(n) (n)->u.save_in
-#define ND_save_out(n) (n)->u.save_out
-#define ND_shape(n) (n)->u.shape
-#define ND_shape_info(n) (n)->u.shape_info
-#define ND_showboxes(n) (n)->u.showboxes
-#define ND_state(n) (n)->u.state
-#define ND_clustnode(n) (n)->u.clustnode
-#define ND_tree_in(n) (n)->u.tree_in
-#define ND_tree_out(n) (n)->u.tree_out
-#define ND_weight_class(n) (n)->u.weight_class
-#define ND_width(n) (n)->u.width
-#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
-#define ND_ysize(n) (ND_ht(n))
-#endif
-
typedef struct Agedgeinfo_t {
-#ifdef WITH_CGRAPH
Agrec_t hdr;
-#endif
splines *spl;
port tail_port, head_port;
textlabel_t *label, *head_label, *tail_label, *xlabel;
#endif
} Agedgeinfo_t;
-#ifdef WITH_CGRAPH
#define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg)
#define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag)
#define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count)
#define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist)
#define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
-#else
-
-#define ED_alg(e) (e)->u.alg
-#define ED_conc_opp_flag(e) (e)->u.conc_opp_flag
-#define ED_count(e) (e)->u.count
-#define ED_cutvalue(e) (e)->u.cutvalue
-#define ED_dist(e) (e)->u.dist
-#define ED_edge_type(e) (e)->u.edge_type
-#define ED_adjacent(e) (e)->u.adjacent
-#define ED_factor(e) (e)->u.factor
-#define ED_gui_state(e) (e)->u.gui_state
-#define ED_head_label(e) (e)->u.head_label
-#define ED_head_port(e) (e)->u.head_port
-#define ED_label(e) (e)->u.label
-#define ED_xlabel(e) (e)->u.xlabel
-#define ED_label_ontop(e) (e)->u.label_ontop
-#define ED_minlen(e) (e)->u.minlen
-#define ED_path(e) (e)->u.path
-#define ED_showboxes(e) (e)->u.showboxes
-#define ED_spl(e) (e)->u.spl
-#define ED_tail_label(e) (e)->u.tail_label
-#define ED_tail_port(e) (e)->u.tail_port
-#define ED_to_orig(e) (e)->u.to_orig
-#define ED_to_virt(e) (e)->u.to_virt
-#define ED_tree_index(e) (e)->u.tree_index
-#define ED_weight(e) (e)->u.weight
-#define ED_xpenalty(e) (e)->u.xpenalty
-#endif
-
-#ifdef WITH_CGRAPH
#include "cgraph.h"
#define ag_xget(x,a) agxget(x,a)
#define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd)
#define agfindgraphattr(g,a) (agattr(g,AGRAPH,a,NULL))
#define agfindnodeattr(g,a) (agattr(g,AGNODE,a,NULL))
#define agfindedgeattr(g,a) (agattr(g,AGEDGE,a,NULL))
-#else
-#include "graph.h"
-#define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd))
-#define ag_xget(x,a) agxget(x,(a)->index)
-#define agnameof(x) ((x)->name)
- /* warning, agraphof doesn't work for edges */
-#define agraphof(n) ((n)->graph)
-#define agroot(g) ((g)->root)
-#define aghead(e) ((e)->head)
-#define agtail(e) ((e)->tail)
-#define agisdirected(g) ((g)->kind & AGFLAG_DIRECTED)
-#define AGSEQ(x) ((x)->id)
-#define agfindgraphattr(g,a) agfindattr((g)->root,a)
-#define agfindnodeattr(g,a) agfindattr((g)->proto->n,a)
-#define agfindedgeattr(g,a) agfindattr((g)->proto->e,a)
-#define agcanonStr(s) agcanonical(s)
-#endif
typedef struct {
int flags;
{
if (!attr || !obj)
return def;
-#ifndef WITH_CGRAPH
- return agxget(obj, attr->index);
-#else /* WITH_CGRAPH */
return agxget(obj, attr);
-#endif /* WITH_CGRAPH */
}
char *late_nnstring(void *obj, attrsym_t * attr, char *def)
{
if (attr == NULL)
return def;
-#ifndef WITH_CGRAPH
- return mapbool(agxget(obj, attr->index));
-#else /* WITH_CGRAPH */
return mapbool(agxget(obj, attr));
-#endif /* WITH_CGRAPH */
}
/* union-find */
node_t *UF_find(node_t * n)
{
while (ND_UF_parent(n) && (ND_UF_parent(n) != n)) {
-#ifndef WITH_CGRAPH
- if (ND_UF_parent(n)->u.UF_parent)
- ND_UF_parent(n) = ND_UF_parent(n)->u.UF_parent;
-#else /* WITH_CGRAPH */
if (ND_UF_parent(ND_UF_parent(n)))
ND_UF_parent(n) = ND_UF_parent(ND_UF_parent(n));
-#endif /* WITH_CGRAPH */
n = ND_UF_parent(n);
}
return n;
ND_UF_size(v) = 1;
} else
v = UF_find(v);
-#ifndef WITH_CGRAPH
- if (u->id > v->id) {
-#else /* WITH_CGRAPH */
if (ND_id(u) > ND_id(v)) {
-#endif /* WITH_CGRAPH */
ND_UF_parent(u) = v;
ND_UF_size(v) += ND_UF_size(u);
} else {
else
return NULL;
}
-#ifdef WITH_CGRAPH
Agraphinfo_t* GD_info(g) { return ((Agraphinfo_t*)AGDATA(g));}
Agnodeinfo_t* ND_info(n) { return ((Agnodeinfo_t*)AGDATA(n));}
#endif
-#endif
#if !defined(MSWIN32) && !defined(WIN32)
#include <pwd.h>
late_double(n, N_height, DEFAULT_NODEHEIGHT, MIN_NODEHEIGHT);
ND_shape(n) =
bind_shape(late_nnstring(n, N_shape, DEFAULT_NODESHAPE), n);
-#ifndef WITH_CGRAPH
- str = agxget(n, N_label->index);
-#else
str = agxget(n, N_label);
-#endif
fi.fontsize = late_double(n, N_fontsize, DEFAULT_FONTSIZE, MIN_FONTSIZE);
fi.fontname = late_nnstring(n, N_fontname, DEFAULT_FONTNAME);
fi.fontcolor = late_nnstring(n, N_fontcolor, DEFAULT_COLOR);
ND_label(n) = make_label((void*)n, str,
((aghtmlstr(str) ? LT_HTML : LT_NONE) | ( (shapeOf(n) == SH_RECORD) ? LT_RECD : LT_NONE)),
fi.fontsize, fi.fontname, fi.fontcolor);
-#ifndef WITH_CGRAPH
- if (N_xlabel && (str = agxget(n, N_xlabel->index)) && (str[0])) {
-#else
if (N_xlabel && (str = agxget(n, N_xlabel)) && (str[0])) {
-#endif
ND_xlabel(n) = make_label((void*)n, str, (aghtmlstr(str) ? LT_HTML : LT_NONE),
fi.fontsize, fi.fontname, fi.fontcolor);
GD_has_labels(agraphof(n)) |= NODE_XLABEL;
boolean rv = FALSE;
if (sym) { /* mapbool isn't a good fit, because we want "" to mean true */
-#ifndef WITH_CGRAPH
- str = agxget(e,sym->index);
-#else /* WITH_CGRAPH */
str = agxget(e,sym);
-#endif /* WITH_CGRAPH */
if (str && str[0]) rv = !mapbool(str);
else rv = FALSE;
}
chkPort (port (*pf)(node_t*, char*, char*), node_t* n, char* s)
{
port pt;
-#ifndef WITH_CGRAPH
- char* cp = strchr(s,':');
-
-#else /* WITH_CGRAPH */
char* cp=NULL;
if(s)
cp= strchr(s,':');
-#endif /* WITH_CGRAPH */
if (cp) {
*cp = '\0';
pt = pf(n, s, cp+1);
fi.fontname = NULL;
lfi.fontname = NULL;
-#ifndef WITH_CGRAPH
- if (E_label && (str = agxget(e, E_label->index)) && (str[0])) {
-#else
if (E_label && (str = agxget(e, E_label)) && (str[0])) {
-#endif
r = 1;
initFontEdgeAttr(e, &fi);
ED_label(e) = make_label((void*)e, str, (aghtmlstr(str) ? LT_HTML : LT_NONE),
mapbool(late_string(e, E_label_float, "false"));
}
-#ifndef WITH_CGRAPH
- if (E_xlabel && (str = agxget(e, E_xlabel->index)) && (str[0])) {
-#else
if (E_xlabel && (str = agxget(e, E_xlabel)) && (str[0])) {
-#endif
if (!fi.fontname)
initFontEdgeAttr(e, &fi);
ED_xlabel(e) = make_label((void*)e, str, (aghtmlstr(str) ? LT_HTML : LT_NONE),
/* vladimir */
-#ifndef WITH_CGRAPH
- if (E_headlabel && (str = agxget(e, E_headlabel->index)) && (str[0])) {
-#else
if (E_headlabel && (str = agxget(e, E_headlabel)) && (str[0])) {
-#endif
initFontLabelEdgeAttr(e, &fi, &lfi);
ED_head_label(e) = make_label((void*)e, str, (aghtmlstr(str) ? LT_HTML : LT_NONE),
lfi.fontsize, lfi.fontname, lfi.fontcolor);
GD_has_labels(sg) |= HEAD_LABEL;
}
-#ifndef WITH_CGRAPH
- if (E_taillabel && (str = agxget(e, E_taillabel->index)) && (str[0])) {
-#else
if (E_taillabel && (str = agxget(e, E_taillabel)) && (str[0])) {
-#endif
if (!lfi.fontname)
initFontLabelEdgeAttr(e, &fi, &lfi);
ED_tail_label(e) = make_label((void*)e, str, (aghtmlstr(str) ? LT_HTML : LT_NONE),
* tailport = "abc".
*/
str = agget(e, TAIL_ID);
-#ifdef WITH_CGRAPH
/* libgraph always defines tailport/headport; libcgraph doesn't */
if (!str) str = "";
-#endif
if (str && str[0])
ND_has_port(agtail(e)) = TRUE;
ED_tail_port(e) = chkPort (ND_shape(agtail(e))->fns->portfn, agtail(e), str);
if (noClip(e, E_tailclip))
ED_tail_port(e).clip = FALSE;
str = agget(e, HEAD_ID);
-#ifdef WITH_CGRAPH
/* libgraph always defines tailport/headport; libcgraph doesn't */
if (!str) str = "";
-#endif
if (str && str[0])
ND_has_port(aghead(e)) = TRUE;
ED_head_port(e) = chkPort(ND_shape(aghead(e))->fns->portfn, aghead(e), str);
if (ED_spl(e) == 0)
continue;
for (i = 0; i < ED_spl(e)->size; i++) {
-#ifndef WITH_CGRAPH
- for (j = 0; j < ED_spl(e)->list[i].size; j++) {
-#else
for (j = 0; j < (((Agedgeinfo_t*)AGDATA(e))->spl)->list[i].size; j++) {
-#endif
ptf = ED_spl(e)->list[i].list[j];
EXPANDBP(bb,ptf);
}
{
if (ap == NULL) {
switch (agobjkind(obj)) {
-#ifndef WITH_CGRAPH
- case AGGRAPH:
- ap = agraphattr(g, name, "");
-#else /* WITH_CGRAPH */
case AGRAPH:
ap = agattr(g, AGRAPH,name, "");
-#endif /* WITH_CGRAPH */
break;
case AGNODE:
-#ifndef WITH_CGRAPH
- ap = agnodeattr(g, name, "");
-#else /* WITH_CGRAPH */
ap = agattr(g,AGNODE, name, "");
-#endif /* WITH_CGRAPH */
break;
case AGEDGE:
-#ifndef WITH_CGRAPH
- ap = agedgeattr(g, name, "");
-#else /* WITH_CGRAPH */
ap = agattr(g,AGEDGE, name, "");
-#endif /* WITH_CGRAPH */
break;
}
}
-#ifndef WITH_CGRAPH
- agxset(obj, ap->index, value);
-#else /* WITH_CGRAPH */
agxset(obj, ap, value);
-#endif /* WITH_CGRAPH */
return ap;
}
agxbputc(xb, ':');
agxbput(xb, agnameof(cg));
-#ifndef WITH_CGRAPH
- cn = agnode(agroot(cg), agxbuse(xb));
-#else
cn = agnode(agroot(cg), agxbuse(xb), 1);
agbindrec(cn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
SET_CLUST_NODE(cn);
-#ifndef WITH_CGRAPH
- aginsert(cg, cn);
- aginsert(clg, n);
-#else /* WITH_CGRAPH */
agsubnode(cg,cn,1);
//aginsert(cg, cn);
agsubnode(clg,n,1);
//aginsert(clg, n);
-#endif /* WITH_CGRAPH */
/* set attributes */
N_label = setAttr(agraphof(cn), cn, "label", "", N_label);
static edge_t *cloneEdge(edge_t * e, node_t * ct, node_t * ch)
{
graph_t *g = agraphof(ct);
-#ifndef WITH_CGRAPH
- edge_t *ce = agedge(g, ct, ch);
-#else /* WITH_CGRAPH */
edge_t *ce = agedge(g, ct, ch,NULL,1);
agbindrec(ce, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
agcopyattr(e, ce);
return ce;
* so we could use a simpler model in which we create a single cluster
* node for each cluster used in a cluster edge.
*/
-#ifndef WITH_CGRAPH
-#define MAPC(n) (strncmp((n)->name,"cluster",7)?NULL:agfindsubg((n)->graph, (n)->name))
-#else /* WITH_CGRAPH */
#define MAPC(n) (strncmp(agnameof(n),"cluster",7)?NULL:findCluster(cmap,agnameof(n)))
-#endif /* WITH_CGRAPH */
-#ifdef WITH_CGRAPH
static void
checkCompound(edge_t * e, graph_t * clg, agxbuf * xb, Dt_t * map, Dt_t* cmap)
-#else
-static void
-checkCompound(edge_t * e, graph_t * clg, agxbuf * xb, Dt_t * map)
-#endif
{
graph_t *tg;
graph_t *hg;
graph_t *clg;
agxbuf xb;
Dt_t *map;
-#ifdef WITH_CGRAPH
Dt_t *cmap = mkClustMap (g);
-#endif
unsigned char buf[SMALLBUF];
map = dtopen(&mapDisc, Dtoset);
-#ifndef WITH_CGRAPH
- clg = agsubg(g, "__clusternodes");
-#else /* WITH_CGRAPH */
clg = agsubg(g, "__clusternodes",1);
agbindrec(clg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
agxbinit(&xb, SMALLBUF, buf);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (IS_CLUST_NODE(n)) continue;
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-#ifndef WITH_CGRAPH
- checkCompound(e, clg, &xb, map);
-#else
checkCompound(e, clg, &xb, map, cmap);
-#endif
}
}
agxbfree(&xb);
agclose(clg);
if (rv)
SET_CLUST_EDGE(g);
-#ifdef WITH_CGRAPH
dtclose(cmap);
-#endif
return rv;
}
*/
static node_t *mapN(node_t * n, graph_t * clg)
{
-#ifndef WITH_CGRAPH
- extern Agdict_t *agdictof(void *);
- Agdict_t *d;
- Agsym_t **list;
-#endif /* WITH_CGRAPH */
node_t *nn;
char *name;
graph_t *g = agraphof(n);
if (!(IS_CLUST_NODE(n)))
return n;
-#ifndef WITH_CGRAPH
- aginsert(clg, n);
-#else /* WITH_CGRAPH */
agsubnode(clg, n, 1);
-#endif /* WITH_CGRAPH */
name = strchr(agnameof(n), ':');
assert(name);
name++;
if ((nn = agfindnode(g, name)))
return nn;
-#ifndef WITH_CGRAPH
- nn = agnode(g, name);
-#else /* WITH_CGRAPH */
nn = agnode(g, name, 1);
agbindrec(nn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
/* Set all attributes to default */
-#ifndef WITH_CGRAPH
- d = agdictof(n);
- list = d->list;
- while ((sym = *list++)) {
- /* Can use pointer comparison because of ref strings. */
- if (agxget(nn, sym->index) != sym->value)
- agxset(nn, sym->index, sym->value);
- }
-#else /* WITH_CGRAPH */
for (sym = agnxtattr(g, AGNODE, NULL); sym; (sym = agnxtattr(g, AGNODE, sym))) {
if (agxget(nn, sym) != sym->defval)
agxset(nn, sym, sym->defval);
}
-#endif /* WITH_CGRAPH */
return nn;
}
edge_t *e;
graph_t *clg;
-#ifndef WITH_CGRAPH
- clg = agsubg(g, "__clusternodes");
-#else /* WITH_CGRAPH */
clg = agsubg(g, "__clusternodes",1);
agbindrec(clg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
undoCompound(e, clg);
* with given name. If one does not exist, create it with the
* default value def.
*/
-#ifndef WITH_CGRAPH
-attrsym_t*
-safe_dcl(graph_t * g, void *obj, char *name, char *def,
- attrsym_t * (*fun) (Agraph_t *, char *, char *))
-{
- attrsym_t *a = agfindattr(obj, name);
- if (a == NULL)
- a = fun(g, name, def);
- return a;
-}
-#else /* WITH_CGRAPH */
attrsym_t*
safe_dcl(graph_t * g, int obj_kind, char *name, char *def)
{
a = agattr(g,obj_kind,name,def);
return a;
}
-#endif /* WITH_CGRAPH */
static int comp_entities(const void *e1, const void *e2) {
return strcmp(((struct entities_s *)e1)->name, ((struct entities_s *)e2)->name);
free_label(ED_xlabel(e));
free_label(ED_head_label(e));
free_label(ED_tail_label(e));
-#ifndef WITH_CGRAPH
- memset(&(e->u), 0, sizeof(Agedgeinfo_t));
-#else /* WITH_CGRAPH */
/*FIX HERE , shallow cleaning may not be enough here */
agdelrec(e, "Agedgeinfo_t");
-#endif /* WITH_CGRAPH */
}
void gv_cleanup_node(node_t * n)
ND_shape(n)->fns->freefn(n);
free_label(ND_label(n));
free_label(ND_xlabel(n));
-#ifndef WITH_CGRAPH
- memset(&(n->u), 0, sizeof(Agnodeinfo_t));
-#else /* WITH_CGRAPH */
/*FIX HERE , shallow cleaning may not be enough here */
agdelrec(n, "Agnodeinfo_t");
-#endif /* WITH_CGRAPH */
}
void gv_nodesize(node_t * n, boolean flip)
return d;
}
#endif
-#ifdef WITH_CGRAPH
typedef struct {
Dtlink_t link;
char* name;
else
return NULL;
}
-#endif
-#ifdef WITH_CGRAPH
Agnodeinfo_t* ninf(Agnode_t* n) {return (Agnodeinfo_t*)AGDATA(n);}
Agraphinfo_t* ginf(Agraph_t* g) {return (Agraphinfo_t*)AGDATA(g);}
Agedgeinfo_t* einf(Agedge_t* e) {return (Agedgeinfo_t*)AGDATA(e);}
-#endif
extern void epsf_emit_body(GVJ_t *job, usershape_t *us);
extern void epsf_define(GVJ_t * job);
extern void undoClusterEdges(graph_t * g);
-#ifndef WITH_CGRAPH
- extern attrsym_t* safe_dcl(graph_t*, void*, char*, char*,
- attrsym_t * (*fun) (Agraph_t *, char *, char *));
-#else
extern Dt_t* mkClustMap (Agraph_t* g);
extern Agraph_t* findCluster (Dt_t* map, char* name);
extern attrsym_t* safe_dcl(graph_t * g, int obj_kind, char *name, char *def);
-#endif
extern int late_int(void *, Agsym_t *, int, int);
extern double late_double(void *, Agsym_t *, double, double);
/* from psusershape.c */
extern void cat_libfile(GVJ_t * job, const char **arglib, const char **stdlib);
-#ifdef WITH_CGRAPH
Agnodeinfo_t* ninf(Agnode_t* n);
Agraphinfo_t* ginf(Agraph_t* g);
Agedgeinfo_t* einf(Agedge_t* e);
-#endif
/**/
#ifdef WIN32
extern void fix_fc(void);
break;
}
}
-#ifndef WITH_CGRAPH
- fprintf(Output_file, " (shape\n"
- " (id %d)\n"
- " (layer %d)\n"
- " (type %s)\n", AGID(n) + 1, AGID(n), p->vtxshape);
-#else
fprintf(Output_file, " (shape\n"
" (id %ld)\n"
" (layer %ld)\n"
" (type %s)\n", AGID(n) + 1, AGID(n), p->vtxshape);
-#endif
}
static void vtx_end_node(void)
static void vtx_begin_edge(edge_t * e)
{
-#ifndef WITH_CGRAPH
- fprintf(Output_file, " (connection\n"
- " (id %d)\n"
- " (layer %d)\n"
- " (rotation 0)\n"
- " (textRotation 0)\n"
- " (locked F)\n"
- " (start %d)\n"
- " (end %d)\n",
- AGID(e) + 1, AGID(e), AGID(agtail(e)) + 1, AGID(aghead(e)) + 1);
-#else
fprintf(Output_file, " (connection\n"
" (id %ld)\n"
" (layer %ld)\n"
" (start %ld)\n"
" (end %ld)\n",
AGID(e) + 1, AGID(e), AGID(agtail(e)) + 1, AGID(aghead(e)) + 1);
-#endif
}
static void vtx_end_edge(void)
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/gvc \
-I$(top_srcdir)/lib/ortho \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt \
-I$(top_srcdir)/lib/pathplan
-if WITH_CGRAPH
-noinst_HEADERS = dot.h dotprocs.h aspect.h
-noinst_LTLIBRARIES = libdotgen_C.la
-else
noinst_HEADERS = dot.h dotprocs.h aspect.h
noinst_LTLIBRARIES = libdotgen_C.la
-endif
libdotgen_C_la_LDFLAGS = -no-undefined
libdotgen_C_la_SOURCES = acyclic.c class1.c class2.c cluster.c compound.c \
{
char *constr;
-#ifndef WITH_CGRAPH
- if (E_constr && (constr = agxget(e, E_constr->index))) {
-#else /* WITH_CGRAPH */
if (E_constr && (constr = agxget(e, E_constr))) {
-#endif /* WITH_CGRAPH */
if (constr[0] && mapbool(constr) == FALSE)
return TRUE;
}
else {
/*other_edge(e); */
/* avoid when opp==e in undirected graph */
-#ifndef WITH_CGRAPH
- if ((opp = agfindedge(g, aghead(e), agtail(e))) && (opp != e)) {
-#else
if ((opp = agfindedge(g, aghead(e), agtail(e))) && (aghead(opp) != aghead(e))) {
-#endif /* WITH_CGRAPH */
/* shadows a forward edge */
if (ED_to_virt(opp) == NULL)
make_chain(g, agtail(opp), aghead(opp), opp);
{
node_t *rv;
-#ifndef WITH_CGRAPH
- if ((ND_clust(n) == NULL) || (ND_clust(n)->u.expanded))
-#else /* WITH_CGRAPH */
if ((ND_clust(n) == NULL) || ( GD_expanded(ND_clust(n))) )
-#endif /* WITH_CGRAPH */
rv = n;
else
-#ifndef WITH_CGRAPH
- rv = ND_clust(n)->u.rankleader[ND_rank(n)];
-#else /* WITH_CGRAPH */
rv = GD_rankleader(ND_clust(n))[ND_rank(n)];
-#endif /* WITH_CGRAPH */
return rv;
}
{
int i;
node_t *v, **vlist;
-#ifndef WITH_CGRAPH
- vlist = ND_rank(root)[r].v;
-#else /* WITH_CGRAPH */
vlist = GD_rank(root)[r].v;
-#endif /* WITH_CGRAPH */
if (d <= 0) {
-#ifndef WITH_CGRAPH
- for (i = pos - d + 1; i < ND_rank(root)[r].n; i++) {
-#else /* WITH_CGRAPH */
for (i = pos - d + 1; i < GD_rank(root)[r].n; i++) {
-#endif /* WITH_CGRAPH */
v = vlist[i];
ND_order(v) = i + d - 1;
vlist[ND_order(v)] = v;
}
-#ifndef WITH_CGRAPH
- for (i = ND_rank(root)[r].n + d - 1; i < ND_rank(root)[r].n; i++)
-#else /* WITH_CGRAPH */
for (i = GD_rank(root)[r].n + d - 1; i < GD_rank(root)[r].n; i++)
-#endif /* WITH_CGRAPH */
vlist[i] = NULL;
} else {
/*assert(ND_rank(root)[r].n + d - 1 <= ND_rank(root)[r].an);*/
-#ifndef WITH_CGRAPH
- for (i = ND_rank(root)[r].n - 1; i > pos; i--) {
-#else /* WITH_CGRAPH */
for (i = GD_rank(root)[r].n - 1; i > pos; i--) {
-#endif /* WITH_CGRAPH */
v = vlist[i];
ND_order(v) = i + d - 1;
vlist[ND_order(v)] = v;
for (i = pos + 1; i < pos + d; i++)
vlist[i] = NULL;
}
-#ifndef WITH_CGRAPH
- ND_rank(root)[r].n += d - 1;
-#else /* WITH_CGRAPH */
GD_rank(root)[r].n += d - 1;
-#endif /* WITH_CGRAPH */
}
static node_t*
if (agcontains(subg, e))
continue;
-#ifdef WITH_CGRAPH
- /* canonicalize edge */
+ /* canonicalize edge */
e = AGMKOUT(e);
-#endif
/* short/flat multi edges */
if (mergeable(prev, e)) {
if (ND_rank(agtail(e)) == ND_rank(aghead(e)))
continue;
}
-/* This assertion is still valid if the new ranking is not used */
-#ifndef WITH_CGRAPH
- assert(ED_to_virt(e) != NULL);
-#endif
-
/* forward edges */
if (ND_rank(aghead(e)) > ND_rank(agtail(e))) {
make_interclust_chain(g, agtail(e), aghead(e), e);
root = agroot(subg);
if (GD_minrank(subg) > 0)
-#ifndef WITH_CGRAPH
- ND_rank(root)[GD_minrank(subg) - 1].valid = FALSE;
-#else /* WITH_CGRAPH */
GD_rank(root)[GD_minrank(subg) - 1].valid = FALSE;
-#endif /* WITH_CGRAPH */
for (r = GD_minrank(subg); r <= GD_maxrank(subg); r++) {
d = GD_rank(subg)[r].n;
-#ifndef WITH_CGRAPH
- ipos = pos = GD_rankleader(subg)[r]->u.order;
-#else /* WITH_CGRAPH */
ipos = pos = ND_order(GD_rankleader(subg)[r]);
-#endif /* WITH_CGRAPH */
make_slots(root, r, pos, d);
for (i = 0; i < GD_rank(subg)[r].n; i++) {
-#ifndef WITH_CGRAPH
- v = ND_rank(root)[r].v[pos] = GD_rank(subg)[r].v[i];
-#else /* WITH_CGRAPH */
v = GD_rank(root)[r].v[pos] = GD_rank(subg)[r].v[i];
-#endif /* WITH_CGRAPH */
ND_order(v) = pos++;
-#ifndef WITH_CGRAPH
- v->graph = subg->root;
-#else /* WITH_CGRAPH */
/* real nodes automatically have v->root = root graph */
if (ND_node_type(v) == VIRTUAL)
v->root = root;
-#endif /* WITH_CGRAPH */
delete_fast_node(subg, v);
fast_node(agroot(subg), v);
GD_n_nodes(agroot(subg))++;
}
-#ifndef WITH_CGRAPH
- GD_rank(subg)[r].v = ND_rank(root)[r].v + ipos;
- ND_rank(root)[r].valid = FALSE;
-#else /* WITH_CGRAPH */
GD_rank(subg)[r].v = GD_rank(root)[r].v + ipos;
GD_rank(root)[r].valid = FALSE;
-#endif /* WITH_CGRAPH */
}
if (r < GD_maxrank(root))
GD_rank(root)[r].valid = FALSE;
for (orig = agfstout(clust, n); orig;
orig = agnxtout(clust, orig)) {
if ((e = ED_to_virt(orig))) {
-#ifndef WITH_CGRAPH
- while (e && (vn = e->head)->u.node_type == VIRTUAL) {
-#else /* WITH_CGRAPH */
while (e && ND_node_type(vn =aghead(e)) == VIRTUAL) {
-#endif /* WITH_CGRAPH */
ND_clust(vn) = clust;
e = ND_out(aghead(e)).list[0];
/* trouble if concentrators and clusters are mixed */
ND_clust(n) = NULL;
for (orig = agfstout(root, n); orig; orig = agnxtout(root, orig)) {
if ((e = ED_to_virt(orig))) {
-#ifndef WITH_CGRAPH
- while (e && (vn = e->head)->u.node_type == VIRTUAL) {
-#else /* WITH_CGRAPH */
while (e && (ND_node_type(vn = aghead(e))) == VIRTUAL) {
-#endif /* WITH_CGRAPH */
ND_clust(vn) = NULL;
e = ND_out(aghead(e)).list[0];
}
ND_clust(n) = g;
for (orig = agfstout(g, n); orig; orig = agnxtout(g, orig)) {
if ((e = ED_to_virt(orig))) {
-#ifndef WITH_CGRAPH
- while (e && (vn = e->head)->u.node_type == VIRTUAL) {
-#else /* WITH_CGRAPH */
while (e && (ND_node_type(vn = aghead(e))) == VIRTUAL) {
-#endif /* WITH_CGRAPH */
if (ND_clust(vn) == NULL)
ND_clust(vn) = g;
e = ND_out(aghead(e)).list[0];
* Returns NULL if no name is given, or subgraph of
* that name does not exist.
*/
-#ifdef WITH_CGRAPH
static graph_t *getCluster(graph_t * g, char *cluster_name, Dt_t* map)
-#else
-static graph_t *getCluster(graph_t * g, char *cluster_name)
-#endif
{
Agraph_t* sg;
if (!cluster_name || (*cluster_name == '\0'))
return NULL;
-#ifdef WITH_CGRAPH
sg = findCluster (map, cluster_name);
-#else
- sg = agfindsubg(g, cluster_name);
-#endif
if (sg == NULL) {
agerr(AGWARN, "cluster named %s not found\n", cluster_name);
}
* with n control points where n >= 4 and n (mod 3) = 1.
* If edge has arrowheads, reposition them.
*/
-#ifdef WITH_CGRAPH
static void makeCompoundEdge(graph_t * g, edge_t * e, Dt_t* clustMap)
-#else
-static void makeCompoundEdge(graph_t * g, edge_t * e)
-#endif
{
graph_t *lh; /* cluster containing head */
graph_t *lt; /* cluster containing tail */
int fixed;
/* find head and tail target clusters, if defined */
-#ifdef WITH_CGRAPH
lh = getCluster(g, agget(e, "lhead"), clustMap);
lt = getCluster(g, agget(e, "ltail"), clustMap);
-#else
- lh = getCluster(g, agget(e, "lhead"));
- lt = getCluster(g, agget(e, "ltail"));
-#endif
if (!lt && !lh)
return;
if (!ED_spl(e)) return;
{
edge_t *e;
node_t *n;
-#ifdef WITH_CGRAPH
Dt_t* clustMap = mkClustMap (g);
-#endif
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-#ifdef WITH_CGRAPH
makeCompoundEdge(g, e, clustMap);
-#else
- makeCompoundEdge(g, e);
-#endif
}
}
-#ifdef WITH_CGRAPH
dtclose(clustMap);
-#endif
}
#include "dot.h"
#include "aspect.h"
-#ifdef WITH_CGRAPH
static void
dot_init_subg(graph_t * g)
{
dot_init_subg(subg);
}
}
-#endif
static void
dot_init_node(node_t * n)
{
-#ifdef WITH_CGRAPH
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //graph custom data
-#endif /* WITH_CGRAPH */
common_init_node(n);
gv_nodesize(n, GD_flip(agraphof(n)));
alloc_elist(4, ND_in(n));
dot_init_edge(edge_t * e)
{
char *tailgroup, *headgroup;
-#ifdef WITH_CGRAPH
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //graph custom data
-#endif /* WITH_CGRAPH */
common_init_edge(e);
ED_weight(e) = late_int(e, E_weight, 1, 0);
free_label(ND_label(n));
if (ND_shape(n))
ND_shape(n)->fns->freefn(n);
-#ifndef WITH_CGRAPH
- memset(&(n->u), 0, sizeof(Agnodeinfo_t));
-#else /* WITH_CGRAPH */
agdelrec(n, "Agnodeinfo_t");
-#endif /* WITH_CGRAPH */
}
static void free_virtual_edge_list(node_t * n)
for (i = ND_in(n).size - 1; i >= 0; i--) {
e = ND_in(n).list[i];
delete_fast_edge(e);
-#ifdef WITH_CGRAPH
free(e->base.data);
-#endif
free(e);
}
for (i = ND_out(n).size - 1; i >= 0; i--) {
e = ND_out(n).list[i];
delete_fast_edge(e);
-#ifdef WITH_CGRAPH
free(e->base.data);
-#endif
free(e);
}
}
if (ND_node_type(vn) == VIRTUAL) {
free_list(ND_out(vn));
free_list(ND_in(vn));
-#ifdef WITH_CGRAPH
free(vn->base.data);
-#endif
free(vn);
}
vn = next_vn;
dot_cleanup_graph(graph_t * g)
{
int i;
-#ifndef WITH_CGRAPH
- graph_t *clust;
- int c;
- for (c = 1; c <= GD_n_cluster(g); c++) {
- clust = GD_clust(g)[c];
- GD_parent(clust) = NULL;
- dot_cleanup(clust);
- }
-#else
graph_t *subg;
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
dot_cleanup_graph(subg);
}
-#endif
if (GD_clust(g)) free (GD_clust(g));
if (GD_rankleader(g)) free (GD_rankleader(g));
else
free(GD_rank(g));
}
-#ifndef WITH_CGRAPH
- if (g != agroot(g))
- memset(&(g->u), 0, sizeof(Agraphinfo_t));
-#else /* WITH_CGRAPH */
if (g != agroot(g))
agdelrec(g,"Agraphinfo_t");
-#endif /* WITH_CGRAPH */
}
/* delete the layout (but retain the underlying graph) */
#endif
-#ifdef WITH_CGRAPH
static void
remove_from_rank (Agraph_t * g, Agnode_t* n)
{
agdelsubg (g, sg);
}
-#endif
-#ifndef WITH_CGRAPH
-#define ag_xset(x,a,v) agxset(x,a->index,v)
-#else /* WITH_CGRAPH */
#define ag_xset(x,a,v) agxset(x,a,v)
#define agnodeattr(g,n,v) agattr(g,AGNODE,n,v)
-#endif /* WITH_CGRAPH */
static void
attach_phase_attrs (Agraph_t * g, int maxphase)
setEdgeType (g, ET_SPLINE);
asp = setAspect (g, &aspect);
-#ifdef WITH_CGRAPH
dot_init_subg(g);
-#endif
-
dot_init_node_edge(g);
do {
}
aspect.nPasses--;
} while (aspect.nextIter && aspect.nPasses);
-#ifdef WITH_CGRAPH
if (GD_flags(g) & NEW_RANK)
removeFill (g);
-#endif
dot_sameports(g);
dot_splines(g);
if (mapbool(agget(g, "compound")))
#define AUXGRAPH 128
#define GRAPHTYPEMASK 192 /* the OR of the above */
-#ifndef WITH_CGRAPH
-#define MAKEFWDEDGE(new, old) { \
- edge_t *newp; \
- newp = new; \
- *newp = *old; \
- newp->tail = old->head; \
- newp->head = old->tail; \
- ED_tail_port(newp) = ED_head_port(old); \
- ED_head_port(newp) = ED_tail_port(old); \
- ED_edge_type(newp) = VIRTUAL; \
- ED_to_orig(newp) = old; \
-}
-#else /* WITH_CGRAPH */
#define MAKEFWDEDGE(new, old) { \
edge_t *newp; \
Agedgeinfo_t *info; \
ED_edge_type(newp) = VIRTUAL; \
ED_to_orig(newp) = old; \
}
-#endif /* WITH_CGRAPH */
static boxf boxes[1000];
typedef struct {
{
int i, j, k, n_nodes, n_edges, ind, cnt;
node_t *n;
-#ifndef WITH_CGRAPH
- edge_t fwdedgea, fwdedgeb;
-#else
Agedgeinfo_t fwdedgeai, fwdedgebi;
Agedgepair_t fwdedgea, fwdedgeb;
-#endif
edge_t *e, *e0, *e1, *ea, *eb, *le0, *le1, **edges;
path *P;
spline_info_t sd;
int et = EDGE_TYPE(g);
-#ifdef WITH_CGRAPH
fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai;
fwdedgeb.out.base.data = (Agrec_t*)&fwdedgebi;
-#endif /* WITH_CGRAPH */
if (et == ET_NONE) return;
if (et == ET_CURVED) {
ea = (ED_tail_port(e0).defined
|| ED_head_port(e0).defined) ? e0 : le0;
if (ED_tree_index(ea) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgea, ea);
- ea = &fwdedgea;
-#else
MAKEFWDEDGE(&fwdedgea.out, ea);
ea = &fwdedgea.out;
-#endif
}
for (cnt = 1; i < n_edges; cnt++, i++) {
if (le0 != (le1 = getmainedge((e1 = edges[i]))))
eb = (ED_tail_port(e1).defined
|| ED_head_port(e1).defined) ? e1 : le1;
if (ED_tree_index(eb) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgeb, eb);
- eb = &fwdedgeb;
-#else
MAKEFWDEDGE(&fwdedgeb.out, eb);
eb = &fwdedgeb.out;
-#endif
}
if (portcmp(ED_tail_port(ea), ED_tail_port(eb)))
break;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (E_headlabel) {
for (e = agfstin(g, n); e; e = agnxtin(g, e))
-#ifndef WITH_CGRAPH
- if (ED_head_label(e)) {
- if (place_portlabel(e, TRUE))
- updateBB(g, ED_head_label(e));
- }
-#else
if (ED_head_label(AGMKOUT(e))) {
place_portlabel(AGMKOUT(e), TRUE);
updateBB(g, ED_head_label(AGMKOUT(e)));
}
-#endif
}
if (E_taillabel) {
*/
static int edgecmp(edge_t** ptr0, edge_t** ptr1)
{
-#ifndef WITH_CGRAPH
- edge_t fwdedgea, fwdedgeb, *e0, *e1, *ea, *eb, *le0, *le1;
-#else
Agedgeinfo_t fwdedgeai, fwdedgebi;
Agedgepair_t fwdedgea, fwdedgeb;
edge_t *e0, *e1, *ea, *eb, *le0, *le1;
-#endif
int et0, et1, v0, v1, rv;
double t0, t1;
-#ifdef WITH_CGRAPH
fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai;
fwdedgeb.out.base.data = (Agrec_t*)&fwdedgebi;
-#endif
e0 = (edge_t *) * ptr0;
e1 = (edge_t *) * ptr1;
et0 = ED_tree_index(e0) & EDGETYPEMASK;
ea = (ED_tail_port(e0).defined || ED_head_port(e0).defined) ? e0 : le0;
if (ED_tree_index(ea) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgea, ea);
- ea = &fwdedgea;
-#else
MAKEFWDEDGE(&fwdedgea.out, ea);
ea = &fwdedgea.out;
-#endif
}
eb = (ED_tail_port(e1).defined || ED_head_port(e1).defined) ? e1 : le1;
if (ED_tree_index(eb) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgeb, eb);
- eb = &fwdedgeb;
-#else
MAKEFWDEDGE(&fwdedgeb.out, eb);
eb = &fwdedgeb.out;
-#endif
}
if ((rv = portcmp(ED_tail_port(ea), ED_tail_port(eb))))
return rv;
attr_state->G_ordering = G_ordering;
E_constr = NULL;
-#ifndef WITH_CGRAPH
- E_samehead = agfindattr(auxg->proto->e, "samehead");
- E_sametail = agfindattr(auxg->proto->e, "sametail");
- E_weight = agfindattr(auxg->proto->e, "weight");
-#else /* WITH_CGRAPH */
E_samehead = agattr(auxg,AGEDGE, "samehead", NULL);
E_sametail = agattr(auxg,AGEDGE, "sametail", NULL);
E_weight = agattr(auxg,AGEDGE, "weight", NULL);
-#endif /* WITH_CGRAPH */
if (!E_weight)
-#ifndef WITH_CGRAPH
- E_weight = agedgeattr (auxg, "weight", "");
-#else /* WITH_CGRAPH */
E_weight = agattr (auxg,AGEDGE,"weight", "");
-#endif /* WITH_CGRAPH */
E_minlen = NULL;
E_fontcolor = NULL;
E_fontname = agfindedgeattr(auxg, "fontname");
{
Agsym_t* sym;
graph_t* auxg;
-#ifndef WITH_CGRAPH
- Agsym_t **list;
-
- auxg = agopen ("auxg", AG_IS_DIRECTED(g)?AGDIGRAPH:AGRAPH);
- agraphattr(auxg, "rank", "");
-#else /* WITH_CGRAPH */
if (agisdirected(g))
auxg = agopen ("auxg",Agdirected, NIL(Agdisc_t *));
else
auxg = agopen ("auxg",Agundirected, NIL(Agdisc_t *));
agbindrec(auxg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
agattr(auxg, AGRAPH, "rank", "");
-#endif /* WITH_CGRAPH */
GD_drawing(auxg) = NEW(layout_t);
GD_drawing(auxg)->quantum = GD_drawing(g)->quantum;
GD_drawing(auxg)->dpi = GD_drawing(g)->dpi;
GD_nodesep(auxg) = GD_nodesep(g);
GD_ranksep(auxg) = GD_ranksep(g);
-#ifndef WITH_CGRAPH
- list = g->root->univ->nodeattr->list;
- while ((sym = *list++)) {
- agnodeattr (auxg, sym->name, sym->value);
-#else /* WITH_CGRAPH */
//copy node attrs to auxg
// list = g->root->univ->nodeattr->list;
sym=agnxtattr(agroot(g),AGNODE,NULL); //get the first attr.
while ((sym = agnxtattr(agroot(g),AGNODE,sym))) {
agattr (auxg, AGNODE,sym->name, sym->defval );
-#endif /* WITH_CGRAPH */
}
-#ifndef WITH_CGRAPH
- list = g->root->univ->edgeattr->list;
- while ((sym = *list++)) {
- agedgeattr (auxg, sym->name, sym->value);
-#else /* WITH_CGRAPH */
//copy edge attributes
sym=agnxtattr(agroot(g),AGEDGE,NULL); //get the first attr.
while ((sym = agnxtattr(agroot(g),AGEDGE,sym))) {
agattr (auxg, AGEDGE,sym->name, sym->defval);
-#endif /* WITH_CGRAPH */
}
-#ifndef WITH_CGRAPH
- if (!agfindattr(auxg->proto->e, "headport"))
- agedgeattr (auxg, "headport", "");
- if (!agfindattr(auxg->proto->e, "tailport"))
- agedgeattr (auxg, "tailport", "");
-#else /* WITH_CGRAPH */
if (!agattr(auxg,AGEDGE, "headport", NULL))
agattr(auxg,AGEDGE, "headport", "");
if (!agattr(auxg,AGEDGE, "tailport", NULL))
agattr(auxg,AGEDGE, "tailport", "");
-#endif /* WITH_CGRAPH */
setState (auxg, attr_state);
static node_t*
cloneNode (graph_t* g, node_t* orign, int flipped)
{
-#ifndef WITH_CGRAPH
- node_t* n = agnode(g, orign->name);
-#else /* WITH_CGRAPH */
node_t* n = agnode(g, agnameof(orign),1);
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
agcopyattr (orign, n);
if (shapeOf(orign) == SH_RECORD) {
int lbllen = strlen(ND_label(orign)->text);
static edge_t*
cloneEdge (graph_t* g, node_t* tn, node_t* hn, edge_t* orig)
{
-#ifndef WITH_CGRAPH
- edge_t* e = agedge(g, tn, hn);
-#else /* WITH_CGRAPH */
edge_t* e = agedge(g, tn, hn,NULL,1);
-#endif /* WITH_CGRAPH */
/* for (; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig)); */
agcopyattr (orig, e);
/*
points[pointn++] = tp;
points[pointn++] = hp;
points[pointn++] = hp;
-#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 */
ED_label(e)->pos.x = ctrx;
ED_label(e)->pos.y = tp.y + (ED_label(e)->dimen.y+LBL_SPACE)/2.0;
ED_label(e)->set = TRUE;
ED_label(e)->pos.x = ctrx;
ED_label(e)->pos.y = ctry;
ED_label(e)->set = TRUE;
-#ifndef WITH_CGRAPH
- clip_and_install(e, e->head, ps, pn, &sinfo);
-#else /* WITH_CGRAPH */
clip_and_install(e, aghead(e), ps, pn, &sinfo);
-#endif /* WITH_CGRAPH */
}
/* edges with no labels */
poly.ps = (Ppoint_t*)points;
ps = simpleSplineRoute (tp, hp, poly, &pn, et == ET_PLINE);
if (pn == 0) return;
-#ifndef WITH_CGRAPH
- clip_and_install(e, e->head, ps, pn, &sinfo);
-#else /* WITH_CGRAPH */
clip_and_install(e, aghead(e), ps, pn, &sinfo);
-#endif /* WITH_CGRAPH */
}
free (earray);
points[pointn++] = hp;
}
dy += 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 */
}
}
attrs = NEW(attr_state_t);
auxg = cloneGraph (g, attrs);
-#ifndef WITH_CGRAPH
- subg = agsubg (auxg, "xxx");
-#else /* WITH_CGRAPH */
subg = agsubg (auxg, "xxx",1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
agset (subg, "rank", "source");
rightx = ND_coord(hn).x;
leftx = ND_coord(tn).x;
}
}
if (!hvye) {
-#ifndef WITH_CGRAPH
- hvye = agedge (auxg, auxt, auxh);
-#else /* WITH_CGRAPH */
hvye = agedge (auxg, auxt, auxh,NULL,1);
-#endif /* WITH_CGRAPH */
}
-#ifndef WITH_CGRAPH
- agxset (hvye, E_weight->index, "10000");
-#else /* WITH_CGRAPH */
agxset (hvye, E_weight, "10000");
-#endif /* WITH_CGRAPH */
GD_gvc(auxg) = GD_gvc(g);
setEdgeType (auxg, et);
dot_init_node_edge(auxg);
else ps = routepolylines(P, &pn);
if (pn == 0) return;
}
-#ifndef WITH_CGRAPH
- clip_and_install(e, e->head, ps, pn, &sinfo);
-#else /* WITH_CGRAPH */
clip_and_install(e, aghead(e), ps, pn, &sinfo);
-#endif /* WITH_CGRAPH */
}
/* make_flat_bottom_edges:
make_flat_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt, int et)
{
node_t *tn, *hn;
-#ifndef WITH_CGRAPH
- edge_t fwdedge, *e;
-#else
Agedgeinfo_t fwdedgei;
Agedgepair_t fwdedge;
edge_t *e;
-#endif
int j, i, r, isAdjacent;
double stepx, stepy, vspace;
int tside, hside, pn;
pathend_t tend, hend;
graph_t* g;
-#ifdef WITH_CGRAPH
fwdedge.out.base.data = (Agrec_t*)&fwdedgei;
-#endif
/* Get sample edge; normalize to go from left to right */
e = edges[ind];
isAdjacent = ED_adjacent(e);
if (ED_tree_index(e) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedge, e);
- e = &fwdedge;
-#else
MAKEFWDEDGE(&fwdedge.out, e);
e = &fwdedge.out;
-#endif
}
for (i = 1; i < cnt; i++) {
if (ED_adjacent(edges[ind+i])) {
{
graph_t *g;
node_t *tn, *hn;
-#ifndef WITH_CGRAPH
- edge_t fwdedgea, fwdedgeb, fwdedge, *e, *fe, *le, *segfirst;
-#else
Agedgeinfo_t fwdedgeai, fwdedgebi, fwdedgei;
Agedgepair_t fwdedgea, fwdedgeb, fwdedge;
edge_t *e, *fe, *le, *segfirst;
-#endif /* WITH_CGRAPH */
pointf *ps;
pathend_t tend, hend;
boxf b;
static int numpts2;
int pointn;
-#ifdef WITH_CGRAPH
fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai;
fwdedgeb.out.base.data = (Agrec_t*)&fwdedgebi;
fwdedge.out.base.data = (Agrec_t*)&fwdedgei;
-#endif /* WITH_CGRAPH */
if (!pointfs) {
pointfs = N_GNEW(NUMPTS, pointf);
g = agraphof(agtail(e));
hackflag = FALSE;
if (ABS(ND_rank(agtail(e)) - ND_rank(aghead(e))) > 1) {
-#ifndef WITH_CGRAPH
- fwdedgea = *e;
-#else /* WITH_CGRAPH */
fwdedgeai = *(Agedgeinfo_t*)e->base.data;
fwdedgea.out = *e;
fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai;
-#endif /* WITH_CGRAPH */
if (ED_tree_index(e) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgeb, e);
- fwdedgea.tail = aghead(e);
- fwdedgea.u.tail_port = ED_head_port(e);
-#else /* WITH_CGRAPH */
MAKEFWDEDGE(&fwdedgeb.out, e);
agtail(&fwdedgea.out) = aghead(e);
ED_tail_port(&fwdedgea.out) = ED_head_port(e);
-#endif /* WITH_CGRAPH */
} else {
-#ifndef WITH_CGRAPH
- fwdedgeb = *e;
- fwdedgea.tail = e->tail;
-#else /* WITH_CGRAPH */
fwdedgebi = *(Agedgeinfo_t*)e->base.data;
fwdedgeb.out = *e;
fwdedgeb.out.base.data = (Agrec_t*)&fwdedgebi;
agtail(&fwdedgea.out) = agtail(e);
-#endif /* WITH_CGRAPH */
}
le = getmainedge(e);
while (ED_to_virt(le))
le = ED_to_virt(le);
-#ifndef WITH_CGRAPH
- fwdedgea.head = aghead(le);
- fwdedgea.u.head_port.defined = FALSE;
- fwdedgea.u.edge_type = VIRTUAL;
- fwdedgea.u.head_port.p.x = fwdedgea.u.head_port.p.y = 0;
- fwdedgea.u.to_orig = e;
- e = &fwdedgea;
-#else /* WITH_CGRAPH */
aghead(&fwdedgea.out) = aghead(le);
ED_head_port(&fwdedgea.out).defined = FALSE;
ED_edge_type(&fwdedgea.out) = VIRTUAL;
ED_head_port(&fwdedgea.out).p.x = ED_head_port(&fwdedgea.out).p.y = 0;
ED_to_orig(&fwdedgea.out) = e;
e = &fwdedgea.out;
-#endif /* WITH_CGRAPH */
hackflag = TRUE;
} else {
if (ED_tree_index(e) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedgea, e);
- e = &fwdedgea;
-#else
MAKEFWDEDGE(&fwdedgea.out, e);
e = &fwdedgea.out;
-#endif
}
}
fe = e;
}
boxes[boxn++] = rank_box(sp, g, ND_rank(tn));
b = hend.nb = maximal_bbox(sp, hn, e, NULL);
-#ifndef WITH_CGRAPH
- endpath(P, hackflag ? &fwdedgeb : e, REGULAREDGE, &hend, spline_merge(aghead(e)));
-#else
endpath(P, hackflag ? &fwdedgeb.out : e, REGULAREDGE, &hend, spline_merge(aghead(e)));
-#endif
b.UR.y = hend.boxes[hend.boxn - 1].UR.y;
b.LL.y = hend.boxes[hend.boxn - 1].LL.y;
b = makeregularend(b, TOP,
pointfs[pointn++] = ps[i];
}
recover_slack(segfirst, P);
-#ifndef WITH_CGRAPH
- hn = hackflag ? aghead(&fwdedgeb) : aghead(e);
-#else
hn = hackflag ? aghead(&fwdedgeb.out) : aghead(e);
-#endif
}
/* make copies of the spline points, one per multi-edge */
for (j = 1; j < cnt; j++) {
e = edges[ind + j];
if (ED_tree_index(e) & BWDEDGE) {
-#ifndef WITH_CGRAPH
- MAKEFWDEDGE(&fwdedge, e);
- e = &fwdedge;
-#else
MAKEFWDEDGE(&fwdedge.out, e);
e = &fwdedge.out;
-#endif
}
for (i = 1; i < pointn - 1; i++)
pointfs[i].x += sp->Multisep;
{
edge_t *e;
-#ifndef WITH_CGRAPH
- e = NEW(edge_t);
-#else /* WITH_CGRAPH */
Agedgepair_t* e2 = NEW(Agedgepair_t);
AGTYPE(&(e2->in)) = AGINEDGE;
AGTYPE(&(e2->out)) = AGOUTEDGE;
e2->out.base.data = (Agrec_t*)NEW(Agedgeinfo_t);
e = &(e2->out);
-#endif /* WITH_CGRAPH */
agtail(e) = u;
aghead(e) = v;
ED_edge_type(e) = VIRTUAL;
if (orig) {
AGSEQ(e) = AGSEQ(orig);
-#ifdef WITH_CGRAPH
AGSEQ(&(e2->in)) = AGSEQ(orig);
-#endif
ED_count(e) = ED_count(orig);
ED_xpenalty(e) = ED_xpenalty(orig);
ED_weight(e) = ED_weight(orig);
node_t *n;
n = NEW(node_t);
-#ifndef WITH_CGRAPH
- n->name = "virtual";
- n->graph = g;
-#else /* WITH_CGRAPH */
// agnameof(n) = "virtual";
AGTYPE(n) = AGNODE;
n->base.data = (Agrec_t*)NEW(Agnodeinfo_t);
n->root = g;
-#endif /* WITH_CGRAPH */
ND_node_type(n) = VIRTUAL;
ND_lw(n) = ND_rw(n) = 1;
ND_ht(n) = 1;
}
else
{
-#ifndef WITH_CGRAPH
- /* search meta-graph to find subgraphs that may be ordered */
- graph_t *mg, *subg;
- node_t *mm, *mn;
- edge_t *me;
-
- mm = g->meta_node;
- mg = mm->graph;
- for (me = agfstout(mg, mm); me; me = agnxtout(mg, me)) {
- mn = me->head;
- subg = agusergraph(mn);
-#else /* WITH_CGRAPH */
graph_t *subg;
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
-#endif /* WITH_CGRAPH */
/* clusters are processed by separate calls to ordered_edges */
if (!is_cluster(subg))
ordered_edges(subg);
for (j = 0; (e = ND_flat_out(v).list[j]); j++)
if (ED_edge_type(e) == FLATORDER) {
delete_flat_edge(e);
-#ifdef WITH_CGRAPH
free(e->base.data);
-#endif
free(e);
j--;
}
#ifdef DEBUG
assert(GD_rank(g->root)[r].v[ND_order(u)] == u);
#endif
-#ifndef WITH_CGRAPH
- GD_rank(g)[r].v = ND_rank(g->root)[r].v + ND_order(u);
-#else /* WITH_CGRAPH */
GD_rank(g)[r].v = GD_rank(agroot(g))[r].v + ND_order(u);
-#endif /* WITH_CGRAPH */
GD_rank(g)[r].n = ND_order(w) - ND_order(u) + 1;
}
}
-#ifdef WITH_CGRAPH
/* realFillRanks:
* The structures in crossing minimization and positioning require
* that clusters have some node on each rank. This function recursively
sg = realFillRanks (g, rnks, rnks_sz, NULL);
free (rnks);
}
-#endif
static void init_mincross(graph_t * g)
{
TE_list = N_NEW(size, edge_t *);
TI_list = N_NEW(size, int);
mincross_options(g);
-#ifdef WITH_CGRAPH
if (GD_flags(g) & NEW_RANK)
fillRanks (g);
-#endif
class2(g);
decompose(g, 1);
allocate_ranks(g);
ND_mark(v) = TRUE;
ND_onstack(v) = TRUE;
-#ifndef WITH_CGRAPH
- hascl = (ND_n_cluster(g->root) > 0);
-#else /* WITH_CGRAPH */
hascl = (GD_n_cluster(agroot(g)) > 0);
-#endif /* WITH_CGRAPH */
if (ND_flat_out(v).list)
for (i = 0; (e = ND_flat_out(v).list[i]); i++) {
if (hascl
{
edge_t *e;
-#ifndef WITH_CGRAPH
- e = NEW(edge_t);
-#else
Agedgepair_t* e2 = NEW(Agedgepair_t);
AGTYPE(&(e2->in)) = AGINEDGE;
AGTYPE(&(e2->out)) = AGOUTEDGE;
e2->out.base.data = (Agrec_t*)NEW(Agedgeinfo_t);
e = &(e2->out);
-#endif /* WITH_CGRAPH */
agtail(e) = u;
aghead(e) = v;
for (n = GD_nlist(g); n; n = ND_next(n)) {
for (i = 0; (e = ND_out(n).list[i]); i++) {
-#ifdef WITH_CGRAPH
free(e->base.data);
-#endif
free(e);
}
free_list(ND_out(n));
ND_next(nprev) = nnext;
else
GD_nlist(g) = nnext;
-#ifdef WITH_CGRAPH
free(n->base.data);
-#endif
free(n);
} else
nprev = n;
n = aghead(ND_out(leader).list[0]);
j = ND_order(leader) + 1;
for (e = agfstin(g, n); e; e = agnxtin(g, e)) {
-#ifndef WITH_CGRAPH
- edge_t *e1 = e;
-#else
edge_t *e1 = AGMKOUT(e);
-#endif
if ((agtail(e1) != leader) && (UF_find(agtail(e1)) == leader)) {
lbound = place_leaf(agtail(e1), lbound, j++);
unmerge_oneway(e1);
#include "dot.h"
static void dot1_rank(graph_t * g, aspect_t* asp);
-#ifdef WITH_CGRAPH
static void dot2_rank(graph_t * g, aspect_t* asp);
-#endif
static void
renewlist(elist * L)
*/
if (f && (e == ED_to_orig(f))) {
edge_t *e1, *f1;
-#ifndef WITH_CGRAPH
- for (e1 = agfstout(g, n); e1; e1 = agnxtout(g, e1)) {
- if (e != e1) {
- f1 = ED_to_virt(e1);
- if (f1 && (f == f1)) {
- ED_to_virt(e1) = NULL;
- }
- }
- }
-#else
node_t *n1;
for (n1 = agfstnode(g); n1; n1 = agnxtnode(g, n1)) {
for (e1 = agfstout(g, n1); e1; e1 = agnxtout(g, e1)) {
}
}
free(f->base.data);
-#endif
free(f);
}
ED_to_virt(e) = NULL;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(agroot(g), n); e; e = agnxtout(agroot(g), e)) {
if (agcontains(g, aghead(e)))
-#ifndef WITH_CGRAPH
- aginsert(g, e);
-#else /* WITH_CGRAPH */
agsubedge(g,e,1);
-#endif /* WITH_CGRAPH */
}
}
}
collapse_cluster(graph_t * g, graph_t * subg)
{
if (GD_parent(subg)) {
-#ifndef WITH_CGRAPH
- agerr(AGWARN, "Cluster %s is multiply defined in %s and %s - this may cause problems.\n", subg->name,
- g->name, GD_parent(subg)->name);
-#endif
return;
}
GD_parent(subg) = g;
node_t *n;
#endif
-#ifndef WITH_CGRAPH
- graph_t *mg;
- node_t *mn;
- edge_t *me;
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = aghead(me);
- subg = agusergraph(mn);
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
-#endif /* WITH_CGRAPH */
c = rank_set_class(subg);
if (c) {
if ((c == CLUSTER) && CL_type == LOCAL)
find_clusters(graph_t * g)
{
graph_t *subg;
-#ifndef WITH_CGRAPH
- graph_t *mg;
- node_t *mn;
- edge_t *me;
-
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = me->head;
- subg = agusergraph(mn);
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(agroot(g)); subg; subg = agnxtsubg(subg)) {
-#endif /* WITH_CGRAPH */
if (GD_set_type(subg) == CLUSTER)
collapse_cluster(g, subg);
}
void dot_rank(graph_t * g, aspect_t* asp)
{
-#ifdef WITH_CGRAPH
if (agget (g, "newrank")) {
GD_flags(g) |= NEW_RANK;
dot2_rank (g, asp);
}
else
-#endif
dot1_rank (g, asp);
if (Verbose)
fprintf (stderr, "Maxrank = %d, minrank = %d\n", GD_maxrank(g), GD_minrank(g));
continue;
if (agfstout(g, n) == NULL) {
if ((e = agfstin(g, n)) && (agnxtin(g, e) == NULL)) {
-#ifndef WITH_CGRAPH
- potential_leaf(g, e, n);
-#else
potential_leaf(g, AGMKOUT(e), n);
-#endif
continue;
}
}
}
#endif
-#ifdef WITH_CGRAPH
/* new ranking code:
* Allows more constraints
* Copy of level.c in dotgen2
#endif
agclose(Xg);
}
-
-#endif /* WITH_CGRAPH */
-/* end of new ranking code
- */
int n_sametail; /* number of same_t groups on current node */
int i;
-#ifndef WITH_CGRAPH
- E_samehead = agfindattr(g->proto->e, "samehead");
- E_sametail = agfindattr(g->proto->e, "sametail");
-#else /* WITH_CGRAPH */
E_samehead = agattr(g, AGEDGE, "samehead",(char*)0);
E_sametail = agattr(g, AGEDGE, "sametail",(char*)0);
-#endif /* WITH_CGRAPH */
if (!(E_samehead || E_sametail))
return;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) {
if (aghead(e) == agtail(e)) continue; /* Don't support same* for loops */
if (aghead(e) == n && E_samehead &&
-#ifndef WITH_CGRAPH
- (id = agxget(e, E_samehead->index))[0])
-#else /* WITH_CGRAPH */
(id = agxget(e, E_samehead))[0])
-#endif /* WITH_CGRAPH */
n_samehead = sameedge(samehead, n_samehead, n, e, id);
else if (agtail(e) == n && E_sametail &&
-#ifndef WITH_CGRAPH
- (id = agxget(e, E_sametail->index))[0])
-#else /* WITH_CGRAPH */
(id = agxget(e, E_sametail))[0])
-#endif /* WITH_CGRAPH */
n_sametail = sameedge(sametail, n_sametail, n, e, id);
}
for (i = 0; i < n_samehead; i++) {
# $Id$Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/gvc \
-I$(top_srcdir)/lib/ortho \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt \
-I$(top_srcdir)/lib/pathplan
-if WITH_CGRAPH
noinst_HEADERS = dot2.h dot2procs.h groups.h minc.h
noinst_LTLIBRARIES = libdotgen2_C.la
-endif
libdotgen2_C_la_LDFLAGS = -no-undefined
libdotgen2_C_la_SOURCES = dotinit.c level.c minc2.c ns.c groups.c minc_utils.c decomp.c
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
-I$(top_srcdir)/lib/sparse \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = comp.h dbg.h fdp.h grid.h tlayout.h xlayout.h \
Agnode_t *other;
MARK(n) = 1;
-#ifndef WITH_CGRAPH
- aginsert(out, n);
-#else /* WITH_CGRAPH */
agsubnode(out,n,1);
-#endif /* WITH_CGRAPH */
for (e = agfstedge(g, n); e; e = agnxtedge(g, e, n)) {
if ((other = agtail(e)) == n)
other = aghead(e);
bport_t *pp;
graph_t **comps;
graph_t **cp;
-#ifndef WITH_CGRAPH
- graph_t *mg;
- node_t *mn;
- edge_t *me;
-#endif
int pinflag = 0;
/* fprintf (stderr, "comps of %s starting at %d \n", g->name, c_cnt); */
subg = 0;
if ((pp = PORTS(g))) {
sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
-#ifndef WITH_CGRAPH
- subg = agsubg(g, name);
-#else /* WITH_CGRAPH */
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
GD_alg(subg) = (void *) NEW(gdata);
PORTS(subg) = pp;
NPORTS(subg) = NPORTS(g);
continue;
if (!subg) {
sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
-#ifndef WITH_CGRAPH
- subg = agsubg(g, name);
-#else /* WITH_CGRAPH */
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
GD_alg(subg) = (void *) NEW(gdata);
}
pinflag = 1;
if (MARK(n))
continue;
sprintf(name, "cc%s+%d", agnameof(g), c_cnt++ + C_cnt);
-#ifndef WITH_CGRAPH
- subg = agsubg(g, name);
-#else /* WITH_CGRAPH */
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
GD_alg(subg) = (void *) NEW(gdata);
dfs(g, n, subg, marks);
nodeInduce(subg);
*pinned = pinflag;
/* freed in layout */
comps = cp = N_NEW(c_cnt + 1, graph_t *);
-#ifndef WITH_CGRAPH
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = me->head;
- *cp++ = agusergraph(mn);
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
*cp++ = subg;
-#endif /* WITH_CGRAPH */
c_cnt--;
}
assert(c_cnt == 0);
char *p;
char c;
-#ifndef WITH_CGRAPH
- possym = agfindattr(g->proto->n, "pos");
-#else /* WITH_CGRAPH */
possym = agattr(g,AGNODE, "pos", NULL);
-#endif /* WITH_CGRAPH */
if (!possym)
return;
-#ifndef WITH_CGRAPH
- pinsym = agfindattr(g->proto->n, "pin");
-#else /* WITH_CGRAPH */
pinsym = agattr(g,AGNODE, "pin", NULL);
-#endif /* WITH_CGRAPH */
for (i = 0; (np = GD_neato_nlist(g)[i]); i++) {
-#ifndef WITH_CGRAPH
- p = agxget(np, possym->index);
-#else /* WITH_CGRAPH */
p = agxget(np, possym);
-#endif /* WITH_CGRAPH */
if (p[0]) {
pvec = ND_pos(np);
c = '\0';
}
ND_pinned(np) = P_SET;
if ((c == '!')
-#ifndef WITH_CGRAPH
- || (pinsym && mapbool(agxget(np, pinsym->index))))
-#else /* WITH_CGRAPH */
|| (pinsym && mapbool(agxget(np, pinsym))))
-#endif /* WITH_CGRAPH */
ND_pinned(np) = P_PIN;
} else
fprintf(stderr,
*/
static void init_edge(edge_t * e, attrsym_t * E_len)
{
-#ifdef WITH_CGRAPH
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
ED_factor(e) = late_double(e, E_weight, 1.0, 0.0);
ED_dist(e) = late_double(e, E_len, fdp_parms->K, 0.0);
common_init_edge(e);
}
-#ifdef WITH_CGRAPH
static void init_node(node_t * n)
{
common_init_node(n);
ND_pos(n) = N_NEW(GD_ndim(agraphof(n)), double);
gv_nodesize(n, GD_flip(agraphof(n)));
}
-#endif
void fdp_init_node_edge(graph_t * g)
{
int i;
/* ndata* alg; */
-#ifdef WITH_CGRAPH
aginit(g, AGNODE, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
-#endif
processClusterEdges(g);
/* Get node count after processClusterEdges(), as this function may
GD_neato_nlist(g) = N_NEW(nn + 1, node_t *);
for (i = 0, n = agfstnode(g); n; n = agnxtnode(g, n)) {
-#ifdef WITH_CGRAPH
init_node (n);
-#else
- neato_init_node (n);
-#endif
/* ND_alg(n) = alg + i; */
GD_neato_nlist(g)[i] = n;
ND_id(n) = i++;
}
-#ifndef WITH_CGRAPH
- E_len = agfindattr(g->proto->e, "len");
-#else /* WITH_CGRAPH */
E_len = agattr(g,AGEDGE, "len", NULL);
-#endif /* WITH_CGRAPH */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
init_edge(e, E_len);
}
free (GD_clust(g));
if (g != agroot(g))
-#ifndef WITH_CGRAPH
- memset(&(g->u), 0, sizeof(Agraphinfo_t));
-#else /* WITH_CGRAPH */
agdelrec(g, "Agraphinfo_t");
-#endif /* WITH_CGRAPH */
}
static void fdp_cleanup_graph(graph_t * g)
{
node_t *dn;
-#ifndef WITH_CGRAPH
- dn = agnode(dg, name);
-#else /* WITH_CGRAPH */
dn = agnode(dg, name,1);
agbindrec(dn, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
ND_alg(dn) = (void *) NEW(dndata); /* free in freeDeriveNode */
ND_pos(dn) = N_GNEW(GD_ndim(dg), double);
/* fprintf (stderr, "Creating %s\n", dn->name); */
{
free(ND_alg(n));
free(ND_pos(n));
-#ifdef WITH_CGRAPH
agdelrec(n, "Agnodeinfo_t");
-#endif
}
static void freeGData(graph_t * g)
while ((cg = *cc++)) {
freeGData(cg);
-#ifdef WITH_CGRAPH
agdelrec(cg, "Agraphinfo_t");
-#endif
}
if (PORTS(g))
free(PORTS(g));
freeGData(g);
-#ifdef WITH_CGRAPH
agdelrec(g, "Agraphinfo_t");
-#endif
for (dn = agfstnode(g); dn; dn = dnxt) {
dnxt = agnxtnode(g, dn);
for (e = agfstout(g, dn); e; e = agnxtout(g, e)) {
free (ED_to_virt(e));
-#ifdef WITH_CGRAPH
agdelrec(e, "Agedgeinfo_t");
-#endif
}
freeDeriveNode(dn);
}
graph_t *parent;
attrsym_t *G_coord = infop->G_coord;
-#ifndef WITH_CGRAPH
- p = agxget(g, G_coord->index);
-#else /* WITH_CGRAPH */
p = agxget(g, G_coord);
-#endif /* WITH_CGRAPH */
if (p[0]) {
if (g != infop->rootg) {
-#ifndef WITH_CGRAPH
- parent = agusergraph((agfstin(g->meta_node->graph, g->meta_node))->tail);
- pp = agxget(parent, G_coord->index);
-#else /* WITH_CGRAPH */
parent =agparent(g);
pp = agxget(parent, G_coord);
-#endif /* WITH_CGRAPH */
if ((pp == p) || !strcmp(p, pp))
return;
}
char* ov_val;
Agsym_t* ov;
-#ifndef WITH_CGRAPH
- if ((ov = agfindattr(g, attr))) {
- ov_val = agxget(g,ov->index);
- ov = agfindattr(dg, attr);
-#else /* WITH_CGRAPH */
if ((ov = agattr(g,AGRAPH, attr, NULL))) {
ov_val = agxget(g,ov);
ov = agattr(dg,AGRAPH, attr, NULL);
-#endif /* WITH_CGRAPH */
if (ov)
-#ifndef WITH_CGRAPH
- agxset (dg, ov->index, ov_val);
-#else /* WITH_CGRAPH */
agxset (dg, ov, ov_val);
-#endif /* WITH_CGRAPH */
else
-#ifndef WITH_CGRAPH
- agraphattr(dg, attr, ov_val);
-#else /* WITH_CGRAPH */
agattr(dg, AGRAPH, attr, ov_val);
-#endif /* WITH_CGRAPH */
}
}
sprintf(name, "_dg_%d", infop->gid++);
if (Verbose >= 2)
-#ifndef WITH_CGRAPH
- fprintf(stderr, "derive graph %s of %s\n", name, g->name);
-#else /* WITH_CGRAPH */
fprintf(stderr, "derive graph %s of %s\n", name, agnameof(g));
-#endif
-#ifndef WITH_CGRAPH
- dg = agopen(name, AGRAPHSTRICT);
-#else /* WITH_CGRAPH */
dg = agopen("derived", Agstrictdirected,NIL(Agdisc_t *));
agbindrec(dg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
GD_alg(dg) = (void *) NEW(gdata); /* freed in freeDeriveGraph */
#ifdef DEBUG
GORIG(dg) = g;
if (hd == tl)
continue;
if (hd > tl)
-#ifndef WITH_CGRAPH
- de = agedge(dg, tl, hd);
-#else /* WITH_CGRAPH */
de = agedge(dg, tl, hd, NULL,1);
-#endif /* WITH_CGRAPH */
else
-#ifndef WITH_CGRAPH
- de = agedge(dg, hd, tl);
-#else /* WITH_CGRAPH */
de = agedge(dg, hd, tl, NULL,1);
agbindrec(de, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
ED_dist(de) = ED_dist(e);
ED_factor(de) = ED_factor(e);
/* fprintf (stderr, "edge %s -- %s\n", tl->name, hd->name); */
sz++;
ND_id(dn) = id++;
if (dn > m)
-#ifndef WITH_CGRAPH
- de = agedge(dg, m, dn);
-#else /* WITH_CGRAPH */
de = agedge(dg, m, dn, NULL,1);
-#endif /* WITH_CGRAPH */
else
-#ifndef WITH_CGRAPH
- de = agedge(dg, dn, m);
-#else /* WITH_CGRAPH */
de = agedge(dg, dn, m, NULL,1);
agbindrec(de, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
ED_dist(de) = ED_dist(pp->e);
ED_factor(de) = ED_factor(pp->e);
addEdge(de, pp->e);
*/
void init_info(graph_t * g, layout_info * infop)
{
-#ifndef WITH_CGRAPH
- infop->G_coord = agfindattr(g, "coords");
- infop->G_width = agfindattr(g, "width");
- infop->G_height = agfindattr(g, "height");
-#else /* WITH_CGRAPH */
infop->G_coord = agattr(g,AGRAPH, "coords", NULL);
infop->G_width = agattr(g,AGRAPH, "width", NULL);
infop->G_height = agattr(g, AGRAPH,"height", NULL);
-#endif /* WITH_CGRAPH */
infop->rootg = g;
infop->gid = 0;
infop->pack.mode = getPackInfo(g, l_node, CL_OFFSET / 2, &(infop->pack));
static void
mkClusters (graph_t * g, clist_t* pclist, graph_t* parent)
{
-#ifndef WITH_CGRAPH
- node_t* mn;
- edge_t* me;
- graph_t* mg;
-#endif /* WITH_CGRAPH */
graph_t* subg;
clist_t list;
clist_t* clist;
}
else
clist = pclist;
-#ifndef WITH_CGRAPH
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = me->head;
- subg = agusergraph(mn);
- if (!strncmp(subg->name, "cluster", 7)) {
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg))
{
if (!strncmp(agnameof(subg), "cluster", 7)) {
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif /* WITH_CGRAPH */
GD_alg(subg) = (void *) NEW(gdata); /* freed in cleanup_subgs */
GD_ndim(subg) = GD_ndim(parent);
LEVEL(subg) = LEVEL(parent) + 1;
{
setEdgeType (g, ET_LINE);
GD_alg(g) = (void *) NEW(gdata); /* freed in cleanup_graph */
-#ifndef WITH_CGRAPH
- g->u.ndim = late_int(g, agfindattr(g, "dim"), 2, 2);
- Ndim = g->u.ndim = MIN(g->u.ndim, MAXDIM);
-#else /* WITH_CGRAPH */
GD_ndim(g) = late_int(g, agattr(g,AGRAPH, "dim", NULL), 2, 2);
Ndim = GD_ndim(g) = MIN(GD_ndim(g), MAXDIM);
-#endif /* WITH_CGRAPH */
mkClusters (g, NULL, g);
fdp_initParams(g);
T_Cell = DFLT_Cell;
T_C = D_C;
T_Tfact = D_Tfact;
-#ifndef WITH_CGRAPH
- T_maxIters = late_int(g, agfindattr(g, "maxiter"), DFLT_maxIters, 0);
- D_K = T_K = late_double(g, agfindattr(g, "K"), DFLT_K, 0.0);
-#else /* WITH_CGRAPH */
T_maxIters = late_int(g, agattr(g,AGRAPH, "maxiter", NULL), DFLT_maxIters, 0);
D_K = T_K = late_double(g, agattr(g,AGRAPH, "K", NULL), DFLT_K, 0.0);
-#endif /* WITH_CGRAPH */
if (D_T0 == -1.0) {
-#ifndef WITH_CGRAPH
- T_T0 = late_double(g, agfindattr(g, "T0"), -1.0, 0.0);
-#else /* WITH_CGRAPH */
T_T0 = late_double(g, agattr(g,AGRAPH, "T0", NULL), -1.0, 0.0);
-#endif /* WITH_CGRAPH */
} else
T_T0 = D_T0;
T_seed = DFLT_seed;
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = ingraphs.h
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = xlabels.h index.h node.h rectangle.h split.q.h
#include "logic.h"
#include "arith.h"
#include "rectangle.h"
-#ifdef WITH_CGRAPH
#include <cgraph.h>
-#else
-typedef int Agraphinfo_t;
-typedef int Agnodeinfo_t;
-typedef int Agedgeinfo_t;
-#include <graph.h>
-#endif
#define Undefined(x) ((x)->boundary[0] > (x)->boundary[NUMDIMS])
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/ortho \
-I$(top_srcdir)/lib/pathplan \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/sparse \
-I$(top_srcdir)/lib/rbtree \
-I$(top_srcdir)/lib/sfdpgen \
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
I[i] = row;
J[i] = ND_id(aghead(e));
-#ifndef WITH_CGRAPH
- if (!sym || (sscanf(agxget(e, sym->index), "%lf", &v) != 1))
-#else
if (!sym || (sscanf(agxget(e, sym), "%lf", &v) != 1))
-#endif
v = 1;
val[i] = v;
/* edge length */
if (symD) {
-#ifndef WITH_CGRAPH
- if (sscanf (agxget (e, symD->index), "%lf", &v) != 1) v = 1;
-#else
if (sscanf (agxget (e, symD), "%lf", &v) != 1) v = 1;
-#endif
valD[i] = v;
}
i++;
hp = (nitem *) ND_alg(aghead(e));
delta = dist(&tp->bb, &hp->bb);
h = hp->cnode;
-#ifndef WITH_CGRAPH
- ce = agedge(cg, t, h);
-#else
ce = agedge(cg, t, h, NULL, 1);
agbindrec(ce, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
-#endif
ED_weight(ce) = 1;
if (ED_minlen(ce) < delta) {
if (ED_minlen(ce) == 0.0) {
node_t *n;
edge_t *e;
node_t *lastn = NULL;
-#ifndef WITH_CGRAPH
- graph_t *cg = agopen("cg", AGDIGRAPHSTRICT);
-#else
graph_t *cg = agopen("cg", Agstrictdirected, NIL(Agdisc_t *));
agbindrec(cg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); // graph custom data
-#endif
for (p = (nitem *) dtflatten(list); p;
p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
-#ifndef WITH_CGRAPH
- n = agnode(cg, agnameof(p->np)); /* FIX */
-#else
n = agnode(cg, agnameof(p->np), 1); /* FIX */
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif
ND_alg(n) = p;
p->cnode = n;
alloc_elist(0, ND_in(n));
e = NULL;
if (intersect(p, nxp)) {
double delta = dist(&p->bb, &nxp->bb);
-#ifndef WITH_CGRAPH
- e = agedge(cg, p->cnode, nxp->cnode);
-#else
e = agedge(cg, p->cnode, nxp->cnode, NULL, 1);
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); // edge custom data
-#endif
assert (delta <= 0xFFFF);
ED_minlen(e) = delta;
ED_weight(e) = 1;
double root_val;
#endif
node_t *lastn = NULL;
-#ifndef WITH_CGRAPH
- graph_t *cg = agopen("cg", AGDIGRAPHSTRICT);
-#else
graph_t *cg = agopen("cg", Agstrictdirected, NIL(Agdisc_t *));
agbindrec(cg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); // graph custom data
-#endif
/* count distinct nodes */
cnt = 0;
if (oldval != p->val) {
oldval = p->val;
/* n = newNode (cg); */
-#ifndef WITH_CGRAPH
- n = agnode(cg, agnameof(p->np)); /* FIX */
-#else
n = agnode(cg, agnameof(p->np), 1); /* FIX */
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif
ND_alg(n) = p;
if (root) {
ND_next(lastn) = n;
alloc_elist(2 * (cnt - 1), ND_out(prev));
else
alloc_elist(cnt - lcnt - 1, ND_out(prev));
-#ifndef WITH_CGRAPH
- e = agedge(cg, prev, n);
-#else
e = agedge(cg, prev, n, NULL, 1);
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); // edge custom data
-#endif
ED_minlen(e) = SCALE;
ED_weight(e) = 1;
elist_append(e, ND_out(prev));
* Remaining outedges are immediate right neighbors.
* FIX: Incremental algorithm to construct trans. reduction?
*/
-#ifndef WITH_CGRAPH
- vg = agopen("vg", AGDIGRAPHSTRICT);
-#else
vg = agopen("vg", Agstrictdirected, NIL(Agdisc_t *));
-#endif
for (p = (nitem *) dtflatten(list); p;
p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
-#ifndef WITH_CGRAPH
- n = agnode(vg, agnameof(p->np)); /* FIX */
-#else
n = agnode(vg, agnameof(p->np), 1); /* FIX */
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif
p->vnode = n;
ND_alg(n) = p;
}
for (nxp = nxt; nxp;
nxp = (nitem *) dtlink(list, (Dtlink_t *) nxp)) {
if (intersect(p, nxp))
-#ifndef WITH_CGRAPH
- agedge(vg, p->vnode, nxp->vnode);
-#else
agedge(vg, p->vnode, nxp->vnode, NULL, 1);
-#endif
}
}
alloc_elist(1, ND_in(an));
alloc_elist(1, ND_out(an));
-#ifndef WITH_CGRAPH
- e = agedge(cg, root, an);
-#else
e = agedge(cg, root, an, 1);
-#endif
ED_minlen(e) = p->val - root_val;
elist_append(e, ND_out(root));
elist_append(e, ND_in(an));
-#ifndef WITH_CGRAPH
- e = agedge(cg, an, vn);
-#else
e = agedge(cg, an, vn, 1);
-#endif
elist_append(e, ND_out(an));
elist_append(e, ND_in(vn));
-#ifndef WITH_CGRAPH
- e = agedge(cg, n, vn);
-#else
e = agedge(cg, n, vn, 1);
-#endif
elist_append(e, ND_out(n));
elist_append(e, ND_in(vn));
}
rank(cg, 2, INT_MAX);
#ifdef DEBUG
{
-#ifndef WITH_CGRAPH
- Agsym_t *mlsym = agedgeattr(cg, "minlen", "");
- Agsym_t *rksym = agnodeattr(cg, "rank", "");
-#else
Agsym_t *mlsym = agattr(cg, AGEDGE, "minlen", "");
Agsym_t *rksym = agattr(cg, AGNODE, "rank", "");
-#endif
char buf[100];
node_t *n;
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
}
}
}
void neato_init_node(node_t * n)
{
-#ifdef WITH_CGRAPH
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
common_init_node(n);
ND_pos(n) = N_NEW(GD_ndim(agraphof(n)), double);
gv_nodesize(n, GD_flip(agraphof(n)));
static void neato_init_edge(edge_t * e)
{
-#ifdef WITH_CGRAPH
- agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
+ agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //node custom data
common_init_edge(e);
-#ifndef WITH_CGRAPH
-
-#endif /* WITH_CGRAPH */
ED_factor(e) = late_double(e, E_weight, 1.0, 1.0);
}
if (posptr == NULL)
return FALSE;
pvec = ND_pos(np);
-#ifndef WITH_CGRAPH
- p = agxget(np, posptr->index);
-#else
p = agxget(np, posptr);
-#endif
if (p[0]) {
c = '\0';
if ((Ndim >= 3) &&
}
if (Ndim > 3)
jitter_d(np, nG, 3);
-#ifndef WITH_CGRAPH
- if ((c == '!') || (pinptr && mapbool(agxget(np, pinptr->index))))
-#else
if ((c == '!') || (pinptr && mapbool(agxget(np, pinptr))))
-#endif
ND_pinned(np) = P_PIN;
return TRUE;
}
pvec[i] = pvec[i] / PSinputscale;
}
if (Ndim > 2) {
-#ifndef WITH_CGRAPH
- if (N_z && (p = agxget(np, N_z->index)) && (sscanf(p,"%lf",&z) == 1)) {
-#else
if (N_z && (p = agxget(np, N_z)) && (sscanf(p,"%lf",&z) == 1)) {
-#endif
if (PSinputscale > 0.0) {
pvec[2] = z / PSinputscale;
}
else
jitter3d(np, nG);
}
-#ifndef WITH_CGRAPH
- if ((c == '!') || (pinptr && mapbool(agxget(np, pinptr->index))))
-#else
if ((c == '!') || (pinptr && mapbool(agxget(np, pinptr))))
-#endif
ND_pinned(np) = P_PIN;
return TRUE;
} else
if (Nop || (Pack < 0))
free_scan_graph(g);
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 neato_cleanup(graph_t * g)
#ifdef IPSEPCOLA
static cluster_data* cluster_map(graph_t *mastergraph, graph_t *g)
{
-#ifndef WITH_CGRAPH
- /* search meta-graph to find clusters */
- graph_t *mg;
- node_t *mm, *mn;
- edge_t *me;
-#endif
graph_t *subg;
node_t *n;
/* array of arrays of node indices in each cluster */
cluster_data *cdata = GNEW(cluster_data);
cdata->ntoplevel = agnnodes(g);
-#ifndef WITH_CGRAPH
- mm = mastergraph->meta_node;
- mg = agraphof(mm);
- for (me = agfstout(mg, mm); me; me = agnxtout(mg, me)) {
- mn = aghead(me);
- subg = agusergraph(mn);
-#else
for (subg = agfstsubg(mastergraph); subg; subg = agnxtsubg(subg)) {
-#endif
if (!strncmp(agnameof(subg), "cluster", 7)) {
nclusters++;
}
cdata->nclusters = nclusters;
cs = cdata->clusters = N_GNEW(nclusters,int*);
cn = cdata->clustersizes = N_GNEW(nclusters,int);
-#ifndef WITH_CGRAPH
- /* fprintf(stderr,"search %d clusters...\n",nclusters); */
- for (me = agfstout(mg, mm); me; me = agnxtout(mg, me)) {
- mn = me->head;
- subg = agusergraph(mn);
-#else
for (subg = agfstsubg(mastergraph); subg; subg = agnxtsubg(subg)) {
-#endif
/* clusters are processed by separate calls to ordered_edges */
if (!strncmp(agnameof(subg), "cluster", 7)) {
int *c;
int stype, etype;
static boolean warned;
-#ifndef WITH_CGRAPH
- pos = agxget(e, E_pos->index);
-#else
pos = agxget(e, E_pos);
-#endif
if (*pos == '\0')
return 0;
gv_free_splines(e);
if (!warned) {
warned = 1;
-#ifndef WITH_CGRAPH
- agerr(AGWARN, "pos attribute for edge (%s,%s) doesn't have 3n+1 points\n", e->tail->name, e->head->name);
-#else
agerr(AGWARN, "pos attribute for edge (%s,%s) doesn't have 3n+1 points\n", agnameof(agtail(e)), agnameof(aghead(e)));
-#endif
}
return 0;
}
if (i < 2) {
if (!warned) {
warned = 1;
-#ifndef WITH_CGRAPH
- agerr(AGWARN, "syntax error in pos attribute for edge (%s,%s)\n", e->tail->name, e->head->name);
-#else
agerr(AGWARN, "syntax error in pos attribute for edge (%s,%s)\n", agnameof(agtail(e)), agnameof(aghead(e)));
-#endif
}
free(ps);
gv_free_splines(e);
char *s;
boxf bb;
-#ifndef WITH_CGRAPH
- s = agxget(g, G_bb->index);
-#else
s = agxget(g, G_bb);
-#endif
if (sscanf(s, BS, &bb.LL.x, &bb.LL.y, &bb.UR.x, &bb.UR.y) == 4) {
if (bb.LL.y > bb.UR.y) {
/* If the LL.y coordinate is bigger than the UR.y coordinate,
* of subg, using parentg as the parent graph.
*/
static void
-#ifndef WITH_CGRAPH
-dfs(node_t * mn, Agraph_t * parentg, attrsym_t * G_lp, attrsym_t * G_bb)
-#else /* WITH_CGRAPH */
dfs(Agraph_t * subg, Agraph_t * parentg, attrsym_t * G_lp, attrsym_t * G_bb)
-#endif /* WITH_CGRAPH */
{
boxf bb;
-#ifndef WITH_CGRAPH
- graph_t *subg = agusergraph(mn);
-#endif
if (!strncmp(agnameof(subg), "cluster", 7) && chkBB(subg, G_bb, &bb)) {
-#ifdef WITH_CGRAPH
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif
GD_bb(subg) = bb;
add_cluster(parentg, subg);
nop_init_graphs(subg, G_lp, G_bb);
} else {
-#ifndef WITH_CGRAPH
- graph_t *mg = parentg->meta_node->graph;
- edge_t *me;
- for (me = agfstout(mg, mn); me; me = agnxtout(mg, me)) {
- dfs(me->head, parentg, G_lp, G_bb);
-#else
graph_t *sg;
for (sg = agfstsubg(subg); sg; sg = agnxtsubg(sg)) {
dfs(sg, parentg, G_lp, G_bb);
-#endif
}
}
}
static void
nop_init_graphs(Agraph_t * g, attrsym_t * G_lp, attrsym_t * G_bb)
{
-#ifndef WITH_CGRAPH
- graph_t *mg;
- edge_t *me;
-#else
graph_t *subg;
-#endif
char *s;
double x, y;
if (GD_label(g) && G_lp) {
-#ifndef WITH_CGRAPH
- s = agxget(g, G_lp->index);
-#else
s = agxget(g, G_lp);
-#endif
if (sscanf(s, "%lf,%lf", &x, &y) == 2) {
GD_label(g)->pos = pointfof(x, y);
GD_label(g)->set = TRUE;
if (!G_bb)
return;
-#ifndef WITH_CGRAPH
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- dfs(me->head, g, G_lp, G_bb);
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
dfs(subg, g, G_lp, G_bb);
-#endif /* WITH_CGRAPH */
}
}
/* If G_bb not defined, define it */
if (!G_bb)
-#ifndef WITH_CGRAPH
- G_bb = agraphattr(g, "bb", "");
-#else /* WITH_CGRAPH */
G_bb = agattr(g, AGRAPH, "bb", "");
-#endif /* WITH_CGRAPH */
scan_graph(g); /* mainly to set up GD_neato_nlist */
for (i = 0; (np = GD_neato_nlist(g)[i]); i++) {
return MODEL_SHORTPATH;
}
if ((c == 'm') && streq(p, "mds")) {
-#ifndef WITH_CGRAPH
- if (agindex(g->root->proto->e, "len") >= 0)
-#else /* WITH_CGRAPH */
if (agattr(g, AGEDGE, "len", 0))
-#endif /* WITH_CGRAPH */
return MODEL_MDS;
else {
agerr(AGWARN,
#ifdef DIGCOLA
float *edists = NULL;
#endif
-#ifndef WITH_CGRAPH
- int haveLen;
-#else
attrsym_t *haveLen;
-#endif
int haveWt;
int haveDir;
PointMap *ps = newPM();
haveLen = FALSE;
haveWt = FALSE;
} else {
-#ifndef WITH_CGRAPH
- haveLen = (agindex(g->root->proto->e, "len") >= 0);
-#else /* WITH_CGRAPH */
haveLen = agattr(g, AGEDGE, "len", 0) ;
-#endif /* WITH_CGRAPH */
haveWt = (E_weight != 0);
}
if (mode == MODE_HIER || mode == MODE_IPSEP)
model, (init == INIT_SELF), opts & opt_exp_flag, MaxIter, Epsilon);
fprintf(stderr, "convert graph: ");
start_timer();
-#ifdef WITH_CGRAPH
fprintf(stderr, "majorization\n");
-// fprintf(stderr, "%i\n", count_nodes(g));
-
-#endif /* WITH_CGRAPH */
+// fprintf(stderr, "%i\n", count_nodes(g));
}
gp = makeGraphData(g, nv, &ne, mode, model, &nodes);
if ((Ndim >= 3) && N_z) {
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
sprintf(buf, "%lf", POINTS_PER_INCH * (ND_pos(n)[2]));
-#ifndef WITH_CGRAPH
- agxset(n, N_z->index, buf);
-#else /* WITH_CGRAPH */
agxset(n, N_z, buf);
-#endif /* WITH_CGRAPH */
}
}
}
addCluster (graph_t* g)
{
graph_t *subg;
-#ifndef WITH_CGRAPH
- graph_t *mg;
- node_t *mm, *mn;
- edge_t *me;
- mm = g->meta_node;
- mg = agraphof(mm);
- for (me = agfstout(mg, mm); me; me = agnxtout(mg, me)) {
- mn = aghead(me);
- subg = agusergraph(mn);
-#else
for (subg = agfstsubg(agroot(g)); subg; subg = agnxtsubg(subg)) {
-#endif
if (!strncmp(agnameof(subg), "cluster", 7)) {
-#ifdef WITH_CGRAPH
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif
add_cluster(g, subg);
compute_bb(subg);
}
for (i = 0; i < n_cc; i++) {
gc = cc[i];
free_scan_graph(gc);
-#ifdef WITH_CGRAPH
agdelrec (gc, "Agraphinfo_t");
-#endif
agdelete(g, gc);
}
free (cc);
* Return 1 if attribute not defined
* Return 2 if attribute string bad
*/
-#ifdef WITH_CGRAPH
static int lenattr(edge_t* e, Agsym_t* index, double* val)
-#else
-static int lenattr(edge_t* e, int index, double* val)
-#endif
{
char* s;
-#ifdef WITH_CGRAPH
if (index == NULL)
-#else
- if (index < 0)
-#endif
return 1;
s = agxget(e, index);
return next;
}
-#ifdef WITH_CGRAPH
static double setEdgeLen(graph_t * G, node_t * np, Agsym_t* lenx, double dfltlen)
-#else
-static double setEdgeLen(graph_t * G, node_t * np, int lenx, double dfltlen)
-#endif
{
edge_t *ep;
double total_len = 0.0;
node_t *np, *xp, *other;
double total_len = 0.0;
double dfltlen = 1.0;
-#ifdef WITH_CGRAPH
Agsym_t* lenx;
-#else
- int lenx;
-#endif /* WITH_CGRAPH */
if (Verbose)
fprintf(stderr, "Scanning graph %s, %d nodes\n", agnameof(G),
nV = agnnodes(G);
nE = agnedges(G);
-#ifdef WITH_CGRAPH
lenx = agattr(G, AGEDGE, "len", 0);
-#else
- lenx = agindex(G->root->proto->e, "len");
-#endif
if (mode == MODE_KK) {
Epsilon = .0001 * nV;
getdouble(G, "epsilon", &Epsilon);
# $Id$Revision:
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/neatogen \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
if WITH_ORTHO
#define STRUCTURES_H
#include "types.h"
-#ifdef WITH_CGRAPH
#include "cgraph.h"
-#else
-#include "graph.h"
-#endif
#include "rawgraph.h"
typedef struct {
# $Id$Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
-I$(top_srcdir)/lib/sparse \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = osage.h
}
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-#ifdef WITH_CGRAPH
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //edge custom data
-#endif /* WITH_CGRAPH */
common_init_edge(e);
}
}
/* add user sort values if necessary */
if ((pinfo.mode == l_array) && (pinfo.flags & PK_USER_VALS)) {
-#ifdef WITH_CGRAPH
cattr = agattr(root, AGRAPH, "sortv", 0);
vattr = agattr(root, AGNODE, "sortv", 0);
-#else
- cattr = agfindattr(root, "sortv");
- vattr = agfindattr(root->proto->n, "sortv");
-#endif
if (cattr || vattr)
pinfo.vals = N_NEW(total, unsigned char);
else
static void
mkClusters (Agraph_t* g, clist_t* pclist, Agraph_t* parent)
{
-#ifndef WITH_CGRAPH
- node_t* mn;
- edge_t* me;
- graph_t* mg;
-#endif
graph_t* subg;
clist_t list;
clist_t* clist;
else
clist = pclist;
-#ifdef WITH_CGRAPH
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
if (!strncmp(agnameof(subg), "cluster", 7)) {
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
mkClusters(subg, clist, parent);
}
}
-#else
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = me->head;
- subg = agusergraph(mn);
- if (!strncmp(agnameof(subg), "cluster", 7)) {
- do_graph_label (subg);
- addCluster(clist, subg);
- mkClusters(subg, NULL, subg);
- }
- else {
- mkClusters(subg, clist, parent);
- }
- }
-#endif
if (pclist == NULL) {
GD_n_cluster(g) = list.cnt;
if (list.cnt)
pdfdir = $(pkgdatadir)/doc/pdf
#pkgconfigdir = $(libdir)/pkgconfig
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = -I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/gvc \
-I$(top_srcdir)/lib/neatogen \
-I$(top_srcdir)/lib/pathplan \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
if WITH_WIN32
*/
static void insertFn(Agnode_t * n, void *state)
{
-#ifndef WITH_CGRAPH
- aginsert((Agraph_t *) state, n);
-#else /* WITH_CGRAPH */
agsubnode((Agraph_t *) state,n,1);
-#endif /* WITH_CGRAPH */
}
/* pccomps:
continue;
if (!out) {
sprintf(name + len, "%d", c_cnt);
-#ifndef WITH_CGRAPH
- out = agsubg(g, name);
-#else /* WITH_CGRAPH */
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
ccs[c_cnt] = out;
c_cnt++;
pin = TRUE;
if (MARKED(n))
continue;
sprintf(name + len, "%d", c_cnt);
-#ifndef WITH_CGRAPH
- out = agsubg(g, name);
-#else /* WITH_CGRAPH */
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
dfs(g, n, insertFn, out, &stk);
if (c_cnt == bnd) {
bnd *= 2;
if (MARKED(n))
continue;
sprintf(name + len, "%d", c_cnt);
-#ifndef WITH_CGRAPH
- out = agsubg(g, name);
-#else /* WITH_CGRAPH */
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
-#endif /* WITH_CGRAPH */
dfs(g, n, insertFn, out, &stk);
if (c_cnt == bnd) {
bnd *= 2;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
for (e = agfstout(root, n); e; e = agnxtout(root, e)) {
if (agcontains(g, aghead(e))) { /* test will always be true */
-#ifndef WITH_CGRAPH
- aginsert(g, e); /* for connected component */
-#else /* WITH_CGRAPH */
agsubedge(g,e,1);
-#endif /* WITH_CGRAPH */
e_cnt++;
}
}
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
-I$(top_srcdir)/lib/sparse \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = patchwork.h tree_map.h
{
char buf [40];
if (N_fontsize) {
-#ifndef WITH_CGRAPH
- char* str = agxget(n, N_fontsize->index);
-#else
char* str = agxget(n, N_fontsize);
-#endif
if (*str == '\0') {
sprintf (buf, "%.03f", ND_ht(n)*0.7);
-#ifndef WITH_CGRAPH
- agxset(n, N_fontsize->index, buf);
-#else /* WITH_CGRAPH */
agxset(n, N_fontsize, buf);
-#endif /* WITH_CGRAPH */
}
}
common_init_node (n);
graph_t* subg;
clist_t list;
clist_t* clist;
-#ifndef WITH_CGRAPH
- node_t* mn;
- edge_t* me;
- graph_t* mg;
-#endif
if (pclist == NULL) {
clist = &list;
else
clist = pclist;
-#ifndef WITH_CGRAPH
- mg = g->meta_node->graph;
- for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
- mn = aghead(me);
- subg = agusergraph(mn);
-#else /* WITH_CGRAPH */
for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
-#endif /* WITH_CGRAPH */
if (!strncmp(agnameof(subg), "cluster", 7)) {
-#ifdef WITH_CGRAPH
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
-#endif
#ifdef FDP_GEN
GD_alg(subg) = (void *) NEW(gdata); /* freed in cleanup_subgs */
GD_ndim(subg) = GD_ndim(parent);
GD_neato_nlist(g) = N_NEW(agnnodes(g) + 1, node_t *);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-#ifdef WITH_CGRAPH
agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); // node custom data
-#endif /* WITH_CGRAPH */
ND_alg(n) = alg + i;
GD_neato_nlist(g)[i++] = n;
patchwork_init_node(n);
static void patchwork_init_graph(graph_t * g)
{
-#ifndef WITH_CGRAPH
- N_shape = agnodeattr(g, "shape", "box");
-#else
N_shape = agattr(g, AGNODE, "shape","box");
-#endif
setEdgeType (g, ET_LINE);
/* GD_ndim(g) = late_int(g,agfindattr(g,"dim"),2,2); */
Ndim = GD_ndim(g) = 2; /* The algorithm only makes sense in 2D */
{
free(GD_neato_nlist(g));
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 patchwork_cleanup(graph_t * g)
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/rbtree \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = sfdpinternal.h spring_electrical.h \
static void sfdp_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);
}
int rv;
if (!sym) return dflt;
-#ifdef WITH_CGRAPH
s = agxget (g, sym);
-#else
- s = agxget (g, sym->index);
-#endif
if (isdigit(*s)) {
if ((v = atoi (s)) <= METHOD_UNIFORM_STRESS)
rv = v;
int rv;
if (!sym) return dflt;
-#ifdef WITH_CGRAPH
s = agxget (g, sym);
-#else
- s = agxget (g, sym->index);
-#endif
if (isdigit(*s)) {
#if (HAVE_GTS || HAVE_TRIANGLE)
if ((v = atoi (s)) <= SMOOTHING_RNG)
int rv;
if (!sym) return dflt;
-#ifdef WITH_CGRAPH
s = agxget (g, sym);
-#else
- s = agxget (g, sym->index);
-#endif
if (isdigit(*s)) {
if ((v = atoi (s)) <= QUAD_TREE_FAST && v >= QUAD_TREE_NONE){
rv = v;
# $Id$ $Revision$
## Process this file with automake to produce Makefile.in
-if WITH_CGRAPH
-GRAPH = cgraph
-else
-GRAPH = graph
-endif
-
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/pack \
-I$(top_srcdir)/lib/pathplan \
-I$(top_srcdir)/lib/sparse \
- -I$(top_srcdir)/lib/$(GRAPH) \
+ -I$(top_srcdir)/lib/cgraph \
-I$(top_srcdir)/lib/cdt
noinst_HEADERS = circle.h
static void twopi_init_edge(edge_t * e)
{
-#ifdef WITH_CGRAPH
agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //edge custom data
-#endif /* WITH_CGRAPH */
common_init_edge(e);
ED_factor(e) = late_double(e, E_weight, 1.0, 0.0);
}
{
free(GD_neato_nlist(g));
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 */
}
/* twopi_cleanup: