.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/generative_models/plot_chung-lu_hypergraph.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_generative_models_plot_chung-lu_hypergraph.py: ======================= Chung-Lu hypergraph ======================= Generate a Chung-Lu hypergraph .. GENERATED FROM PYTHON SOURCE LINES 8-31 .. image-sg:: /auto_examples/generative_models/images/sphx_glr_plot_chung-lu_hypergraph_001.png :alt: plot chung lu hypergraph :srcset: /auto_examples/generative_models/images/sphx_glr_plot_chung-lu_hypergraph_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import xgi # fix random seed for reproducibility seed = 42 rng = np.random.default_rng(seed) # specify parameters n = 20 # number of nodes k1 = {i: int(rng.integers(1, 101)) for i in range(n)} # degree distribution k2 = {i: sorted(k1.values())[i] for i in range(n)} # degree distribution # generate hypergraph H = xgi.chung_lu_hypergraph(k1, k2, seed=rng) # draw hypergraph pos = xgi.barycenter_spring_layout(H, seed=seed) xgi.draw(H, pos=pos, alpha=0.3) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.041 seconds) .. _sphx_glr_download_auto_examples_generative_models_plot_chung-lu_hypergraph.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_chung-lu_hypergraph.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_chung-lu_hypergraph.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_chung-lu_hypergraph.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_