SymPy | Prufer.prufer_rank() in Python
Last Updated :
26 Aug, 2019
Prufer.prufer_rank() : prufer_rank() is a sympy Python library function that calculates the rank of a Prufer sequence
Syntax :
sympy.combinatorics.Prufer.prufer.prufer_rank()
Return :
rank of a Prufer sequence
Code #1 : prufer_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 prufer_rank : " , a.prufer_rank())
|
Output :
Prufer a prufer_rank : 38
Code #2 : prufer_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 prufer_rank : " , b.prufer_rank())
|
Output :
Prufer b prufer_rank : 42661
Share your thoughts in the comments
Please Login to comment...