Open In App

SymPy | Prufer.next() in Python

Improve
Improve
Like Article
Like
Save
Share
Report

Prufer.next() : next() is a sympy Python library function that returns the Prufer sequence that is delta beyond the current one.

Syntax :
sympy.combinatorics.Prufer.prufer.next()

Return :
Prufer sequence that is delta beyond the current one

Code #1 : next() Example




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


Output :

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

Code #2 : next() Example




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


Output :

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



Last Updated : 28 Aug, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads