Ask Your Question
0

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

asked 2019-07-04 16:43:29 +0100

anonymous user

Anonymous

updated 2019-07-11 18:57:37 +0100

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 09:11:13 +0100 )edit

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

rewi gravatar imagerewi ( 2019-07-05 13:24:54 +0100 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2019-07-05 14:35:14 +0100

FrédéricC gravatar image

updated 2019-07-05 17:32:44 +0100

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,

rewi gravatar imagerewi ( 2019-07-05 15:45:45 +0100 )edit

Thanks a lot

rewi gravatar imagerewi ( 2019-07-05 18:02:14 +0100 )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 16:43:29 +0100

Seen: 221 times

Last updated: Jul 11 '19