addedges 291 B

1234567891011121314151617181920
  1. /* Add edges from input graph to argument graph
  2. * Does not add nodes.
  3. */
  4. BEGIN{
  5. graph_t g = readG(ARGV[0]);
  6. node_t h, t;
  7. edge_t e;
  8. }
  9. E {
  10. if ((h = isNode(g,head.name)) && (t = isNode(g,tail.name))) {
  11. if (!isEdge(t,h,"")) {
  12. e = copy(g,$);
  13. }
  14. }
  15. }
  16. END {
  17. write(g);
  18. }