2025-06-04, permutation20250428.py

# (C) David Vajda
# 2025-04-25
# Python 3 Permutation fuer Graphen


print ("(C) David Vajda")
print ("2025-04-25")
print ("Python 3 Permutation fuer Graphen")

print ("")
print ("Original")
print ("")

V = []

i = 1
while i <= 8:
    V.append (i)
    i = i + 1

i = 0
while i < 8:
    print (V[i])
    i = i + 1

import random

random.seed ()

i = 7
VP = []
while i >= 0:
    q = random.randint (0,i)
    VP.append (V[q])
    del (V[q])
    i = i - 1
print ("")
print ("Permutiert")
print ("")
i = 0
while i < 8:
    print ('die ist eine permutiertes etwas', VP [i])
    i = i + 1

Estr = input("Bitte geben sie eine Kantenmenge an ")

print (Estr)

flag = random.randint (0,1)
if flag == 1:
    i = 0
    while i < 8:
        Estr = Estr.replace (str(i + 1), str(VP [i]))
        i = i + 1
else:
    i = 0
    while i < 8:
        j = 0
        while j < 6:
            flag = random.randint (0,1)
            if flag == 1:
                Estr = Estr.replace (str(i + 1), str (VP [i]),1)
            else:
                Estr = Estr.replace (str(i + 1), str (random.randint (1,8)),1)
            j = j + 1
        i = i + 1
print (Estr)