Skip to content

Instantly share code, notes, and snippets.

@mharju
Created August 31, 2011 05:12
Show Gist options
  • Save mharju/1182864 to your computer and use it in GitHub Desktop.
Save mharju/1182864 to your computer and use it in GitHub Desktop.
Etsii ne lähtöjoukon n/2-kombinaatiot, joiden unioni muodostaa koko lähtöjoukon
def set_bipartitioning_combinations(iterable):
return ( (i, j) for i in itertools.permutations(iterable, len(iterable) / 2)
for j in itertools.permutations(iterable, len(iterable) / 2)
if set(i).union(j) == set(iterable) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment