/* isEdge: * Return edge, if any, between t and h with given key. * Edge is in root graph */ Agedge_t *isEdge(Agnode_t * t, Agnode_t * h, char *key) { Agraph_t *root; if ((root = sameG(t, h, "isEdge", "tail and head node"))) { t = (Agnode_t *) agrebind(root, OBJ(t)); h = (Agnode_t *) agrebind(root, OBJ(h)); return agedge(t, h, key, 0); } else return 0; }
/* isIn: * Return 1 if object objp is in subgraph gp. */ int isIn(Agraph_t * gp, Agobj_t * objp) { if (!sameG(gp, objp, "isIn", 0)) return 0; switch (AGTYPE(objp)) { case AGRAPH: return (agparent((Agraph_t *) objp) == gp); case AGNODE: return (agidnode(gp, AGID(objp), 0) != 0); default: return (agsubedge(gp, (Agedge_t *) objp, 0) != 0); } }
/* isEdge: * Return edge, if any, between t and h with given key. * Edge is in g. */ Agedge_t *isEdge(Agraph_t* g, Agnode_t * t, Agnode_t * h, char *key) { Agraph_t *root; root = sameG(t, h, "isEdge", "tail and head node"); if (!root) return 0; if (g) { if (root != agroot(g)) return 0; } else g = root; return agedge(g, t, h, key, 0); }
/* addEdge: * Insert edge e into subgraph g. * Return image of e */ Agedge_t *addEdge(Agraph_t * gp, Agedge_t * ep, int doAdd) { if (!sameG(gp, ep, "addEdge", 0)) return 0; return agsubedge(gp, ep, doAdd); }
/* addNode: * Insert node n into subgraph g. * Return image of n */ Agnode_t *addNode(Agraph_t * gp, Agnode_t * np, int doAdd) { if (!sameG(gp, np, "addNode", 0)) return 0; return agsubnode(gp, np, doAdd); }
/* addEdge: * Insert edge e into subgraph g. * Return image of e */ Agedge_t *addEdge(Agraph_t * gp, Agedge_t * ep) { if (!sameG(gp, ep, "addEdge", 0)) return 0; return agsubedge(gp, ep, 1); }
/* addNode: * Insert node n into subgraph g. * Return image of n */ Agnode_t *addNode(Agraph_t * gp, Agnode_t * np) { if (!sameG(gp, np, "addNode", 0)) return 0; return agsubnode(gp, np, 1); }