class_docstr: Represents a basic subset object.
  
  Explanation
  ===========
  
  We generate subsets using essentially two techniques,
  binary enumeration and lexicographic enumeration.
  The Subset class takes two arguments, the first one
  describes the initial subset to consider and the second
  describes the superset.
  
  Examples
  ========
  
  >>> from sympy.combinatorics import Subset
  >>> a = Subset(['c', 'd'], ['a', 'b', 'c', 'd'])
  >>> a.next_binary().subset
  ['b']
  >>> a.prev_binary().subset
  ['c']
class_docstr_tok: ["Represents","a","basic","subset","object",".","Explanation","===========","We","generate","subsets","using","essentially","two","techniques",",","binary","enumeration","and","lexicographic","enumeration",".","The","Subset","class","takes","two","arguments",",","the","first","one","describes","the","initial","subset","to","consider","and","the","second","describes","the","superset",".","Examples","========",">",">",">","from","sympy.combinatorics","import","Subset",">",">",">","a","=","Subset","(","[","'","c","'",",","'d","'","]",",","[","'","a","'",",","'","b","'",",","'","c","'",",","'d","'","]",")",">",">",">","a.next_binary","(",")",".subset","[","'","b","'","]",">",">",">","a.prev_binary","(",")",".subset","[","'","c","'","]"]
docstr: Computes the Gray code ranking of the subset.
  
  Examples
  ========
  
  >>> from sympy.combinatorics 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
docstr_tok: ["Computes","the","Gray","code","ranking","of","the","subset",".","Examples","========",">",">",">","from","sympy.combinatorics","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"]
code: def rank_gray(self):
      """
      Computes the Gray code ranking of the subset.
  
      Examples
      ========
  
      >>> from sympy.combinatorics 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
  
imports: from itertools import combinations
  from sympy.combinatorics.graycode import GrayCode
label_desc: Use image node_id 13 for calling the Subset obj's underlying member method code with example usage: obj.rank_gray() and returns: self