.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/algorithms/plot_node_edge_centrality.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_algorithms_plot_node_edge_centrality.py: ============================= Node edge centrality ============================= Compute and visualize the node edge centrality. .. GENERATED FROM PYTHON SOURCE LINES 8-27 .. image-sg:: /auto_examples/algorithms/images/sphx_glr_plot_node_edge_centrality_001.png :alt: plot node edge centrality :srcset: /auto_examples/algorithms/images/sphx_glr_plot_node_edge_centrality_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /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!") | .. code-block:: Python 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() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.052 seconds) .. _sphx_glr_download_auto_examples_algorithms_plot_node_edge_centrality.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_node_edge_centrality.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_node_edge_centrality.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_node_edge_centrality.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_