:orphan:

.. _gallery-of-examples:

Gallery of Examples
===================

Gallery of examples for `python-igraph` illustrating graph generation, analysis, and plotting.

Impatient? Check out the :ref:`tutorials-quickstart`.

Too little detail? Read the :doc:`extended tutorial <../tutorial>`.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to create a random directed acyclic graph (DAG), which is useful ...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_generate_dag_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_generate_dag.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Directed Acyclic Graph</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to visualise the connected components in a graph using igraph.Gra...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_connected_components_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_connected_components.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Connected Components</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to use igraph&#x27;s configuration instance &lt;igraph.Configuration&gt; to set def...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_configuration_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_configuration.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Configuration Instance</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to compute and visualize the articulation points in a graph using igraph...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_articulation_points_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_articulation_points.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Articulation Points</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to construct a max flow on a directed graph with edge capacities using i...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_maxflow_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_maxflow.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Maximum Flow</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to generate a minimum spanning tree from an input graph using igraph.Gra...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_minimum_spanning_trees_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_minimum_spanning_trees.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Minimum Spanning Trees</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to generate a spanning tree from an input graph using igraph.Graph.spann...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_spanning_trees_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_spanning_trees.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Spanning Trees</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to generate the complement graph of a graph (sometimes known as the anti...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_complement_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_complement.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Complement</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates an efficient way to find and visualise a maximum biparite matching us...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_bipartite_matching_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_bipartite_matching.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Maximum Bipartite Matching</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to get a topological sorting on a directed acyclic graph (DAG). A...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_topological_sort_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_topological_sort.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Topological sorting</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to remove self loops and multiple edges using igraph.GraphBase.simplify.">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_simplify_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_simplify.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Simplify</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to visualize communities or clusters of a graph.">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_visualize_communities_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_visualize_communities.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Communities</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to generate Erdős–Rényi graphs using igraph.GraphBase.Erdos_Renyi...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_erdos_renyi_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_erdos_renyi.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Erdős-Rényi Graph</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to change the visual style of network plots.">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_visual_style_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_visual_style.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Visual styling</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to compute and visualize cliques of a graph using igraph.GraphBase.cliqu...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_visualize_cliques_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_visualize_cliques.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Cliques</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example presents how to visualise bipartite matching using maximum flow (see igraph.Graph....">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_bipartite_matching_maxflow_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_bipartite_matching_maxflow.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Maximum Bipartite Matching by Maximum Flow</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to find the shortest distance between two vertices of a weighted ...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_shortest_path_visualisation_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_shortest_path_visualisation.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Shortest Paths</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to calculate the Delaunay triangulation of an input graph. We sta...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_delaunay-triangulation_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_delaunay-triangulation.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Delaunay Triangulation</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to compute and visualize the bridges in a graph using igraph.GraphBase.b...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_bridges_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_bridges.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Bridges</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to check for isomorphism between small graphs using igraph.GraphBase.iso...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_isomorphism_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_isomorphism.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Isomorphism</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to use matplotlib:api/animation_api in order to animate a ring gr...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_ring_animation_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_ring_animation.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Ring Graph Animation</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="- Construct a graph - Set attributes of nodes and edges - Plot a graph using matplotlib - Save ...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_quickstart_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_quickstart.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Quick Start</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to find the communities in a graph, then contract each community into a ...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_cluster_contraction_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_cluster_contraction.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Generating Cluster Graphs</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example reproduces a typical data science situation in an internet company. We start from ...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_online_user_actions_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_online_user_actions.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Online user actions</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to visualize both vertex and edge betweenness with a custom defin...">

.. only:: html

  .. image:: /tutorials/images/thumb/sphx_glr_betweenness_thumb.png
    :alt:

  :ref:`sphx_glr_tutorials_betweenness.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Betweenness</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/generate_dag
   /tutorials/connected_components
   /tutorials/configuration
   /tutorials/articulation_points
   /tutorials/maxflow
   /tutorials/minimum_spanning_trees
   /tutorials/spanning_trees
   /tutorials/complement
   /tutorials/bipartite_matching
   /tutorials/topological_sort
   /tutorials/simplify
   /tutorials/visualize_communities
   /tutorials/erdos_renyi
   /tutorials/visual_style
   /tutorials/visualize_cliques
   /tutorials/bipartite_matching_maxflow
   /tutorials/shortest_path_visualisation
   /tutorials/delaunay-triangulation
   /tutorials/bridges
   /tutorials/isomorphism
   /tutorials/ring_animation
   /tutorials/quickstart
   /tutorials/cluster_contraction
   /tutorials/online_user_actions
   /tutorials/betweenness


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download all examples in Python source code: tutorials_python.zip </tutorials/tutorials_python.zip>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download all examples in Jupyter notebooks: tutorials_jupyter.zip </tutorials/tutorials_jupyter.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
