I have a set of objects with different attributes; e.g. a set of cars with colors, brand etc. I choose subsets by virtue of a specific set of attributes.
Now I want to identify pairs of such subsets that differ only by one element.
Eg. say I have 4 cars:
A: Red, Ford
B: Red, Ford
C: Blue, Ford
D: Green, Volvo
Then the set of “Ford” cars is [A,B,C] and the set of “Red” cars is [A,B], i.e. these two sets only differ by one element and would be identified. However the set of “Volvo” cars [D] differs by more than one element from all other possible subsets (looking only at subsets according to a specific set of attributes), and would not be identified as part of a pair.
Is there a generalized algorithm for this specific set problem/logic (identifying the existence of such sets), and/or solutions for identifying such sets that is smarter than generating and testing all possible permutations of possible sets against each other?