SymPy | Prufer.prev() in Python
Last Updated :
26 Aug, 2019
Prufer.prev() : prev() is a sympy Python library function that returns the Prufer sequence that is delta before the current one.
Syntax :
sympy.combinatorics.Prufer.prufer.prev()
Return :
Prufer sequence that is delta before the current one
Code #1 : prev() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
a = Prufer([ 1 , 2 , 3 ], [ 2 , 4 , 5 ])
print ( "Prufer a prev : " , a.prev( 1 ))
|
Output :
Prufer a prev : Prufer([1, 2, 4])
Code #2 : prev() 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 prev : " , b.prev( 1 ))
|
Output :
Prufer b prev : Prufer([1, 2, 3, 2, 4, 4])
Share your thoughts in the comments
Please Login to comment...