(self, sets)
return disjoint_sets, included_tables
Return all disjoint subsets.
Return all disjoint subsets.
Return all disjoint subsets .
def get_disjoint(self, sets):
        """
        Return all disjoint subsets.
        """
        sets = list(sets)
        n = len(sets)
        disjoint_sets = [None] * (2 ** n)
        included_tables = [None] * (2 ** n)
        for i in range(2 ** n):
            key = setkey(i, n)
            included = [s for s, inc in zip(sets, key) if inc]
            if included:
                excluded = [s for s, inc in zip(sets, key) if not inc]
                s = reduce(set.intersection, included)
                s = reduce(set.difference, excluded, s)
            else:
                s = set()
            disjoint_sets[i] = s
            included_tables[i] = [k for k, inc in zip(self.data, key) if inc]

        return disjoint_sets, included_tables
def get_disjoint ( self , sets ) : sets = list ( sets ) n = len ( sets ) disjoint_sets = [ None ] * ( 2 ** n ) included_tables = [ None ] * ( 2 ** n ) for i in range ( 2 ** n ) : key = setkey ( i , n ) included = [ s for s , inc in zip ( sets , key ) if inc ] if included : excluded = [ s for s , inc in zip ( sets , key ) if not inc ] s = reduce ( set . intersection , included ) s = reduce ( set . difference , excluded , s ) else : s = set ( ) disjoint_sets [ i ] = s included_tables [ i ] = [ k for k , inc in zip ( self . data , key ) if inc ] return disjoint_sets , included_tables