Debian Codegraph @

cmd/gvpr/lib/anon

raw
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
11 if ($.directed) gtype = "D";
12 else gtype = "U";
13 if ($.strict) gtype = gtype + "S";
14 dup = graph ($.name, gtype);
15 $tvtype = TV_ne;
16 }
17
18 N {
19 n = node(dup, (char*)id);
20 n.label=$.name;
21 map[$] = n;
22 id++;
23 }
24
25 E {
26 edge (map[$.tail],map[$.head],"");
27 }
28
29 END_G {
30 write (dup);
31 }