.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/coupling/plot_coupling_graph.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_examples_coupling_plot_coupling_graph.py: Coupling graph ============== This example illustrates the notion of coupling graph. .. GENERATED FROM PYTHON SOURCE LINES 27-33 .. code-block:: Python from __future__ import annotations from gemseo import generate_coupling_graph from gemseo.utils.discipline import DummyDiscipline .. GENERATED FROM PYTHON SOURCE LINES 34-38 Create the disciplines ---------------------- First, we create dummy disciplines that do nothing: .. GENERATED FROM PYTHON SOURCE LINES 38-60 .. code-block:: Python dummy_disciplines = [ DummyDiscipline(name=name, input_names=input_names, output_names=output_names) for (name, input_names, output_names) in ( ("A", ["a"], ["b"]), ("B", ["c"], ["a", "n"]), ("C", ["b", "d"], ["c", "e"]), ("D", ["f"], ["d", "g"]), ("E", ["e"], ["f", "h", "o"]), ("F", ["g", "j"], ["i"]), ("G", ["i", "h"], ["k", "l"]), ("H", ["k", "m"], ["j"]), ("I", ["l"], ["m", "w"]), ("J", ["n", "o"], ["p", "q"]), ("K", ["y"], ["x"]), ("L", ["w", "x"], ["y", "z"]), ("M", ["p", "s"], ["r"]), ("N", ["r"], ["t", "u"]), ("O", ["q", "t"], ["s", "v"]), ("P", ["u", "v", "z"], ["z"]), ) ] .. GENERATED FROM PYTHON SOURCE LINES 61-72 Generate the coupling graph --------------------------- The coupling graph represents each discipline by a node and each coupling variable by an edge. By default, the :func:`.generate_coupling_graph` function saves the graphical representation of the coupling graph as a PDF file. Here, we prefer to display it in this web page by setting ``file_path`` to ``""`` (the same would work in a notebook). .. GENERATED FROM PYTHON SOURCE LINES 72-74 .. code-block:: Python generate_coupling_graph(dummy_disciplines, file_path="") .. raw:: html
%3 A A C C A->C b B B C->B c E E C->E e B->A a J J B->J n M M J->M p O O J->O q E->J o D D E->D f G G E->G h D->C d F F D->F g F->G i H H G->H k I I G->I l H->F j I->H m L L I->L w K K L->K y P P L->P z N N M->N r O->M s O->P v K->L x P->P z P->_P z N->O t N->P u


.. GENERATED FROM PYTHON SOURCE LINES 75-77 We can also draw the condensed coupling graph, where each groups of strongly coupled disciplines is represented by a node: .. GENERATED FROM PYTHON SOURCE LINES 77-78 .. code-block:: Python generate_coupling_graph(dummy_disciplines, file_path="", full=False) .. raw:: html
%3 MDA of M, N, O MDA of M, N, O P P MDA of M, N, O->P u, v P->_0 z J J J->MDA of M, N, O p, q MDA of K, L MDA of K, L MDA of K, L->P z MDA of F, G, H, I MDA of F, G, H, I MDA of F, G, H, I->MDA of K, L w MDA of A, B, C, D, E MDA of A, B, C, D, E MDA of A, B, C, D, E->J n, o MDA of A, B, C, D, E->MDA of F, G, H, I g, h


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.048 seconds) .. _sphx_glr_download_examples_coupling_plot_coupling_graph.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_coupling_graph.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_coupling_graph.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_coupling_graph.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_