NormDistLapla-Cospec8&Fewer

1815 days ago by reinh196

### Defining the matrices for various rings 
       
def distLapla(G): n=G.order() M=zero_matrix(RDF,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=-x M[j,i]=-x M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x return M def InvTransMatrix(G): n=G.order() M=zero_matrix(RDF,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=0 M[j,i]=0 M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x for i in range(n): M[i,i]=M[i,i]^(-1) return M def InvTransDistLapla(G): M=InvTransMatrix(G)*distLapla(G) return M def distLaplaQQ(G): n=G.order() M=zero_matrix(QQ,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=-x M[j,i]=-x M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x return M def InvTransMatrixQQ(G): n=G.order() M=zero_matrix(QQ,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=0 M[j,i]=0 M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x for i in range(n): M[i,i]=M[i,i]^(-1) return M def InvTransDistLaplaQQ(G): M=InvTransMatrixQQ(G)*distLaplaQQ(G) return M def distLaplaSR(G): n=G.order() M=zero_matrix(SR,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=-x M[j,i]=-x M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x return M def HalfInvTransMatrixSR(G): n=G.order() M=zero_matrix(SR,n,n) for i in range(n): for j in range(i+1,n): x=G.distance(i,j) M[i,j]=0 M[j,i]=0 M[i,i]=M[i,i]+x M[j,j]=M[j,j]+x for i in range(n): M[i,i]=M[i,i]^(-1/2) return M def NormDistLaplaSR(G): M=HalfInvTransMatrixSR(G)*distLaplaSR(G)*HalfInvTransMatrixSR(G) return M 
       
### Using the built in cospectral_graphs command to search for <=8 vertices 
       
L=[] for G in graphs.cospectral_graphs(3, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[]
[]
L=[] for G in graphs.cospectral_graphs(4, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[]
[]
L=[] for G in graphs.cospectral_graphs(5, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[]
[]
L=[] for G in graphs.cospectral_graphs(6, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[]
[]
L=[] for G in graphs.cospectral_graphs(7, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[]
[]
L=[] for G in graphs.cospectral_graphs(8, matrix_function=InvTransDistLaplaQQ, graphs=lambda g: g.is_connected()): L.append([i.graph6_string() for i in G]) L 
       
[['GfC}@o', 'GraK[S']]
[['GfC}@o', 'GraK[S']]
G1=Graph('GfC}@o') G2=Graph('GraK[S') 
       
show(G1) NDL1=NormDistLaplaSR(G1) show(NDL1) 
       

                                
                            

                                
show(G2) NDL2=NormDistLaplaSR(G2) show(NDL2) 
       

                                
                            

                                
InvTransDistLaplaQQ(G1).charpoly()-InvTransDistLaplaQQ(G2).charpoly() 
       
0
0
print InvTransDistLaplaQQ(G1).eigenvalues() print InvTransDistLaplaQQ(G1).charpoly() 
       
[12/11, 1, 0, 7/6, 7/6, 1.039501700164266?, 1.113380330521739?,
1.422875545071572?]
x^8 - 8*x^7 + 317947/11616*x^6 - 5428399/104544*x^5 +
24668087/418176*x^4 - 4196075/104544*x^3 + 575771/38016*x^2 -
85211/34848*x
[12/11, 1, 0, 7/6, 7/6, 1.039501700164266?, 1.113380330521739?, 1.422875545071572?]
x^8 - 8*x^7 + 317947/11616*x^6 - 5428399/104544*x^5 + 24668087/418176*x^4 - 4196075/104544*x^3 + 575771/38016*x^2 - 85211/34848*x