n=4
L=list(graphs(n))
print "Total number of graphs:",len(L)
for i in range(len(L)):
if L[i].is_regular() and L[i].is_connected():
d=L[i].degree(0)
A=L[i].adjacency_matrix()
spectrum=A.eigenvalues()
orderedspectrum=sorted(spectrum)
lambda2=orderedspectrum[n-2]
if d%2==0 and lambda2<(d-2+sqrt(d^2+12))/2:
SebiGubound=(d-2+sqrt(d^2+12))/2
print "SebiGu upper bound on lambda2:", numerical_approx(SebiGubound)
print "even degree:", d
print "spectrum A:", orderedspectrum
print "lambda2:", lambda2
show(L[i])
else:
if lambda2<(d-2+sqrt(d^2+8))/2:
SebiGubound=(d-2+sqrt(d^2+8))/2
print "SebiGu upper bound on lambda2:", numerical_approx(SebiGubound)
print "odd degree:", d
print "spectrum A:", orderedspectrum
print "lambda2:", lambda2
show(L[i])
Total number of graphs: 11
SebiGu upper bound on lambda2: 2.00000000000000
even degree: 2
spectrum A: [-2, 0, 0, 2]
lambda2: 0
d3-based renderer not yet implemented
SebiGu upper bound on lambda2: 2.56155281280883
odd degree: 3
spectrum A: [-1, -1, -1, 3]
lambda2: -1
d3-based renderer not yet implemented