
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "tutorials/articulation_points.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_tutorials_articulation_points.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_tutorials_articulation_points.py:


.. _tutorials-articulation-points:

===================
Articulation Points
===================

This example shows how to compute and visualize the `articulation points <https://en.wikipedia.org/wiki/Biconnected_component>`_ in a graph using :meth:`igraph.GraphBase.articulation_points`. For an example on bridges instead, see :ref:`tutorials-bridges`.

.. GENERATED FROM PYTHON SOURCE LINES 11-14

.. code-block:: Python

    import igraph as ig
    import matplotlib.pyplot as plt








.. GENERATED FROM PYTHON SOURCE LINES 15-16

First, we construct a graph. This example shows usage of graph formulae:

.. GENERATED FROM PYTHON SOURCE LINES 16-20

.. code-block:: Python

    g = ig.Graph.Formula(
        "0-1-2-0, 3:4:5:6 - 3:4:5:6, 2-3-7-8",
    )








.. GENERATED FROM PYTHON SOURCE LINES 21-22

Now we are aready to find the articulation points as a vertex sequence

.. GENERATED FROM PYTHON SOURCE LINES 22-24

.. code-block:: Python

    articulation_points = g.vs[g.articulation_points()]








.. GENERATED FROM PYTHON SOURCE LINES 25-26

Finally, we can plot the graph

.. GENERATED FROM PYTHON SOURCE LINES 26-39

.. code-block:: Python

    fig, ax = plt.subplots()
    ig.plot(
        g,
        target=ax,
        vertex_size=30,
        vertex_color="lightblue",
        vertex_label=range(g.vcount()),
        vertex_frame_color = ["red" if v in articulation_points else "black" for v in g.vs],
        vertex_frame_width = [3 if v in articulation_points else 1 for v in g.vs],
        edge_width=0.8,
        edge_color='gray'
    )
    plt.show()



.. image-sg:: /tutorials/images/sphx_glr_articulation_points_001.png
   :alt: articulation points
   :srcset: /tutorials/images/sphx_glr_articulation_points_001.png
   :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.158 seconds)


.. _sphx_glr_download_tutorials_articulation_points.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

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

      :download:`Download Jupyter notebook: articulation_points.ipynb <articulation_points.ipynb>`

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

      :download:`Download Python source code: articulation_points.py <articulation_points.py>`


.. only:: html

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

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