Logic for creating mutually exclusive groups of individuals (clusters)
Solve it the opposite way.
Rather than trying all combinations and then checking which conflict, first find all conflicts.
So if a record is in groups A, B, and O, then mark AB, AO, and BO as incompatible. When going through combinations, you can easily check that adding B is impossible if you chose to use A etc.
I have survey data with about 100 columns for every individual. Based on certain criteria, for eg. a column contains info of whether a person reads comics and another column contains info of whether a person reads comics.
I want to validate if the user has created clusters/groups that are mutually exclusive.
eg. Group 1: Males with age 0-25 reading comics, Group 2: Males with age 20-25 reading comics as well as newspaper. In this case, I want to generate a warning that the groups are not mutually exclusive.
One (inefficient) way of doing is creating a list of individuals for every group and then finding intersection for every combination of groups. If there is intersection, the groups are not mutually exclusive and hence incorrect.
What is an efficient way of doing this?
One (inefficient) way of doing is creating a list of individuals for every group and then finding intersection for every combination of groups. If there is intersection, the groups are not mutually exclusive and hence incorrect.
Expected result:
The created groups are mutually exclusive.
or
The created groups are not mutually exclusive.