Skip to content
Related Articles
SymPy | Prufer.next() in Python
• Last Updated : 28 Aug, 2019

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])

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up