Open In App

SymPy | Prufer.prev() in Python

Last Updated : 26 Aug, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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




# Python code explaining
# SymPy.Prufer.prev()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
  
# Using from 
# sympy.combinatorics.prufer.Prufer.prev()
  
# Creating Prufer
a = Prufer([1, 2, 3], [2, 4, 5])
  
# prev value
print ("Prufer a prev : ", a.prev(1))


Output :

Prufer a prev : Prufer([1, 2, 4])

Code #2 : prev() Example




# Python code explaining
# SymPy.Prufer.prev()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
  
# Using from 
# sympy.combinatorics.prufer.Prufer.prev()
  
# Creating Prufer
b = Prufer([1, 2, 3, 2, 4, 5], [6, 7], [8])
  
# prev value
print ("Prufer b prev : ", b.prev(1))


Output :

Prufer b prev : Prufer([1, 2, 3, 2, 4, 4])



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads