zagreb general

492 days ago by Buyan

n=7 k=4 r=-1/2 L=list(graphs(n)) D=[] d=[] max=0 min=1000 R=[] for g in L: if g.is_connected(): E=g.edges() w=0 for e in E: if g.is_cut_edge(e): w=w+1 if w==k: R.append(g) print 'R has been constructed' for g in R: V=g.vertices() sum=0 for v in V: for u in V: if g.has_edge(v,u): sum=sum+(g.degree(v)+r)*(g.degree(u)+r) if max<sum: max=sum D=[];D.append(g) else: if max==sum: D.append(g) if min>sum: min=sum d=[];d.append(g) else: if min==sum: d.append(g) print max/2 graphs_list.show_graphs(D) print min/2 graphs_list.show_graphs(d) 
       
R has been constructed
119/4
75/4
R has been constructed
119/4
75/4