def node_strength(G, w): Sum_of_weight = 0.0 neighbors = list(nx.all_neighbors(G, w)) for node in neighbors: Sum_of_weight = Sum_of_weight + G[w][node]['weight'] #end for return Sum_of_weight