Code for counting the number of triples belonging to graphids.