n=6;
def An(n): #n >= 2
return graphs.PathGraph(n);
def Anh(n):
return graphs.CycleGraph(n+1);
def Dn(n): #n>=4
Dn=graphs.PathGraph(n-1);
Dn.add_vertex(n-1);
Dn.add_edge(n-1,1);
return Dn;
def Dnh(n):
Dnh=graphs.PathGraph(n-1);
Dnh.add_vertex(n-1);
Dnh.add_edge(n-1,1);
Dnh.add_vertex(n);
Dnh.add_edge(n-3,n);
return Dnh;
E6 = Graph({0:[1,2],1:[0],2:[0,3,5],3:[2,4],4:[3],5:[2]});
E6h = Graph({0:[1,2],1:[0],2:[0,3,5],3:[2,4],4:[3],5:[2,6],6:[5]});
E7 = Graph({0:[1],1:[0,2],2:[1,3],3:[2,4,6],4:[3,5],5:[4],6:[3]});
E7h = Graph({0:[1],1:[0,2],2:[1,3],3:[2,4,7],4:[3,5],5:[4,6],6:[5],7:[3]});
E8 = Graph({0:[1],1:[0,2],2:[1,3,7],3:[2,4],4:[3,5],5:[4,6],6:[5],7:[2]});
E8h = Graph({0:[1],1:[0,2],2:[1,3,8],3:[2,4],4:[3,5],5:[4,6],6:[5,7],7:[6],8:[2]});
EE=[E6,E7,E8];
EEh=[E6h,E7h,E8h];
def spectral_radius(g):
A=g.adjacency_matrix();
return max(A.eigenvalues());