The aim of the second analysis is to find influencers by the popularity of topics they publish. In contrast to the most common social network, we will not deal with the number of followers or repins, but we will focus on created content.
We adjust function centrality_measures to generate bar charts instead of lists of results:
def centrality_measures(G,labels): centralities = [] centralities.append(('degree centrality',nx.degree_centrality(G))) centralities.append(('closeness centrality',nx.closeness_centrality(G))) centralities.append(('betweenness centrality',nx.betweenness_centrality(G))) centralities.append(('eigenvector centrality',nx.eigenvector_centrality(G))) for centrality in centralities: sorted_elements = sorted(centrality[1].items(), ...