:orphan:



.. _sphx_glr_tutorials:

.. _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-thumbcontainer" tooltip="This example demonstrates how to create a random directed acyclic graph (DAG), which is useful ...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_generate_dag_thumb.png
     :alt: Directed Acyclic Graph

     :ref:`sphx_glr_tutorials_generate_dag.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/generate_dag

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_connected_components_thumb.png
     :alt: Connected Components

     :ref:`sphx_glr_tutorials_connected_components.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/connected_components

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_configuration_thumb.png
     :alt: Configuration Instance

     :ref:`sphx_glr_tutorials_configuration.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/configuration

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to compute and visualize the `articulation points &lt;https://en.wikipedia....">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_articulation_points_thumb.png
     :alt: Articulation Points

     :ref:`sphx_glr_tutorials_articulation_points.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/articulation_points

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_maxflow_thumb.png
     :alt: Maximum Flow

     :ref:`sphx_glr_tutorials_maxflow.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/maxflow

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to generate a `minimum spanning tree &lt;https://en.wikipedia.org/wiki/Mini...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_minimum_spanning_trees_thumb.png
     :alt: Minimum Spanning Trees

     :ref:`sphx_glr_tutorials_minimum_spanning_trees.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/minimum_spanning_trees

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_spanning_trees_thumb.png
     :alt: Spanning Trees

     :ref:`sphx_glr_tutorials_spanning_trees.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/spanning_trees

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to generate the `complement graph &lt;https://en.wikipedia.org/wiki/Complem...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_complement_thumb.png
     :alt: Complement

     :ref:`sphx_glr_tutorials_complement.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/complement

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_bipartite_matching_thumb.png
     :alt: Maximum Bipartite Matching

     :ref:`sphx_glr_tutorials_bipartite_matching.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/bipartite_matching

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_topological_sort_thumb.png
     :alt: Topological sorting

     :ref:`sphx_glr_tutorials_topological_sort.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/topological_sort

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_simplify_thumb.png
     :alt: Simplify

     :ref:`sphx_glr_tutorials_simplify.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/simplify

.. raw:: html

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

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_visualize_communities_thumb.png
     :alt: Communities

     :ref:`sphx_glr_tutorials_visualize_communities.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/visualize_communities

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to generate `Erdős–Rényi graphs &lt;https://en.wikipedia.org/wiki/Er...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_erdos_renyi_thumb.png
     :alt: Erdős-Rényi Graph

     :ref:`sphx_glr_tutorials_erdos_renyi.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/erdos_renyi

.. raw:: html

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

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_visual_style_thumb.png
     :alt: Visual styling

     :ref:`sphx_glr_tutorials_visual_style.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/visual_style

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_visualize_cliques_thumb.png
     :alt: Cliques

     :ref:`sphx_glr_tutorials_visualize_cliques.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/visualize_cliques

.. raw:: html

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

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_bipartite_matching_maxflow_thumb.png
     :alt: Maximum Bipartite Matching by Maximum Flow

     :ref:`sphx_glr_tutorials_bipartite_matching_maxflow.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/bipartite_matching_maxflow

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_shortest_path_visualisation_thumb.png
     :alt: Shortest Paths

     :ref:`sphx_glr_tutorials_shortest_path_visualisation.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/shortest_path_visualisation

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to calculate the `Delaunay triangulation &lt;https://en.wikipedia.or...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_delaunay-triangulation_thumb.png
     :alt: Delaunay Triangulation

     :ref:`sphx_glr_tutorials_delaunay-triangulation.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/delaunay-triangulation

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to compute and visualize the `bridges &lt;https://en.wikipedia.org/wiki/Bri...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_bridges_thumb.png
     :alt: Bridges

     :ref:`sphx_glr_tutorials_bridges.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/bridges

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to check for `isomorphism &lt;https://en.wikipedia.org/wiki/Graph_isomorphi...">

.. only:: html

 .. figure:: /tutorials/images/thumb/sphx_glr_isomorphism_thumb.png
     :alt: Isomorphism

     :ref:`sphx_glr_tutorials_isomorphism.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/isomorphism

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_ring_animation_thumb.png
     :alt: Ring Graph Animation

     :ref:`sphx_glr_tutorials_ring_animation.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/ring_animation

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_quickstart_thumb.png
     :alt: Quick Start

     :ref:`sphx_glr_tutorials_quickstart.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/quickstart

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_cluster_contraction_thumb.png
     :alt: Generating Cluster Graphs

     :ref:`sphx_glr_tutorials_cluster_contraction.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/cluster_contraction

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_online_user_actions_thumb.png
     :alt: Online user actions

     :ref:`sphx_glr_tutorials_online_user_actions.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/online_user_actions

.. 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

 .. figure:: /tutorials/images/thumb/sphx_glr_betweenness_thumb.png
     :alt: Betweenness

     :ref:`sphx_glr_tutorials_betweenness.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/betweenness
.. raw:: html

    <div class="sphx-glr-clear"></div>



.. only :: html

 .. container:: sphx-glr-footer
    :class: 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>`_
