5
nodeInduce(Agraph_t *selected)
11
if (!selected) return;
12
base = agroot (selected);
13
if (base == selected) return;
14
for (n = agfstnode(selected); n; n = agnxtnode(n)) {
15
for (e = agfstout(agsubnode(base,n,FALSE)); e; e = agnxtout(e)) {
16
if (agsubnode(selected,aghead(e),FALSE))
17
agsubedge(selected,e,TRUE);
23
* Copy attributes from src to tgt. Overrides currently
27
copyAttr (int kind, Agobj_t* src, Agobj_t* tgt)
36
while (sym = agnxtattr(srcg,kind,sym)) {
37
tsym = agattrsym (tgt, sym->name);
39
tsym = agattr(tgtg,kind,sym->name,"");
40
agxset (tgt, tsym, agxget(src,sym));
45
* Create new object of type AGTYPE(obj) with all of its
47
* If obj is an edge, create end nodes if necessary, but
48
* do not copy the attributes.
49
* If obj is a graph, if g is null, create a clone top-level
50
* graph. Otherwise, create a clone subgraph of g.
52
Agobj_t* clone(Agraph_t *g, Agobj_t* obj)
58
int kind = AGTYPE(obj);
60
if (!obj || ((kind != AGRAPH) && !g)) return 0;
64
nobj = (Agobj_t*)agnode (g, agnameof(obj), 1);
65
if (nobj) copyAttr (kind,obj,nobj);
68
error (3, "clone of graph unimplemented");
72
t = agnode (g, agnameof(agtail(e)), 1);
73
h = agnode (g, agnameof(aghead(e)), 1);
74
nobj = (Agobj_t*)agedge (t, h, agnameof(obj), 1);
75
if (nobj) copyAttr (kind,obj,nobj);