-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20_3.py
132 lines (117 loc) · 5.65 KB
/
20_3.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import numpy as np
from itertools import permutations
from k_wl import k_wl_test
from true_yes import true_yes, true_yes_no_print
if __name__ == "__main__":
adj_int = np.array( [[1, 2, 3, 4, 3, 2, 3, 2, 3, 3, 2, 2],
[2, 1, 4, 3, 3, 2, 3, 2, 2, 2, 3, 3],
[3, 4, 1, 2, 2, 3, 2, 3, 3, 3, 2, 2],
[4, 3, 2, 1, 2, 3, 2, 3, 2, 2, 3, 3],
[3, 3, 2, 2, 1, 2, 3, 4, 3, 2, 3, 2],
[2, 2, 3, 3, 2, 1, 4, 3, 3, 2, 3, 2],
[3, 3, 2, 2, 3, 4, 1, 2, 2, 3, 2, 3],
[2, 2, 3, 3, 4, 3, 2, 1, 2, 3, 2, 3],
[3, 2, 3, 2, 3, 3, 2, 2, 1, 2, 3, 4],
[3, 2, 3, 2, 2, 2, 3, 3, 2, 1, 4, 3],
[2, 3, 2, 3, 3, 3, 2, 2, 3, 4, 1, 2],
[2, 3, 2, 3, 2, 2, 3, 3, 4, 3, 2, 1]])
nodes_pair_1 = [0, 1, 4, 5, 9, 11]
nodes_pair_2 = [3, 2, 7, 6, 10, 8]
get_example = []
#=============================================================================
flag = 0
try_no = 1
find_graph_with_nodes = 3 # half
perm_1_index = 0
for perm_1 in permutations(range(6), find_graph_with_nodes):
perm_1_index = perm_1_index + 1
if flag == 1:
break
is_this_perm_small_to_big = 1
for ppp in range(len(list(perm_1)) - 1):
if perm_1[ppp] > perm_1[ppp + 1]:
is_this_perm_small_to_big = 0
break
if is_this_perm_small_to_big == 0:
continue
perm_2_index = 0
for perm_2 in permutations(range(6), find_graph_with_nodes):
perm_2_index = perm_2_index + 1
if perm_1_index >= perm_2_index:
continue
if flag == 1:
break
is_this_perm_small_to_big = 1
for ppp in range(len(list(perm_2)) - 1):
if perm_2[ppp] > perm_2[ppp + 1]:
is_this_perm_small_to_big = 0
break
if is_this_perm_small_to_big == 0:
continue
graph_1_half = []
graph_2_half = []
for ii in range(find_graph_with_nodes):
graph_1_half.append(nodes_pair_1[perm_1[ii]])
graph_2_half.append(nodes_pair_1[perm_2[ii]])
half_count = len(graph_1_half)
adj_half = np.zeros([half_count, half_count])
for i in range(0, half_count):
for j in range(0, half_count):
adj_half[i, j] = adj_int[graph_1_half[i], graph_1_half[j]]
A1_half = adj_half
adj_half = np.zeros([half_count, half_count])
for i in range(0, half_count):
for j in range(0, half_count):
adj_half[i, j] = adj_int[graph_2_half[i], graph_2_half[j]]
A2_half = adj_half
if true_yes_no_print(A1_half, A2_half) == 1:
continue
print('++++++++++++++++++++++++++ NO.', try_no, '+++++++++++++++++++++++++')
try_no = try_no + 1
graph_1_all = graph_1_half
half_num = len(graph_1_half)
for i in range(0, half_num):
if graph_1_half[i] in nodes_pair_1:
graph_1_all.append(nodes_pair_2[nodes_pair_1.index(graph_1_half[i])])
else:
graph_1_all.append(nodes_pair_1[nodes_pair_2.index(graph_1_half[i])])
graph_2_all = graph_2_half
half_num = len(graph_2_half)
for i in range(0, half_num):
if graph_2_half[i] in nodes_pair_1:
graph_2_all.append(nodes_pair_2[nodes_pair_1.index(graph_2_half[i])])
else:
graph_2_all.append(nodes_pair_1[nodes_pair_2.index(graph_2_half[i])])
graph_pair = [graph_1_all, graph_2_all]
print('===========choose============')
print(graph_pair)
#=============================================================================
choose_nodes = graph_pair[0]
# picture_choose(vertices, faces, choose_nodes)
choose_nodes_count = len(choose_nodes)
adj_choose = np.zeros([choose_nodes_count, choose_nodes_count])
for i in range(0, choose_nodes_count):
for j in range(0, choose_nodes_count):
adj_choose[i, j] = adj_int[choose_nodes[i], choose_nodes[j]]
# print(adj_choose)
A1 = adj_choose
choose_nodes = graph_pair[1]
# picture_choose(vertices, faces, choose_nodes)
choose_nodes_count = len(choose_nodes)
adj_choose = np.zeros([choose_nodes_count, choose_nodes_count])
for i in range(0, choose_nodes_count):
for j in range(0, choose_nodes_count):
adj_choose[i, j] = adj_int[choose_nodes[i], choose_nodes[j]]
# print(adj_choose)
A2 = adj_choose
#=============================================================================
print('===========test============')
if true_yes(A1, A2) == 1:
continue
else:
if k_wl_test(A1, A2, 3) == 1:
get_example.append(graph_pair)
flag = flag + 1
print('===========get examples============')
for i in range(len(get_example)):
print(get_example[i])