Ask Your Question
0

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

asked 5 years ago

anonymous user

Anonymous

updated 5 years ago

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?

Preview: (hide)

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 ( 5 years ago )

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

rewi gravatar imagerewi ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

FrédéricC gravatar image

updated 5 years ago

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.

Preview: (hide)
link

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 ( 5 years ago )

Thanks a lot

rewi gravatar imagerewi ( 5 years ago )

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: 5 years ago

Seen: 245 times

Last updated: Jul 11 '19