typedef char Agraphinfo_t;
typedef char Agedgeinfo_t;
typedef char Agnodeinfo_t;
#include <graph.h>
void
prg(Agraph_t* g)
{
Agnode_t* n;
Agedge_t* e;
fprintf (stderr, "%sn", g->name);
for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
fprintf (stderr, "%s (%x)n", n->name, n);
for (e = agfstout(g,n); e; e = agnxtout(g,e)) {
fprintf (stderr, "%x: %x (%s) -- %x (%s), color = %sn",
e, e->tail, e->tail->name, e->head, e->head->name,
agget(e,"color"));
}
}
}
main ()
{
Agraph_t* g;
Agraph_t* sg;
Agnode_t* t;
Agnode_t* h;
Agedge_t* e;
Agedge_t* ep;
aginit();
g = agopen ("x", AGFLAG_STRICT);
agedgeattr (g, "color","");
t = agnode (g, "a");
h = agnode (g, "b");
e = agedge (g, t, h);
agset (e, "color", "blue");
sg = agsubg (g, "y");
aginsert (sg, t);
aginsert (sg, h);
ep = agedge (sg, t, h); /* line A */
/* ep = agedge (sg, h, t); */ /* line B */
agset (ep, "color", "red");
prg (g);
prg (sg);
}