Created
May 14, 2018 09:47
-
-
Save RedaAffane/118a0b4448fa0b744fc48a2a0a2e283b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def subsets(s): | |
''' | |
This function returns all the possible subsets of a set of channels. | |
input : | |
- s: a set of channels. | |
''' | |
if len(s)==1: | |
return s | |
else: | |
sub_channels=[] | |
for i in range(1,len(s)+1): | |
sub_channels.extend(map(list,itertools.combinations(s, i))) | |
return map(",".join,map(sorted,sub_channels)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment