for v in g.nodes(): for v1 in g.nodes(): for v2 in g.nodes(): if (l[v][v1]>l[v][v2] and l1[v][v1]<=l1[v][v2]) or (l[v][v1]<l[v][v2] and l1[v][v1]>=l1[v][v2]) or (l[v][v1]==l[v][v2] and l1[v][v1]!=l1[v][v2]): count+=1 weight.append(count) return weight #g=nx.grid_2d_graph(5,5) g=nx.barabasi_albert_graph(50,6) l=nx.all_pairs_shortest_path_length(g) ww=fun(g,l) ww,sortedgel=sudlibn.graph_points(ww,G.edges()) sortedgel.reverse() #ww.sort() x=[] y=[] for s in ww: y.append(ww.count(s)) x.append(s) plt.plot(x,y) plt.show() print ww T=[] n=len(G.nodes())
Baboo.add_edge((0,0,0),(1,0,0)) Baboo.add_edge((1,0,0),(1,1,0)) Baboo.add_edge((1,1,0),(0,1,0)) Baboo.add_edge((0,1,0),(0,1,1)) Baboo.add_edge((0,1,1),(1,1,1)) Baboo.add_edge((1,1,1),(1,0,1)) Baboo.add_edge((1,0,1),(0,0,1)) nx.draw(Baboo) plt.show() rfin=sudlibn.the_carcass(g,Baboo) print "please be right:",rfin''' vv=sudlibn.graph_betweenessV(g) x,y=sudlibn.graph_points(vv,a) #print zz,'\n' #print a,"helloooooooooooo" plt.plot(x,y) plt.show() x,y=sudlibn.graph_points(vv,r) plt.plot(x,y) plt.show() x,y=sudlibn.graph_points(a,r) plt.plot(x,y) plt.show() #t=sudlibn.spanning_tree(g,a.index(max(a))) #tt=sudlibn.und(t) #nx.draw(tt)