Node edge centrality#

Compute and visualize the node edge centrality.

plot node edge centrality
/home/docs/checkouts/xgi/envs/778/lib/python3.14/site-packages/xgi/algorithms/centrality.py:159: UserWarning: Iteration did not converge!
  warn("Iteration did not converge!")

import matplotlib.pyplot as plt

import xgi

# generate hypergraph
n = 20
ps = [0.15, 0.01]
H = xgi.fast_random_hypergraph(n, ps, seed=20)

# visualize hypergraph and centrality
pos = xgi.barycenter_spring_layout(H, seed=1)
ax, collections = xgi.draw(H, pos=pos, edge_fc=H.edges.node_edge_centrality)

node_col, _, edge_col = collections

plt.colorbar(edge_col, label="Node edge centrality")

plt.show()

Total running time of the script: (0 minutes 0.052 seconds)

Gallery generated by Sphinx-Gallery