# From the following collection how to find only those graphs having only integer eigenvalue Anonymous

for g in graphs.nauty_geng("8 -c"):

g.show()

h = g.laplacian_matrix().eigenvalues()

h.sort()

show(h)

I am trying to extract those graphs having all laplacian eigenvalues are integer. Is it possible to solve this problem in sage?

edit retag close merge delete

Something like that

sage: [G for G in graphs(6) if all(f.degree()<=1 for f,d in G.charpoly().factor())]


ok. Can we see those graphs also having integer eigenvalues?

Sort by » oldest newest most voted Like that

L = [G for G in graphs.nauty_geng("8 -c")
if all(f.degree() <= 1 for f, d in G.laplacian_matrix().charpoly().factor())]


Then you have a list of graphs. You can then use

graphics_array([G.plot() for G in L])


or any other way to display them.

more

But the output is not giving graphs. It is not coming correctly. When I run it on sage, the output is [Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices, Graph on 8 vertices,