First time here? Check out the FAQ!

Ask Your Question
0

Integer valued eigenvalues

asked 1 year ago

anonymous user

Anonymous

updated 1 year ago

.

for G in graphs.nauty_geng("8 -c"):
    A=G.adjacency_matrix().eigenvalues()
    L=G.laplacian_matrix().eigenvalues()
    show(A,L)
    G.show()

Using the above code, I have obtained the all possible eigenvalues of the adjacency and Laplacian matrix. But I need only those graphs for which the adjacency and laplacian matrices have all integer eigenvalues. How to collect only the integer eigenvalues from this large collection?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 1 year ago

Max Alekseyev gravatar image

updated 1 year ago

Integer eigen values can be obtained with .charpoly().roots(ZZ) instead of .eigenvalues(). Correspondingly, the graphs you look for, can be obtained as

n = 8
for G in graphs.nauty_geng(f"{n} -c"):
    if sum(m for _,m in G.adjacency_matrix().charpoly().roots(ZZ))==n and sum(m for _,m in G.laplacian_matrix().charpoly().roots(ZZ))==n:
        G.show()
Preview: (hide)
link

Comments

But it is not coming the correct answer.

rewi gravatar imagerewi ( 1 year ago )

What do you mean? What is "correct answer"?

Max Alekseyev gravatar imageMax Alekseyev ( 1 year ago )

I need only those graphs whose adjacency as well as laplacian matrices have all eigenvalues integers. but the code after modification, as you suggested still giving graphs which do not have integer eigenvalues. Some extra graphs are coming. we have to exclude those graphs

rewi gravatar imagerewi ( 1 year ago )

@rewi: I've added a complete code.

Max Alekseyev gravatar imageMax Alekseyev ( 1 year 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: 1 year ago

Seen: 231 times

Last updated: Mar 13 '24