-
Notifications
You must be signed in to change notification settings - Fork 0
/
el_ph_topological_inequiv.py
57 lines (53 loc) · 1.82 KB
/
el_ph_topological_inequiv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from el_ph_disconnected import *
import itertools
def all_swapps_ph(inp_n):
all_trans=[]
kk_indiv=[]
for i in pair_gen_ph(inp_n): # gens individual k-->k' transforms
kk_indiv.append(i)
kk_multi=[]
n_var=inp_n-1
while n_var!=0:
permute=list(itertools.combinations(kk_indiv,n_var))
kk_multi.append(permute)
n_var-=1
for i in kk_multi:
all_trans.extend(i) # gens all k-->k' transf permutations
perm=list(itertools.combinations(var_list_noone_ph(inp_n),2))
for i in list(kk_indiv):
a=i[0]
b=i[1]
c=(a,b)
if c in perm:
perm.remove(c)
perm2=list(itertools.combinations(perm,2))
pair_swaps_indiv=[]
for i in perm2:
counter1=counterpart_ph(i[0][0],pair_gen_ph(inp_n))
counter2=counterpart_ph(i[0][1],pair_gen_ph(inp_n))
if i[1][0]==counter1:
if i[1][1]==counter2:
pair_swaps_indiv.append(i) # gens individual swap pairs
pair_multi=[]
n_var=inp_n-1
while n_var!=0:
permute=list(itertools.combinations(pair_swaps_indiv,n_var))
for i in permute:
pperm=[]
for j in i:
for k in j:
pperm.append(k)
pair_multi.append(pperm)
n_var-=1
all_trans.extend(pair_multi) # gens all swap pair permutations
kk_intpair_combs=[]
for i in kk_multi:
for j in i:
for o in pair_multi:
tmp=[]
tmp.extend(j)
tmp.extend(o)
kk_intpair_combs.append(tmp)
for i in kk_intpair_combs:
all_trans.append(i) # gens all permutations of k-->k' and swap pairs
return all_trans