Ask Your Question
0

Integer valued eigenvalues

asked 2024-03-13 13:05:32 +0200

anonymous user

Anonymous

updated 2024-03-13 20:55:55 +0200

.

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2024-03-13 19:39:57 +0200

Max Alekseyev gravatar image

updated 2024-03-13 21:38:08 +0200

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()
edit flag offensive delete link more

Comments

But it is not coming the correct answer.

rewi gravatar imagerewi ( 2024-03-13 20:52:41 +0200 )edit

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

Max Alekseyev gravatar imageMax Alekseyev ( 2024-03-13 21:20:56 +0200 )edit

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 ( 2024-03-13 21:28:19 +0200 )edit

@rewi: I've added a complete code.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-03-13 21:38:25 +0200 )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: 2024-03-13 13:05:32 +0200

Seen: 170 times

Last updated: Mar 13