Ask Your Question
0

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

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

anonymous user

Anonymous

updated 2019-07-11 11:57:37 -0500

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 flag offensive 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())]
FrédéricC gravatar imageFrédéricC ( 2019-07-05 02:11:13 -0500 )edit

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

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

1 answer

Sort by » oldest newest most voted
1

answered 2019-07-05 07:35:14 -0500

FrédéricC gravatar image

updated 2019-07-05 10:32:44 -0500

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.

edit flag offensive delete link 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,

Kuldeep gravatar imageKuldeep ( 2019-07-05 08:45:45 -0500 )edit

Thanks a lot

Kuldeep gravatar imageKuldeep ( 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

Question Tools

1 follower

Stats

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

Seen: 91 times

Last updated: Jul 11