Suppose I have an array like this:
[[1,2,3]
[0,4,2]
[4,2,5]
[6,1,1]
[1,3,5]
[3,0,1]
[0,4,2]]
I want to categorize the rows of the array by letting any row that have an element in common with some other row belong to the same category. In general, the arrays may not only consist of integers but could be any float. It is a requirement that the elements must agree in the same position. For the above array, the categories would be
[[0],
[1],
[0],
[2],
[0],
[2],
[1]]
Note: Every member in each category should share a common number at common position with AT LEAST ONE other member in the same category. Not all pairs of members in the same category need to share common number at common position.
Can you think of a solid way to do this?