changed generate cliques so that the order of the items is the same as in cpd file