Ask Your Question

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

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

## Comments

Something like that

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

( 2019-07-05 02:11:13 -0500 )edit

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

( 2019-07-05 06:24:54 -0500 )edit

## 1 answer

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

## Comments

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,

( 2019-07-05 08:45:45 -0500 )edit

Thanks a lot

( 2019-07-05 11:02:14 -0500 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2019-07-04 09:43:29 -0500

Seen: 101 times

Last updated: Jul 11