

%%%%% DRAWING PUZZLE PIECES %%%%%%%%%%%%%%

\newcommand{\outRight}[2]{
    \draw[#1]
        (#2,1)--(#2+.5,0);
}\newcommand{\outLeft}[2]{
    \draw[#1]
        (#2,1)--(#2-.5,0);
}\newcommand{\inRight}[2]{
    \draw[#1]
        (#2,-1)--(#2+.5,0);
}\newcommand{\inLeft}[2]{
    \draw[#1]
        (#2,-1)--(#2-.5,0);
}

\newcommand{\outRed}[1]{\outRight{red, -stealth}{#1}}
\newcommand{\outBlue}[1]{\outLeft{blue, -stealth}{#1}}
\newcommand{\outOrange}[1]{\outRight{orange}{#1}}
\newcommand{\outGreen}[1]{\outLeft{green!80!black}{#1}}

\newcommand{\inRed}[1]{\inLeft{red}{#1}}
\newcommand{\inBlue}[1]{\inRight{blue}{#1}}
\newcommand{\inOrange}[1]{\inLeft{orange, stealth-}{#1}}
\newcommand{\inGreen}[1]{\inRight{stealth-, green!80!black}{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newcommand{\bigGofT}[7]{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n3) at (-1,1){$#3$};
        \node (n4) at (-1,-1){$#4$};
        \node (n1) at (0,0){$#1$};
        \node (n2) at (1,0){$#2$};
        \node (n5) at (2,1){$#5$};
        \node (n6) at (2,-1){$#6$};
        \node (n7) at (3,-1){$#7$};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick]
            \doubleArrow{n1}{n4}{14}
            \doubleArrow{n1}{n3}{13}
            \doubleArrow{n1}{n2}{12}
            \doubleArrow{n2}{n6}{26}
            \doubleArrow{n2}{n5}{25}
            \doubleArrow{n6}{n7}{67}
        \end{scope}
        %%%%%%%%% Sectors %%%%%%%%%
        \begin{scope}[thick, red, bend right]
            \curvedDoubleArrowPrime{14}{13}
            \curvedDoubleArrow{13}{12}
            \curvedDoubleArrow{12}{25}
            \curvedDoubleArrow{25}{26}
            \curvedDoubleArrow{26}{67}
        \end{scope}
}

\newcommand{\graphT}[6]{
    \begin{tikzpicture}[baseline=0, x=3em, y=3em]
            %%%%%%%%% Nodes %%%%%%%%%
            \node (n1) at (-1,1){$1$};
            \node (n2) at (-1,-1){$2$};
            \node (n3) at (0,0){$3$};
            \node (n4) at (1,0){$4$};
            \node (n5) at (2,1){$5$};
            \node (n6) at (2,-1){$6$};
            \node (n7) at (3,-1){$7$};

            %%%%%%%%% Edges %%%%%%%%%
            \begin{scope}[very thick]
                \draw (n1) -- (n3) 
                node [midway, above right]{$#1$};
                \draw (n2) -- (n3) 
                node [midway, below right]{$#2$};
                \draw (n3) -- (n4) 
                node [midway, above]{$#3$};
                \draw (n4) -- (n6) 
                node [midway, below left]{$#4$};
                \draw (n4) -- (n5) 
                node [midway, above left]{$#5$};
                \draw (n6) -- (n7) 
                node [midway, below]{$#6$};
            \end{scope}
        \end{tikzpicture}
}

\newcommand{\doubleArrow}[3]{
    \draw[-stealth,shifted path=from #1 to #2 by 1pt];
    \draw[-stealth,shifted path=from #2 to #1 by 1pt];
    \draw[opacity = 0] (#1) -- (#2) node[midway] (#3) {};
}
\newcommand{\doubleArrowSame}[3]{
    \draw[-stealth,shifted path=from #1 to #2 by 1pt];
    \draw[-stealth,shifted path=from #1 to #2 by -1pt];
    \draw[opacity = 0] (#1) -- (#2) node[midway] (#3) {};
}
\newcommand{\doubleArrowWithLabel}[4]{
    \draw[-stealth,shifted path label=from #1 to #2 by 2pt label #3];
    \draw[-stealth,shifted path label=from #2 to #1 by 2pt label #4];
}

% https://tex.stackexchange.com/questions/485486/
\tikzset{shifted path/.style args={from #1 to #2 by #3}{
insert path={
    let \p1=($(#1.east)-(#1.center)$),
        \p2=($(#2.east)-(#2.center)$),
        \p3=($(#1.center)-(#2.center)$),
        \n1={veclen(\x1,\y1)},
        \n2={veclen(\x2,\y2)},
        \n3={atan2(\y3,\x3)}
    in
    (#1.{\n3+180+asin(#3/\n1)}) to (#2.{\n3-asin(#3/\n2)})
}}}

\tikzset{shifted path label/.style args={from #1 to #2 by #3 label #4}{
insert path={
    let \p1=($(#1.east)-(#1.center)$),
        \p2=($(#2.east)-(#2.center)$),
        \p3=($(#1.center)-(#2.center)$),
        \n1={veclen(\x1,\y1)},
        \n2={veclen(\x2,\y2)},
        \n3={atan2(\y3,\x3)}
    in
    (#1.{\n3+180+asin(#3/\n1)}) to node[midway] (#1#2) {$#4$} (#2.{\n3-asin(#3/\n2)})
}}}

\newcommand{\curvedDoubleArrow}[2]{
    \draw[shifted curve=from #1 to #2 rad 19pt, -stealth];
    \draw[shifted curve=from #1 to #2 rad 21pt, stealth-];
}
\newcommand{\curvedDoubleArrowPrime}[2]{
    \draw[shifted curve prime=from #1 to #2 rad 19pt, -stealth];
    \draw[shifted curve prime=from #1 to #2 rad 21pt, stealth-];
}
\tikzset{shifted curve/.style args={from #1 to #2 rad #3}{
insert path = {
    let \p1=($(#1.center)-(0,0)$),
        \p2=($(#2.center)-(0,0)$),
        \p3=($(#2.center)-(#1.center)$),
        \n1={0.5*\x3},
        \n2={0.5*\y3},
        \n3={veclen(\n1,\n2)},
        \n4={sqrt(400pt-\n3^2)},
        \n5={\x1 + \n1 + (\n2*\n4/\n3)},
        \n6={\y1 + \n2 - (\n1*\n4/\n3)},
        \p5=($(#1.center)-(\n5,\n6)$),
        \p6=($(#2.center)-(\n5,\n6)$),
        \n7={atan2(\y5,\x5)},
        \n8={atan2(\y6,\x6)}
    in
    (\n5,\n6) ++ (\n8+15:#3) arc(\n8+15:\n7-15:#3)
}}}
\tikzset{shifted curve prime/.style args={from #1 to #2 rad #3}{
insert path = {
    let \p1=($(#1.center)-(0,0)$),
        \p2=($(#2.center)-(0,0)$),
        \p3=($(#2.center)-(#1.center)$),
        \n1={0.5*\x3},
        \n2={0.5*\y3},
        \n3={veclen(\n1,\n2)},
        \n4={sqrt(400pt-\n3^2)},
        \n5={\x1 + \n1 + (\n2*\n4/\n3)},
        \n6={\y1 + \n2 - (\n1*\n4/\n3)},
        \p5=($(#1.center)-(\n5,\n6)$),
        \p6=($(#2.center)-(\n5,\n6)$),
        \n7={atan2(\y5,\x5)},
        \n8={atan2(\y6,\x6)}
    in
    (\n5,\n6) ++ (\n8+15:#3) arc(\n8+15:360+\n7-15:#3)
}}}


\newcommand{\graphTprime}[6]{
    \begin{tikzpicture}[baseline=0, x=3em, y=3em]
            %%%%%%%%% Nodes %%%%%%%%%
            \node (n3) at (-1,1){$3$};
            \node (n4) at (-1,-1){$4$};
            \node (n1) at (0,0){$2$};
            \node (n2) at (1,0){$1$};
            \node (n5) at (2,1){$5$};
            \node (n6) at (2,-1){$6$};
            \node (n7) at (3,-1){$7$};

            %%%%%%%%% Edges %%%%%%%%%
            \begin{scope}[very thick]
                \draw (n1) -- (n4) 
                node [midway, below right]{$#1$};
                \draw (n1) -- (n3) 
                node [midway, above right]{$#2$};
                \draw (n1) -- (n2) 
                node [midway, above]{$#3$};
                \draw (n2) -- (n6) 
                node [midway, below left]{$#4$};
                \draw (n2) -- (n5) 
                node [midway, above left]{$#5$};
                \draw (n6) -- (n7) 
                node [midway, below]{$#6$};
            \end{scope}
        \end{tikzpicture}
}



\newcommand{\bigGofTprime}[7]{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n3) at (-1,1){$#3$};
        \node (n4) at (-1,-1){$#4$};
        \node (n1) at (0,0){$#1$};
        \node (n2) at (1,0){$#2$};
        \node (n5) at (2,1){$#5$};
        \node (n6) at (2,-1){$#6$};
        \node (n7) at (3,-1){$#7$};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick, stealth-stealth]
            \draw (n1) -- (n4) 
            node [midway] (14) {};
            \draw (n1) -- (n3) 
            node [midway] (13) {};
            \draw (n1) -- (n2) 
            node [midway] (12) {};
            \draw (n2) -- (n6) 
            node [midway] (26) {};
            \draw (n2) -- (n5) 
            node [midway] (25) {};
            \draw (n6) -- (n7) 
            node [midway] (67) {};
        \end{scope}
        %%%%%%%%% Sectors %%%%%%%%%
        \begin{scope}[thick, stealth-stealth, red, bend right]
            \draw (14) to [bend left=45] (13);
            \draw (13) to [bend left=45] (12);
            \draw (12) to [bend left=45] (25);
            \draw (25) to [bend left=45] (26);
            \draw (26) to [bend left=45] (67);
        \end{scope}
}

\newcommand{\labelingEx}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (0,0){1};
        \node (n2) at (1,0){2};
        \node (n3) at (2,1){3};
        \node (n4) at (2,0){4};
        \node (n5) at (3,0){5};
        \node (n6) at (2,-1){6};
        \node (n7) at (-1,-1){8};
        \node (n8) at (-1,-2){9};
        \node (n9) at (-2,-2){10};
        \node (n10) at (-2,-1){11};
        \node (n11) at (-1,0){12};
        \node (n12) at (-2,0){13};
        \node (n13) at (-1,1){14};
        \node (n14) at (-2,1){15};
        \node (n15) at (-1,2){16};
        \node (n16) at (3,-1){7};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick, -]
            \draw (n1) -- (n2) 
            node [midway,below] (12) {\small $\edouble$};
            \draw (n2) -- (n4) 
            node [midway] (24) {};
            \draw (n2) -- (n3) 
            node [midway] (23) {};
            \draw (n2) -- (n6) 
            node [midway] (26) {};
            \draw (n4) -- (n5) 
            node [midway] (45) {};
            \draw (n1) -- (n7) 
            node [midway] (17) {};
            \draw (n7) -- (n8) 
            node [midway] (78) {};
            \draw (n7) -- (n9) 
            node [midway] (79) {};
            \draw (n7) -- (n10) 
            node [midway] (710) {};
            \draw (n1) -- (n11) 
            node [midway] (111) {};
            \draw (n11) -- (n12) 
            node [midway] (1112) {};
            \draw (n1) -- (n13) 
            node [midway] (113) {};
            \draw (n13) -- (n14) 
            node [midway] (1314) {};
            \draw (n13) -- (n15) 
            node [midway] (1315) {};
            \draw (n6) -- (n16) 
            node [midway] (616) {};
        \end{scope}
}

\newcommand{\labelingExTwo}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (0,0){2};
        \node (n2) at (1,0){1};
        \node (n3) at (2,1){12};
        \node (n4) at (2,0){13};
        \node (n5) at (3,0){14};
        \node (n6) at (2,-1){15};
        \node (n7) at (-1,-1){3};
        \node (n8) at (-1,-2){4};
        \node (n9) at (-2,-2){5};
        \node (n10) at (-2,-1){6};
        \node (n11) at (-1,0){7};
        \node (n12) at (-2,0){8};
        \node (n13) at (-1,1){9};
        \node (n14) at (-2,1){10};
        \node (n15) at (-1,2){11};
        \node (n16) at (3,-1){16};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick, -]
            \draw (n1) -- (n2) 
            node [midway,below] (12) {\small $\edouble$};
            \draw (n2) -- (n4) 
            node [midway] (24) {};
            \draw (n2) -- (n3) 
            node [midway] (23) {};
            \draw (n2) -- (n6) 
            node [midway] (26) {};
            \draw (n4) -- (n5) 
            node [midway] (45) {};
            \draw (n1) -- (n7) 
            node [midway] (17) {};
            \draw (n7) -- (n8) 
            node [midway] (78) {};
            \draw (n7) -- (n9) 
            node [midway] (79) {};
            \draw (n7) -- (n10) 
            node [midway] (710) {};
            \draw (n1) -- (n11) 
            node [midway] (111) {};
            \draw (n11) -- (n12) 
            node [midway] (1112) {};
            \draw (n1) -- (n13) 
            node [midway] (113) {};
            \draw (n13) -- (n14) 
            node [midway] (1314) {};
            \draw (n13) -- (n15) 
            node [midway] (1315) {};
            \draw (n6) -- (n16) 
            node [midway] (616) {};
        \end{scope}
}

\newcommand{\standardEx}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (-1,1){1};
        \node (n2) at (0,0){2};
        \node (n3) at (-1,-1){3};
        \node (n4) at (1,0){4};
        \node (n5) at (2,0){5};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick,-]
            \doubleArrow{n1}{n2}{12};
            \draw[stealth-] (n2) -- (n3); 
            \draw[stealth-] (n2) -- (n4);
            \draw[-stealth] (n4) -- (n5); 
        \end{scope}
}

\newcommand{\disconnectedEx}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (-1,1){1};
        \node (n2) at (0,0){2};
        \node (n3) at (-1,-1){3};
        \node (n4) at (1,0){4};
        \node (n5) at (2,0){5};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick,-]
            \doubleArrow{n1}{n2}{12};
            \draw[-stealth] (n2) -- (n3); 
            \doubleArrowSame{n2}{n4}{24}; 
        \end{scope}
}


\newcommand{\plainEx}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (-1,1){1};
        \node (n2) at (0,0){2};
        \node (n3) at (-1,-1){3};
        \node (n4) at (1,0){4};
        \node (n5) at (2,0){5};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick,-]
            % \draw (n1) -- (n2)
            % node [near start, right] (12) {\tiny $e_1$};
            % \draw (n2) -- (n3)
            % node [near end,right] (23) {\tiny $e_2$}; 
            \draw (n1) -- (n2) node[midway, anchor = south west]{\tiny $e_1$}; 
            \draw (n2) -- (n3) node[midway, anchor = north west]{\tiny $e_2$}; 
            \draw (n2) -- (n4)
            node [midway, above] (24) {\tiny $e_3$};
            \draw (n4) -- (n5)
            node [midway, above] (45) {\tiny $e_4$};
        \end{scope}
}


\newcommand{\nonstandardEx}{
        %%%%%%%%% Nodes %%%%%%%%%
        \node (n1) at (-1,1){1};
        \node (n2) at (0,0){2};
        \node (n3) at (-1,-1){3};
        \node (n4) at (1,0){4};
        \node (n5) at (2,0){5};
        %%%%%%%%% Arcs %%%%%%%%%
        \begin{scope}[thick,-]
            \draw[stealth-](n1) -- (n2);
            \draw[stealth-] (n4) -- (n5); 
            \doubleArrowSame{n2}{n4}{24};
            \draw[-stealth] (n2) -- (n3);
        \end{scope}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\DoubleEdge}{% https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZAJgBoBGAXVJADcBDAGwFcYkR6QBfU9TXfIRQAWCtTpNW7AEbdeIDNjwEiAVlIAGcQxZtEIADoHsAcwC29ABRYAlHL5LBasTR1T9R6c0aMYOewr8ykLI6sTaknqGxljmVgBWdjwOAioo5JoRuuxYAYqpIRnhrpHs8XlBTigaLhLZHgZePn4VjmnI5BlUJfUgssmBbYVk3XXu0U2+-gP5wUTkAMykxWNRnt5TrQVEAGzLWePrzdPys1XINVo9h40bLTOV7QAcmddRuQ9DRADsr6vsR02n226TIV3+DV8ADMcJYjKYLEYAIQAAiMAGMsAAndHIlHWAB+iSMWNiAAscDZLIktnMUL9Rm41rdjrTzgBOWpM9icYF0jpkFbcyEwGFwmJxPEY7G4gyownEgykkwUqm2NnPfZvMrccQwKAmeBEUBQrEQMxIDIgHAQJBkEBkmD0KDsSBgNgDU3my00G1IJYOp0u-Ruj3yL0WxBWv2IUSB52ughsGiMejSGCMAAKjyEIGVFICEaQNWttsQe3jwfAScLZsjcZjnRojoTIZrnrrlvtMfUlcT7tr3sQvZjvz7bYHHaHL1LSE54+rA5TWAH+jgEEYWBdKbTGezX300JOJs7UYbZcWzaD-bDJ6H5ArjYDLarocHkcvs6jY5fN-fSBnRte1-CdbxAIso0AssZxAxcwIg8goMtEtYLfKcPzHRt51Q9tw1PEcyxQ69QP-RAS0bGg4DJLAYSQABaK1hXA6wkjwodyIvSjqNoqNtX0KFqTsHd0yzHN2HzY9wNPchMOgriaP8RAGL4kBLChZFpRxZEFRsKkaXQy1ZIA+SeMY0p9DUjSDExLS5R0tUhJAVMRP3EE83JaZKC4IA
\begin{tikzcd}
\bullet \arrow[r, no head] & i \arrow[ld, no head] \arrow[rd, no head] &                                                                                       &  &                                                              & \sigma(i)                    &         & \bullet \arrow[r, no head]  & i \arrow[rd, no head] &                                                                                                                       &  &                                          & \left(\sigma\! \circ\! (i~j)\right)(j)                                        &         \\
\bullet                    &                                           & a \arrow[ld, no head] \arrow[rr, "f(i)", shift left] \arrow[rr, "f(j)"', shift right] &  & b \arrow[ru, no head] \arrow[r, no head] \arrow[rd, no head] & \bullet                      &         & \bullet \arrow[ru, no head] &                       & a \arrow[ld, no head] \arrow[rr, "(f\!\circ\!(i~j))(j)", shift left] \arrow[rr, "(f\!\circ\!(i~j))(i)"', shift right] &  & b \arrow[r, no head] \arrow[ru, no head] & \bullet                                                                       &         \\
                           & j                                         &                                                                                       &  &                                                              & \sigma(j) \arrow[r, no head] & \bullet &                             & j                     &                                                                                                                       &  &                                          & \left(\sigma\! \circ\! (i~j)\right)(i) \arrow[lu, no head] \arrow[r, no head] & \bullet
\end{tikzcd}}

\newcommand{\Disconnected}{
% https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZAJgBoBGAXVJADcBDAGwFcYkQsQBfU9TXfIRQBmCtTpNW7AFbdeIDNjwEiAFlIAGcQxZtEIADoGARs0aMYOOXyWC1Ymjqn6jp85esL+yocnXFtST1DA2wAcwBbegAKLABKT0UBFRRyTUDddlczCyseG2TfNIDHIKyTHI98r1sU5A0HCUyXCvc8+SSfIgBORqdg2WrOu1SGqlLmkLdcxO8R5HJijOcpyvaCrpQAVlISppXsttna3watCYPQrEiY6QShubqAdnSL4MOZh5OiADZX-eC0SM4SiRgAxlgAE5g2IAPzucVi9w6jyKZ2W71anxR3xQf3GAPK0yqOMKRAAHH0yvpOF8yaNdhj2ECrjdwVCYVh4XFEXdjvTkC89v0iWtuOIYFAwvAiKAAGaQiARJANEA4CBINIgRhYMDBKD0OAAC0lIBoJvoUHYkD1ZrV9CwjGtBDYNEY9GMMEYAAVUewLHL1iAFUrNTR1UgyCALVb9Da2NUQ8rEFqI4hRNGYJbnbbE4rk6mNYh1Jns3GXXaRfo5Ui7e7PT6-fpIdcjUGk0gdmqi6qYznXYTq9E+XnQ4hVWm-qXY+AK6PkyW04tzVmZ-HPB2U1G012++Xc-JN120y9p-2N-mkJTu0hemf9wOdbb9HAIDqrW6PV7fbjtTBAxeY7kIuRbkBme6zge8qXimU5LuBq7nvOmoZkup4QeubzMnK7LQnCCK1shKanmm14YRWbq6vqhomlaRHXkuu6IQ+gEFgxRZkcxkEDlWIDRDhBgQnhXIESOh4weQ7Gar2XHrkR5AkaBd7kbmlBcEAA
\begin{tikzcd}
\sigma(j) \arrow[r, no head] & \bullet \arrow[rd, "f(j)", no head] \arrow[ld, no head] &                                                  &                                                                       & \bullet                      &         & (\sigma\circ(i~j))(i) \arrow[r, no head] & \bullet \arrow[rd, "(f\circ(i~j))(i)", no head] &                                                  &                                          & \bullet                                                                          &         \\
\bullet                      &                                                         & i \arrow[r, no head, dashed] \arrow[ld, no head] & j \arrow[ru, no head] \arrow[r, no head] \arrow[rd, "f(i)"', no head] & \bullet                      &         & \bullet \arrow[ru, no head]              &                                                 & i \arrow[r, no head, dashed] \arrow[ld, no head] & j \arrow[r, no head] \arrow[ru, no head] & \bullet                                                                          &         \\
                             & \bullet                                                 &                                                  &                                                                       & \sigma(i) \arrow[r, no head] & \bullet &                                          & \bullet                                         &                                                  &                                          & (\sigma\circ(i~j))(j) \arrow[lu, "(f\circ(i~j))(j)", no head] \arrow[r, no head] & \bullet
\end{tikzcd}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tree and catalysts (from Alvaro's slides)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tikzset{
  ec/.style={every coordinate/.try}
}
\newcommand{\markAt}[2]{
        \draw[-{angle 90}] ([ec]#1) -- ($([ec]#1)!0.6!([ec]#2)$);
}
\newcommand{\defineCoords}[1][1.2cm]{
        \coordinate (1) at (0,0);
        \coordinate (3) at ($(1)+ (-135:#1)$);
        \coordinate (2) at ($(1)+ (0:#1)$);
        \coordinate (6) at ($(2) +(-45:#1)$);
        \coordinate (4) at ($(1) +(-90:#1) $); 
        \coordinate (7) at ($(4) +(-135:#1)$); 
        \coordinate (9) at ($(4) +(-45:#1) $); 
        \coordinate (8) at ($(4) +(-90:#1) $); 
        \coordinate (5) at ($(2) +(-90:#1) $);
}
\newcommand{\figT}[1][1.2cm]{
\begin{tikzpicture}[baseline = -#1]
    \defineCoords[#1]
    \placeEdgesOfT
    \foreach \i in {1,...,9}{
        \filldraw[draw = white, fill = white] (\i) circle (5pt) node (_) {\scriptsize$\i$}; %circle (.2em);
    }
\end{tikzpicture}}


\newcommand{\placeEdgesOfT}{
    % Draws the edges of the tree T.
    % Assumes nodes are placed using \defineCoords
        \foreach \i in {1,...,9}{
            \fill (\i) circle (.2em);
        }
        \begin{scope}[semithick]
            %\draw (R) -- (1);
            \draw (4) -- (7);
            \draw (4) -- (9);
            %\draw (R) -- (2);
            %\draw (1) -- (2);
            %\draw (2) -- (1);
            \draw (2) -- (5);
            \draw (1) -- (2);
            \draw (1) -- (3);
            \draw (1) -- (4);
            \draw (4) -- (8);
            \draw (2) -- (6);
        \end{scope}
}

\newcommand{\catalystUnital}{
\begin{tikzpicture}[baseline = 0cm,  USred2, x=1.1em, y=1.1em]
    \catalystUnitalContent
\end{tikzpicture}
}

\newcommand{\catalystUnitalOnePath}{
\begin{tikzpicture}[baseline = -1cm,  USred2!20, x=1.1em, y=1.1em]
    \catalystUnitalContent
        % 9 to 1 marked at 41
    \begin{scope}[USred2, every coordinate/.style={shift={(.2,-.2)}}]
        \draw ([ec]9) -- ([ec]4) -- ([ec]1); \markAt{4}{1}
    \end{scope}
\end{tikzpicture}
}

\newcommand{\catalystUnitalContent}{
        \defineCoords[1cm]
        % 1 to 6 marked at 12
        \begin{scope}[every coordinate/.style={shift={(0,.3)}}]
            \draw ([ec]1) -- ([ec]2) -- ([ec]6); \markAt{1}{2};
        \end{scope}
        % 2 to 5 marked at 25
        \begin{scope}[every coordinate/.style={shift={(0,-.5)}}]
            \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        \end{scope}        
        % 3 to 8 marked at 31
        \begin{scope}[every coordinate/.style={shift={(-.2,-.3)}}]
            \draw ([ec]3) -- ([ec]1) -- ([ec]4) -- ([ec]8); \markAt{3}{1}
        \end{scope}
        % 4 to 7 marked at 47
        \begin{scope}[every coordinate/.style={shift={(-.4,-.3)}}]
            \draw ([ec]4) -- ([ec]7); \markAt{4}{7}
        \end{scope}        
        % 5 to 3 marked at 21
        \begin{scope}[every coordinate/.style={shift={(-.3,0)}}]
            \draw ([ec]5) -- ([ec]2) -- ([ec]1) -- ([ec]3); \markAt{2}{1}
        \end{scope}
        % 6 to 2 marked at 62
        \begin{scope}[every coordinate/.style={shift={(0,-.2)}}]
            \draw ([ec]6) -- ([ec]2); \markAt{6}{2}
        \end{scope}
        % 7 to 9 marked at 49   
        \begin{scope}[every coordinate/.style={shift={(0,-.4)}}]
            \draw ([ec]7) -- ([ec]4) -- ([ec]9);  \markAt{4}{9};
        \end{scope}
        % 8 to 4 marked at 84
        \begin{scope}[every coordinate/.style={shift={(.1,-.8)}}]
            \draw ([ec]8) -- ([ec]4); \markAt{8}{4}
        \end{scope}
        % 9 to 1 marked at 41
        \begin{scope}[every coordinate/.style={shift={(.2,-.2)}}]
            \draw ([ec]9) -- ([ec]4) -- ([ec]1); \markAt{4}{1}
        \end{scope}
}

\newcommand{\catalystDisconnected}{
\begin{tikzpicture}[baseline = -1cm,  USred2, x=1.1em, y=1.1em]
        \defineCoords[1cm]
        % 1 to 6 marked at 26
        \draw ([shift={(.3,0)}]1) -- (2) -- (6);
        \markAt{2}{6};
        % 2 to 5 marked at 25
        \begin{scope}[every coordinate/.style={shift={(.2,-.5)}}]
            \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        \end{scope}        
        % 3 to 4 marked at 31
        \begin{scope}[every coordinate/.style={shift={(-.6,-.6)}}]
            \draw ([ec]3) -- ([ec]1) -- ([ec]4); \markAt{3}{1}
        \end{scope}
        % 4 to 1 marked at 41
        \begin{scope}[every coordinate/.style={shift={(-.3,-.2)}}]
            \draw ([ec]4) -- ([ec]1); \markAt{4}{1}
        \end{scope}        
        % 5 to 9 marked at 49
        \begin{scope}[every coordinate/.style={shift={(.4,-.4)}}]
            \draw ([shift={(-.2,-.4)}]5) -- ([shift={(-.2,-.4)}]2) -- ([ec]1) -- ([ec]4) -- ([ec]9); \markAt{4}{9}
        \end{scope}
        % 6 to 3 marked at 62
        \begin{scope}[every coordinate/.style={shift={(0,.6)}}]
            \draw ([ec]6) -- ([ec]2) -- ([ec]1) -- ([shift={(-.6,0)}]3); \markAt{6}{2}
        \end{scope}
        % 7 to 2 marked at 74
        \draw ([shift={(0,-.4)}]7) -- ([shift={(0,-.4)}]4) -- ([shift={(0,.3)}]1) -- ([shift={(0,.3)}]2); 
        \draw[-{angle 90}] ([shift={(0,-.4)}]7) -- ($([shift={(0,-.4)}]7)!0.7!([shift={(0,-.4)}]4)$);
        % 8 to 7 marked at 47
        \begin{scope}[every coordinate/.style={shift={(0,-.8)}}]
            \draw ([ec]8) -- ([ec]4) -- ([ec]7); \markAt{4}{7}
        \end{scope}
        % 9 to 8 marked at 48
        \begin{scope}[every coordinate/.style={shift={(.4,-.8)}}]
            \draw ([ec]9) -- ([ec]4) -- ([ec]8); \markAt{4}{8}
        \end{scope}
    \end{tikzpicture}
}

\newcommand{\catalystParallel}{
    \begin{tikzpicture}[baseline = -1cm,  USred2, x=1.1em, y=1.1em]
        \defineCoords[1cm]
                % 1 to 6 marked at 12
        \draw ([shift={(.3,0)}]1) -- (2) -- (6);
        \draw[-{angle 90}] ([shift={(.3,0)}]1) -- ($([shift={(.3,0)}]1)!0.4!(2)$);
        % 2 to 5 marked at 25
        \begin{scope}[every coordinate/.style={shift={(.2,-.5)}}]
            \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        \end{scope}        
        % 3 to 4 marked at 31
        \begin{scope}[every coordinate/.style={shift={(-.6,-.6)}}]
            \draw ([ec]3) -- ([ec]1) -- ([ec]4); \markAt{3}{1}
        \end{scope}
        % 4 to 1 marked at 41
        \begin{scope}[every coordinate/.style={shift={(-.3,-.2)}}]
            \draw ([ec]4) -- ([ec]1); \markAt{4}{1}
        \end{scope}        
        % 5 to 9 marked at 49
        \begin{scope}[every coordinate/.style={shift={(.4,-.4)}}]
            \draw ([shift={(-.2,-.4)}]5) -- ([shift={(-.2,-.4)}]2) -- ([ec]1) -- ([ec]4) -- ([ec]9); \markAt{4}{9}
        \end{scope}
        % 6 to 3 marked at 62
        \begin{scope}[every coordinate/.style={shift={(0,.6)}}]
            \draw ([ec]6) -- ([ec]2) -- ([ec]1) -- ([shift={(-.6,0)}]3); \markAt{6}{2}
        \end{scope}
        % 7 to 6 marked at 12
        \draw ([shift={(0,-.4)}]7) -- ([shift={(0,-.4)}]4) -- ([shift={(0,.3)}]1) -- ([shift={(0,.3)}]2); 
        \draw[-{angle 90}] ([shift={(0,.3)}]1) -- ($([shift={(0,.3)}]1)!0.7!([shift={(0,.3)}]2)$);
        % 8 to 7 marked at 47
        \begin{scope}[every coordinate/.style={shift={(0,-.8)}}]
            \draw ([ec]8) -- ([ec]4) -- ([ec]7); \markAt{4}{7}
        \end{scope}
        % 9 to 8 marked at 48
        \begin{scope}[every coordinate/.style={shift={(.4,-.8)}}]
            \draw ([ec]9) -- ([ec]4) -- ([ec]8); \markAt{4}{8}
        \end{scope}
    \end{tikzpicture}
}

\newcommand{\arrowflowUnital}{
\begin{tikzpicture}[baseline = -1.2cm, every node/.style={inner sep=0,outer sep=0}, USblue,, x=1em, y=1em]
            \defineCoords
        % 1 to 6 marked at 12
        \begin{scope}[every coordinate/.style={shift={(0,.15)}}]
            \draw ([ec]1) -- ([ec]2);
            \draw[-{angle 90}] ([ec]1) -- ($([ec]1)!0.7!([ec]2)$);       
        \end{scope}
        % 2 to 5 marked at 25
            \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        % 3 to 8 marked at 31
            \draw ([ec]3) -- ([ec]1); \markAt{3}{1}
        % 4 to 7 marked at 47
            \draw ([ec]4) -- ([ec]7); \markAt{4}{7}
        % 5 to 3 marked at 12
        \begin{scope}[every coordinate/.style={shift={(0,-.15)}}]
            \draw ([ec]2) -- ([ec]1);
            \draw[-{angle 90}] ([ec]2) -- ($([ec]2)!0.7!([ec]1)$);
        \end{scope}
        % 6 to 2 marked at 62
            \draw ([ec]6) -- ([ec]2); \markAt{6}{2}
        % 7 to 9 marked at 49
            \draw ([ec]4) -- ([ec]9); \markAt{4}{9}
        % 8 to 4 marked at 84
            \draw ([ec]8) -- ([ec]4); \markAt{8}{4}
        % 9 to 1 marked at 41
            \draw ([ec]4) -- ([ec]1); \markAt{4}{1}
        
        \foreach \i in {1,...,9}{
            \filldraw[draw = white, fill = white] (\i) circle (5pt) node (_) {\scriptsize$\i$}; %circle (.2em);
        }
\end{tikzpicture}
}

\newcommand{\arrowflowUnitalOnePath}{
\begin{tikzpicture}[baseline = -1.2cm, every node/.style={inner sep=0,outer sep=0}, USblue,, x=1em, y=1em]
    \arrowflowUnitalContent
\end{tikzpicture}
}

\newcommand{\arrowflowDisconnected}{
\begin{tikzpicture}[baseline = -1.2cm, every node/.style={inner sep=0,outer sep=0}, USblue,, x=1em, y=1em]
        \defineCoords
        \foreach \i in {1,...,9}{
            \fill (\i) circle (.2em);
        }
        % 1 to 6 marked at 12
        \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        \draw ([ec]3) -- ([ec]1); \markAt{3}{1}
        \draw ([ec]4) -- ([ec]1); \markAt{4}{1}
        
        \begin{scope}[every coordinate/.style={shift={(0,-.2)}}]
            \draw ([ec]2) -- ([ec]6);
            \draw[-{angle 90}] ([ec]2) -- ($([ec]2)!0.5!([ec]6)$); %\markAt{1}{2}
        \end{scope}
        \begin{scope}[every coordinate/.style={shift={(0,.2)}}]
            \draw ([ec]6) -- ([ec]2); 
            \draw[-{angle 90}] ([ec]6) -- ($([ec]6)!0.7!([ec]2)$); %\markAt{1}{2}
        \end{scope}
        \draw ([ec]4) -- ([ec]9); \markAt{4}{9}
        \begin{scope}[every coordinate/.style={shift={(-.2,0)}}]
            \draw ([ec]7) -- ([ec]4); 
            \draw[-{angle 90}] ([ec]7) -- ($([ec]7)!0.7!([ec]4)$); 
        \end{scope}
        \begin{scope}[every coordinate/.style={shift={(.2,0)}}]
            \draw ([ec]4) -- ([ec]7); 
            \draw[-{angle 90}] ([ec]4) -- ($([ec]4)!0.7!([ec]7)$); 
        \end{scope}
        \draw ([ec]4) -- ([ec]8); \markAt{4}{8}
        \foreach \i in {1,...,9}{
            \filldraw[draw = white, fill = white] (\i) circle (5pt) node (_) {\scriptsize$\i$}; %circle (.2em);
        }
    \end{tikzpicture} 
}

\newcommand{\arrowflowParallel}{
    \begin{tikzpicture}[baseline = -1.2cm, every node/.style={inner sep=0,outer sep=0}, USblue,, x=1em, y=1em]
        \defineCoords
        \foreach \i in {1,...,9}{
            \fill (\i) circle (.2em);
        }
        % 1 to 6 marked at 12
        \begin{scope}[every coordinate/.style={shift={(0,.15)}}]
            \draw ([ec]1) -- ([ec]2); 
            \draw[-{angle 90}] ([ec]1) -- ($([ec]1)!0.7!([ec]2)$); %\markAt{1}{2}
        \end{scope}
        % 2 to 5 marked at 25
            \draw ([ec]2) -- ([ec]5); \markAt{2}{5}
        % 3 to 8 marked at 31
            \draw ([ec]3) -- ([ec]1); \markAt{3}{1}
        % 4 to 7 marked at 47
            \draw ([ec]4) -- ([ec]7); \markAt{4}{7}
        % 5 to 3 marked at 12
        \begin{scope}[every coordinate/.style={shift={(0,-.15)}}]
            \draw ([ec]1) -- ([ec]2);
            \draw[-{angle 90}] ([ec]1) -- ($([ec]1)!0.5!([ec]2)$); %\markAt{1}{2}
        \end{scope}
        % 6 to 2 marked at 62
            \draw ([ec]6) -- ([ec]2); \markAt{6}{2}
        % 7 to 9 marked at 49
            \draw ([ec]4) -- ([ec]9); \markAt{4}{9}
        % 8 to 4 marked at 84
            \draw ([ec]8) -- ([ec]4); \markAt{4}{8}
        % 9 to 1 marked at 41
            \draw ([ec]4) -- ([ec]1); \markAt{4}{1}
        \foreach \i in {1,...,9}{
            \filldraw[draw = white, fill = white] (\i) circle (5pt) node (_) {\scriptsize$\i$}; %circle (.2em);
        }
    \end{tikzpicture}
}