I'm facing rather simple but for me quite problematic thing cause I can't get through this. So far I've been able to identify certain tools in Python (namely chain, combinations, permutations and product from itertools). The problem is that none of this helped me much or it might be that there is a way to use them properly to solve the problem.
The problem is:
Let's assume I'm having a list of sets (or a list of lists):
[(1,), (2,), (3,), (1,2), (2,3)]
What I want to achieve is to get certain combination of these sets but the result can't combine the inner body of every set, i. e. it can't produce something like this:
[(1,2,3), (2,3,1)]
cause the sets has to be separated. So the proper result would be something like this:
[[(1,),(2,),(1,2)], [(1,), (2,3)]]
So as you can see it would produce a sets of lists in a list cause the whole idea is to save the sets along the combination. It would be nice to provide max length lists containing sets, i. e. all combinations with length from 1 to 3.
Itertools is nice but it does ruin the sets making them undistinguishable. My idea was to maybe make combination of list of indexes where every index will represent a set, i. e.
[0,1,2,3,4] -> [(0,2,3), (0,1)] -> which translates into -> [[(1,),(3,),(1,2)], [(1,), (2,)]]
I hope you might get an idea what I want to get here.