anon 422 B

12345678910111213141516171819202122232425262728293031
  1. /* anonymize the graph */
  2. BEG_G {
  3. node_t map[node_t];
  4. graph_t dup;
  5. int id = 0;
  6. char* gtype;
  7. node_t n;
  8. edge_t e;
  9. char* l;
  10. if ($.directed) gtype = "D";
  11. else gtype = "U";
  12. if ($.strict) gtype = gtype + "S";
  13. dup = graph ($.name, gtype);
  14. $tvtype = TV_ne;
  15. }
  16. N {
  17. n = node(dup, (char*)id);
  18. n.label=$.name;
  19. map[$] = n;
  20. id++;
  21. }
  22. E {
  23. edge (map[$.tail],map[$.head],"");
  24. }
  25. END_G {
  26. write (dup);
  27. }