SymPy | Prufer.rank() in Python
Last Updated :
26 Aug, 2019
Prufer.rank() : rank() is a sympy Python library function that returns the rank of the Prufer sequence.
Syntax :
sympy.combinatorics.Prufer.prufer.rank()
Return :
rank of the Prufer sequence
Code #1 : rank() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
a = Prufer([ 1 , 2 , 3 ], [ 2 , 4 , 5 ])
print ( "Prufer a rank : " , a.rank)
|
Output :
Prufer a rank : 38
Code #2 : rank() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
b = Prufer([ 1 , 2 , 3 , 2 , 4 , 5 ], [ 6 , 7 ], [ 8 ])
print ( "Prufer b rank : " , b.rank)
|
Output :
Prufer b rank : 42661
Share your thoughts in the comments
Please Login to comment...