.. 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 ` 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 `_ 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-15 .. code-block:: Python import igraph as ig import matplotlib.pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 16-17 First, we construct a graph. This example shows usage of graph formulae: .. GENERATED FROM PYTHON SOURCE LINES 17-21 .. 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 22-23 Now we are aready to find the articulation points as a vertex sequence .. GENERATED FROM PYTHON SOURCE LINES 23-25 .. code-block:: Python articulation_points = g.vs[g.articulation_points()] .. GENERATED FROM PYTHON SOURCE LINES 26-27 Finally, we can plot the graph .. GENERATED FROM PYTHON SOURCE LINES 27-40 .. 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.087 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 ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: articulation_points.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: articulation_points.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_