Comparing centrality measures#

XGi has several different centrality measures. How do they stack up against one another? We were curious too! Below is a pairplot comparing every centrality to each other for a selected hypergraph.

[9]:
import pandas as pd
import seaborn as sns

import xgi
[20]:
dataset = "email-enron"


H = xgi.load_xgi_data(dataset)
H.cleanup()
[20]:
<xgi.core.hypergraph.Hypergraph at 0x168564ce0>

Here, we compute different measures of centrality on the hypergraph:

[22]:
c1 = H.nodes.clique_eigenvector_centrality.asnumpy()
c2 = H.nodes.h_eigenvector_centrality(max_iter=1000).asnumpy()
c3 = H.nodes.z_eigenvector_centrality(max_iter=1000).asnumpy()
c4 = H.nodes.katz_centrality.asnumpy()
c5 = H.nodes.node_edge_centrality(max_iter=1000).asnumpy()

df = pd.DataFrame()
# df["node-edge"] = c1
df["CEC"] = c1
df["HEC"] = c2
df["ZEC"] = c3
df["Katz"] = c4
df["Node-Edge"] = c5
[23]:
sns.pairplot(df)
[23]:
<seaborn.axisgrid.PairGrid at 0x16d885280>
../../_images/api_tutorials_case_study_3_5_1.png
[ ]: