Friday, September 5, 2025
HomeLanguagesSymPy | Prufer.prufer_repr() in Python

SymPy | Prufer.prufer_repr() in Python

Prufer.prufer_repr() : prufer_repr() is a sympy Python library function that returns the Prufer sequence for the Prufer object. By removing the highest numbered vertex, then recording the node it was attached to, and finally continuing until only two vertices remain, the sequence can be found.

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

Return :
Prufer sequence for the Prufer object

Code #1 : prufer_repr() Example




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


Output :

Prufer a prufer_repr : [1, 2, 3]

Code #2 : prufer_repr() Example




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


Output :

Prufer b prufer_repr : [1, 2, 3, 2, 4, 5]

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS