CospectralZ

1407 days ago by chlin

load("https://raw.githubusercontent.com/jephianlin/minrank_aux/master/load_all.py") load_all() 
       
xrange test passed
Loading Zq_c.pyx...
Compiling
/home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_Yk16Iu.pyx...
Loading Zq.py...
Loading zero_forcing_64.pyx...
Compiling
/home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_wHLyVx.pyx...
Loading zero_forcing_wavefront.pyx...
Compiling
/home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_7MUkKt.pyx...
Loading minrank.py...
Loading inertia.py...
Loading general_Lib.sage...
---sshow, multi_sshow, tuple_generator, minimal_graphs, empty_array,
all_one_matrix, elementary_matrix, eigens_multi, sort_dictionary,
has_minor, etc.
Loading oc_diag_analysis.sage...
---gZ_leq, find_gZ, find_EZ, diagonal_analysis, etc.
Loading xi_dict.py...
---SAPreduced_matrix, has_SAP, find_ZFloor, Zsap, etc.
Loading mu_dict.py...
---get_mu_from_dict, find_mu, etc.
Loading SXP.sage...
This code contains extra copy of Z_game, Zell_game, Zplus_game, for the
completeness of Zsap_game program.
Loading matrix_forcing.py...
xrange test passed
Loading Zq_c.pyx...
Compiling /home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_Yk16Iu.pyx...
Loading Zq.py...
Loading zero_forcing_64.pyx...
Compiling /home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_wHLyVx.pyx...
Loading zero_forcing_wavefront.pyx...
Compiling /home/sageuser/2/.sage/temp/sage.math.iastate.edu/776/tmp_7MUkKt.pyx...
Loading minrank.py...
Loading inertia.py...
Loading general_Lib.sage...
---sshow, multi_sshow, tuple_generator, minimal_graphs, empty_array, all_one_matrix, elementary_matrix, eigens_multi, sort_dictionary, has_minor, etc.
Loading oc_diag_analysis.sage...
---gZ_leq, find_gZ, find_EZ, diagonal_analysis, etc.
Loading xi_dict.py...
---SAPreduced_matrix, has_SAP, find_ZFloor, Zsap, etc.
Loading mu_dict.py...
---get_mu_from_dict, find_mu, etc.
Loading SXP.sage...
This code contains extra copy of Z_game, Zell_game, Zplus_game, for the completeness of Zsap_game program.
Loading matrix_forcing.py...
def cospectral(n, mtx='adj'): data = {} for g in graphs.nauty_geng('%s'%n): stg = g.canonical_label().graph6_string() if mtx == 'adj': A = g.adjacency_matrix() elif mtx == 'lap': A = g.laplacian_matrix() elif mtx == 'dis': A = g.distance_matrix() a = A.charpoly().coefficients(sparse=False) a.reverse() tup_a = tuple(a) try: data[tup_a].append(stg) except KeyError: data[tup_a] = [stg] #return data return {k:data[k] for k in data.keys() if len(data[k])>=2} 
       
want = {} for n in range(1,8): want[n] = cospectral(n) 
       
for n in range(1,7): data = want[n] for c in data.keys(): gs = data[c] zs = [find_Z(Graph(stg)) for stg in gs] if len(set(zs)) >= 2: print(n,c) 
       
(6, (1, 0, -7, -4, 7, 4, -1))
(6, (1, 0, -6, -4, 5, 4, 0))
(6, (1, 0, -5, 0, 4, 0, 0))
(6, (1, 0, -4, 0, 3, 0, 0))
(6, (1, 0, -7, -4, 7, 4, -1))
(6, (1, 0, -6, -4, 5, 4, 0))
(6, (1, 0, -5, 0, 4, 0, 0))
(6, (1, 0, -4, 0, 3, 0, 0))
gs = want[6][(1, 0, -7, -4, 7, 4, -1)] for stg in gs: g = Graph(stg) A = g.adjacency_matrix() print(A.charpoly()) sshow(g, "Z = %s"%find_Z(g)) 
       
x^6 - 7*x^4 - 4*x^3 + 7*x^2 + 4*x - 1
x^6 - 7*x^4 - 4*x^3 + 7*x^2 + 4*x - 1
x^6 - 7*x^4 - 4*x^3 + 7*x^2 + 4*x - 1
x^6 - 7*x^4 - 4*x^3 + 7*x^2 + 4*x - 1

gs = want[6][(1, 0, -6, -4, 5, 4, 0)] for stg in gs: g = Graph(stg) A = g.adjacency_matrix() print(A.charpoly()) sshow(g, "Z = %s"%find_Z(g)) 
       
x^6 - 6*x^4 - 4*x^3 + 5*x^2 + 4*x
x^6 - 6*x^4 - 4*x^3 + 5*x^2 + 4*x
x^6 - 6*x^4 - 4*x^3 + 5*x^2 + 4*x
x^6 - 6*x^4 - 4*x^3 + 5*x^2 + 4*x

gs = want[6][(1, 0, -5, 0, 4, 0, 0)] for stg in gs: g = Graph(stg) A = g.adjacency_matrix() print(A.charpoly()) sshow(g, "Z = %s"%find_Z(g)) 
       
x^6 - 5*x^4 + 4*x^2
x^6 - 5*x^4 + 4*x^2
x^6 - 5*x^4 + 4*x^2
x^6 - 5*x^4 + 4*x^2

gs = want[6][(1, 0, -4, 0, 3, 0, 0)] for stg in gs: g = Graph(stg) A = g.adjacency_matrix() print(A.charpoly()) sshow(g, "Z = %s"%find_Z(g)) 
       
x^6 - 4*x^4 + 3*x^2
x^6 - 4*x^4 + 3*x^2
x^6 - 4*x^4 + 3*x^2
x^6 - 4*x^4 + 3*x^2