.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/generative_models/plot_random_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_random_hypergraph.py: ======================= Random hypergraph ======================= Generate a random hypergraph. .. GENERATED FROM PYTHON SOURCE LINES 8-25 .. image-sg:: /auto_examples/generative_models/images/sphx_glr_plot_random_hypergraph_001.png :alt: plot random hypergraph :srcset: /auto_examples/generative_models/images/sphx_glr_plot_random_hypergraph_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/xgi/envs/latest/lib/python3.12/site-packages/xgi/generators/random.py:150: UserWarning: This method is much slower than fast_random_hypergraph warn("This method is much slower than fast_random_hypergraph") | .. code-block:: Python import matplotlib.pyplot as plt import xgi # specify parameters n = 20 # number of nodes ps = [0.15, 0.01] # wiring probabilities # generate hypergraph H = xgi.random_hypergraph(n, ps, seed=1) # draw hypergraph pos = xgi.barycenter_spring_layout(H, seed=1) xgi.draw(H, pos=pos) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.038 seconds) .. _sphx_glr_download_auto_examples_generative_models_plot_random_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_random_hypergraph.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_random_hypergraph.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_random_hypergraph.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_