I'm looking for a way in Python to split an arbitrary number of items into an arbitrary number of even groups, and to obtain the list/array of all these splits.
So for example, given 12 items, there are 5775 ways of grouping them into 3 groups of 4. Calculating this is not an issue, but I can't seem to find a way to return a list or array of these 5775. I can get the first groups using:
import itertools
list(itertools.combinations(range(12), 4))
But how can I obtain the remaining groups from this?
The desired output for a = 4, b = 2, c = 2 would be:
[[[1, 2], [3, 4]],
[[1, 3], [2, 4]],
[[1, 4], [2, 3]]]
And for a = 3, b = 3, c = 1:
[[[1], [2], [3]]]