0

I asked this question Graphs in beamer. I need to make a graph like in the image below. This is part of a directed graph which has lots of nodes, edges that intersect and nodes that make the edges can not be straight but curved, also I need a text to be displayed at the end of some of those edges.

enter image description here

I realised that it would be complicated to build a graph with this kind of nodes, is there a way of doing that in a simple and modular way?

4

This addresses the question how to make things more modular. The answer is: use pgf styles, keys, and macros. In your case this could mean something like the following, in which

\node[blob={1,3}](A){\MC3A5};

produces

enter image description here

As you can see, you only provide the varying data, the rest is done by LaTeX.

This can be embedded in a matrix, say.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,bending}
\usepackage{mathtools}
\usepackage{relsize}
\newcounter{icount}
\begin{document}
\begin{tikzpicture}[>={Latex[bend]},
    eblob/.style={circle,draw,minimum size=5em},
    blob/.style={eblob,
    label={[anchor=center,circle,draw,fill=gray!10,minimum size=2.8em,inner
    sep=0pt]0:{$\renewcommand{\arraystretch}{0.5}\scriptscriptstyle\begin{array}{@{}r@{}l@{}}
        \scriptscriptstyle\tikzset{IC={#1}}\vspace*{-1.5ex}\end{array}$}}}]
 \newcommand{\MC}[4][]{${}_{#2}{\mathlarger{\mathlarger{#3}}}_{#4}$}    
 \tikzset{ICi/.code={\stepcounter{icount}\scriptscriptstyle\textcolor{red}{\Alph{icount}:}&
    \scriptscriptstyle\textcolor{blue}{/#1}\\},
 IC/.code={\setcounter{icount}{0}\tikzset{ICi/.list={#1}}}}
 \matrix[column sep=2em,row sep=3em](m){
 \node[blob={1,3}](A){\MC3A5}; \\
 \node[blob={2,3,4}](B){\MC4B5}; &
 \node[blob={2,3,2}](B'){\MC5B6}; & &
 \node[eblob](E){\MC8\varepsilon8}; \\
 & \node[blob={2,5,5}](C){\MC5C6}; \\
 };
 \draw[->] (A) to[out=-45,in=135] (C);
 \draw[->] (B.45) to[bend left] (E);
\end{tikzpicture}
\end{document}

enter image description here

One could also embed this in tikz-cd, say, but any of these design choices depend on information that is not provided like the general structure of these graphs. The edge labels can be dealt with similarly.

Note also that when you want to embed this in beamer you need to make the frame fragile or move the styles and macros out of the tikzpicture (or add several #).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.