Coupling graph#

This example illustrates the notion of coupling graph.

from __future__ import annotations

from gemseo import generate_coupling_graph
from gemseo.utils.discipline import DummyDiscipline

Create the disciplines#

First, we create dummy disciplines that do nothing:

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"]),
    )
]

Generate the coupling graph#

The coupling graph represents each discipline by a node and each coupling variable by an edge. By default, the 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).

generate_coupling_graph(dummy_disciplines)
%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


We can also draw the condensed coupling graph, where each groups of strongly coupled disciplines is represented by a node:

generate_coupling_graph(dummy_disciplines, file_path="", full=False)
%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


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

Gallery generated by Sphinx-Gallery