Basic analysis: most central nodes
• We first introduce a utility method: given a dictionary and a threshold parameter
K, the top K keys are returned according to the element values.
• We can then apply the method on the various centrality metrics available. Below
we extract the top 10 most central nodes for each case.
def get_top_keys(dictionary, top):
items = dictionary.items()
items.sort(reverse=True, key=lambda x: x[1])
return map(lambda x: x[0], items[:top])
top_bet_cen = get_top_keys(bet_cen,10)
Dostları ilə paylaş: