def Sum_of_weight(G):
#nx.number_of_edges(nx.ego_graph(Hub_ego,n,1))
EdgeList = G.edges(data=True) #[(0, 1, {}), (1, 2, {}), (2, 3, {})]
#print EdgeList
Sum_of_weight = 0.0
for edge in EdgeList:
Sum_of_weight = Sum_of_weight + edge[2]['weight'] #weight=string.atof(line[3]),timestamp=string.atof(line[5]
#end for
return Sum_of_weight
评论列表
文章目录