I have a Set of Set's of Integers For example: {{1,3}, {5,7}, {2,10,16}} Now i want the largest (in terms of elements) subset of Sets that only contains Set's in which each element has a minimal difference (pairwise) to each other element from all set's for example with the set {{1,3}, {5,7}, {2,10, 16}} and the minimum difference 2 an possible solution would be: {{1,3}, {5,7}} because 1,3,5 and 7 have a minimal distance to all elements (excluding itself). The third Set {2,10} ist not chosen because 2 has not enough distance to 1. Is there a know algorithm/method to do that ?