Skip to main content
Engineering LibreTexts

11.5: Multiple Edges

  • Page ID
    43726
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The message edgesFrom: is used to draw one edge at most per node. A variant of it is edges:from:toAll:. It supports the definition of several edges starting from a given node. Consider the dependencies between classes. The script:

    view shape rectangle
        size: [:cls | cls referencedClasses size ];
        withText.
    view nodes: ArrayedCollection withAllSubclasses.
    view shape arrowedLine.
    view
        edges: ArrayedCollection withAllSubclasses from: #yourself toAll: #referencedClasses.
    view circleLayout.
    

    The obtained visualization is given in Figure \(\PageIndex{1}\).

    References between classes.
    Figure \(\PageIndex{1}\): Direct references between classes.

    String and CompiledMethod clearly shows up. These two classes contains many references to other classes. We also see that text: makes a shape contain a text.

    Mondrian provides a set of utility methods to easily create elements. Consider the expression:

    view edgesFrom: #superclass
    

    edgesFrom: is equivalent to edges:from:to: :

    view edges: Collection withAllSubclasses from: #superclass to: #yourself.
    

    itself equivalent to

    view
        edges: Collection withAllSubclasses
        from: [ :each | each superclass ]
        to: [ :each | each yourself ].
    

    This page titled 11.5: Multiple Edges is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.