chkclusters 532 B

12345678910111213141516171819202122232425262728
  1. /* Report if graph has non-hierarchical clusters */
  2. BEGIN {
  3. graph_t c[node_t];
  4. node_t n;
  5. void proc (graph_t h, graph_t p, graph_t g)
  6. {
  7. if (h.name == "cluster*") {
  8. for (n = fstnode(h); n; n = nxtnode_sg(h,n)) {
  9. g = c[n];
  10. if (g) {
  11. if (g != p) {
  12. printf(2,"node %s in %s and %s\n", n.name, h.name, g.name);
  13. exit(1);
  14. }
  15. }
  16. c[n] = h;
  17. }
  18. p = h;
  19. }
  20. for (g = fstsubg(h); g; g = nxtsubg(g)) {
  21. proc(g,p,NULL);
  22. }
  23. }
  24. }
  25. BEG_G {
  26. proc($,$,NULL);
  27. }