Harmonic index

504 days ago by Buyan

n=9 k=4 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+2/(g.degree(v)+g.degree(u)) 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
22/5
239/90
R has been constructed
22/5
239/90

n=7 k=4 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' 
       
R has been constructed
R has been constructed