Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

instead of .eigenvalues() use .charpoly().roots(ZZ).

Integer eigen values can be obtained with .charpoly().roots(ZZ) instead of .eigenvalues() use .charpoly().roots(ZZ).. 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()