SymPy | Subset.rank_gray() in Python
Subset.rank_gray() : rank_gray() is a sympy Python library function that returns the Gray code ranking of the subset.
Syntax :
sympy.combinatorics.subset.Subset.rank_gray()
Return :
Gray code ranking of the subset
Code #1 : rank_gray() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
a = Subset([ 'c' , 'd' ], [ 'geek' , 'for' , 'c' , 'd' ])
print ( "Subset a rank_gray : " , a.rank_gray)
|
Output :
Subset a rank_gray : 2
Code #2 : rank_gray() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
a = Subset([ 2 , 3 , 4 ], [ 1 , 2 , 3 , 4 , 5 ])
print ( "Subset a rank_gray : " , a.rank_gray)
|
Output :
Subset a rank_gray : 11
Last Updated :
26 Aug, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...