Add an additional option that accepts a some data structure (probably list of tuples) which allows users of the group/2 function to prohibit certain elements from being in the same group.
As an examples of the general gist:
iex> group([1,2,3,4], %{minimum: 2, maximum: 2, prohibited: [{1, [2]}]})
[[1, 3], [2,4]
iex> group([1,2,3,4], %{minimum: 2, maximum: 2, prohibited: [{1, [2]}, {3, [1, 2]}]})
:impossible
The second example is prohibited, because for 3 to not be in the same group as 1 and 2, 1 and 2 must be in the same group, which breaks the other prohibited constraint.