(self)
return self._rank_graycode
Computes the Gray code ranking of the subset.

        Examples
        ========

        >>> from sympy.combinatorics.subsets import Subset
        >>> a = Subset(['c','d'], ['a','b','c','d'])
        >>> a.rank_gray
        2
        >>> a = Subset([2,4,5], [1,2,3,4,5,6])
        >>> a.rank_gray
        27

        See Also
        ========
        iterate_graycode, unrank_gray
Computes the Gray code ranking of the subset.
Computes the Gray code ranking of the subset .
def rank_gray(self):
        """
        Computes the Gray code ranking of the subset.

        Examples
        ========

        >>> from sympy.combinatorics.subsets import Subset
        >>> a = Subset(['c','d'], ['a','b','c','d'])
        >>> a.rank_gray
        2
        >>> a = Subset([2,4,5], [1,2,3,4,5,6])
        >>> a.rank_gray
        27

        See Also
        ========
        iterate_graycode, unrank_gray
        """
        if self._rank_graycode is None:
            bits = Subset.bitlist_from_subset(self.subset, self.superset)
            self._rank_graycode = GrayCode(len(bits), start=bits).rank
        return self._rank_graycode
def rank_gray ( self ) : if self . _rank_graycode is None : bits = Subset . bitlist_from_subset ( self . subset , self . superset ) self . _rank_graycode = GrayCode ( len ( bits ) , start = bits ) . rank return self . _rank_graycode