Comparing centralities
To get a feel for how the different centralities differ, or to use multiple different centralities together (for instance, if building an ML classifier and wanting to use graph metrics), it can be useful to combine the different centralities together into a single pandas DataFrame. You can easily do so with the pandas concat
function:
combined_importance_df = pd.concat([degree_df, degcent_df, betwcent_df, closecent_df, pagerank_df], axis=1) combined_importance_df.head(10)
This will combine all of our centrality and PageRank DataFrames into one unified DataFrame. This will make it easier for us to compare different types of centralities.
Figure 7.14 – pandas DataFrame of combined importance metrics
You may notice that if you rank by the different types of centralities, some have very similar results, and others are very different. I’ll leave you with this: there is no single centrality to rule them all. They are...