I am looking for a smart algorithm or pythonic approach to create clusters from pairs of data.
The input data is structured like this:
[
(productA,ProductB),
(productB,ProductC),
(productC,ProductD),
(productA,ProductD),
(productD,ProductB),
(productC,ProductA),
(productE,ProductF),
(productF,ProductG),
(productG,ProductH),
(productG,ProductE),
]
and it should be clustered to:
[
(productA,productB,productC,productD),
(productE,productF,productG,productH)
]
How can this be achieved? (The order of the products within the two clusters does not matter)
Any ideas are greatly appreciated!