📜  SymPy | Python中的 Prufer.next()

📅  最后修改于: 2022-05-13 01:54:58.014000             🧑  作者: Mango

SymPy | Python中的 Prufer.next()

Prufer.next() :next()是一个 sympy Python库函数,它返回比当前序列差 delta 的 Prufer 序列。

代码 #1:next() 示例

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

输出 :

代码 #2:next() 示例

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

输出 :