3

By fusion I mean to insert boxes connected with wires such that the wires can be tangled or fused as shown in the picture below. You see in the right hand side that the yellow cable goes below the red one.

enter image description here

I could (possibly) draw this on Tikz but I would prefer to have an automated way to write down such graphs where the curves of the cables are fixed according to how "far" they travel or such.

Any help is appreciated.


Edit: using the braids package I could draw pictures as:

enter image description here

But it is quite time consuming and hard to draw the boxes and maybe define styling in a unified manner.

2
  • You can do this with the braids package.
    – Sandy G
    Jun 3, 2022 at 11:40
  • I have tried to do the wiring with the braids, but its hard to do the boxes really. I could do something like the picture (added now in the question) but by manually defining nodes of boxes
    – Marion
    Jun 3, 2022 at 11:52

2 Answers 2

2

You said in a comment that you'd tried with the braids package but it was hard to do the boxes. Since a braid is littered with coordinates, using the fit library then the boxes needn't be tricky.

In the following, I draw the braids first and then use the coordinates to define nodes. By filling these nodes in the background colour, I can then "wipe out" parts of the braid strands. I use a lot of 1s in the braid word to ensure that the strands are long enough whilst also providing plenty of coordinates along their length (an alternative would be to use the braid height to lengthen the individual pieces and then use the calc library to fill in for coordinates that aren't there).

While the code may look long, a fair bit could be wrapped up in styles (the styles on each braid are largely identical) and also there aren't loads of supplementary calculations going on. Even the fits could be simplified as each can be written as fit=(braid-i-j) (braid-i+1-j+1).

Indeed, were I to do a lot of these then I'd probably wrap it into a pic (since pics can be nested) which set the styles for the strands, handled the labelling, and then I'd define a separate pic for the boxes which just took one coordinate and the label.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/646559/86}
\usepackage{tikz}
\usetikzlibrary{braids,fit}

\begin{document}

\begin{tikzpicture}

\coordinate (above) at (0,1.5);
\coordinate (below) at (0,-1.5);

\pic[
  rotate=90,
  braid/.cd,
  number of strands=3,
  every strand/.style={ultra thick},
  strand 1/.style={red},
  strand 2/.style={green},
  strand 3/.style={blue},
  anchor=1-3
] at (above)  (simple) {braid={1 1 1 1 1}};

\node[left] at (simple-3-s) {\(\alpha\)};
\node[left] at (simple-2-s) {\(\beta\)};
\node[left] at (simple-1-s) {\(\gamma\)};

\node[right] at (simple-3-e) {\(\alpha\)};
\node[right] at (simple-2-e) {\(\beta\)};
\node[right] at (simple-1-e) {\(\gamma\)};

\node[fit=(simple-2-1) (simple-3-2),draw,fill=white] {\(U_{\beta\alpha}\)};
\node[fit=(simple-2-3) (simple-1-4),draw,fill=white] {\(U_{\gamma\beta}\)};


\pic[
  rotate=90,
  braid/.cd,
  number of strands=3,
  every strand/.style={ultra thick},
  strand 1/.style={red},
  strand 2/.style={green},
  strand 3/.style={blue},
  anchor=3-5
] at (below) (fusion) {braid={1 1 1 s_1^{-1} 1 1 1 1 1}};

\node[left] at (fusion-3-s) {\(\alpha\)};
\node[left] at (fusion-2-s) {\(\beta\)};
\node[left] at (fusion-1-s) {\(\gamma\)};

\node[right] at (fusion-3-e) {\(\alpha\)};
\node[right] at (fusion-2-e) {\(\beta\)};
\node[right] at (fusion-1-e) {\(\gamma\)};

\node[fit=(fusion-1-1) (fusion-2-2),draw,fill=white] {\(U_{\gamma\beta}\)};
\node[fit=(fusion-1-5) (fusion-3-6),draw,fill=white] {\(U_{\gamma\alpha}\)};
\node[fit=(fusion-1-7) (fusion-2-8),draw,fill=white] {\(U_{\beta\gamma}\)};

\path (simple-1-3) -- (fusion-3-4) node[font=\Huge,pos=.5] {\(=\)};

\end{tikzpicture}

\end{document}

fusion operations with braids

5

Not automatic, but not too complicated

\documentclass[tikz, border=2mm]{standalone}

\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[box/.style={draw, minimum size=15mm},
    crossingline/.style={double, draw=white, double=black, very thick}]
    
\node[box] (A) {$U_{\beta\alpha}$};
\draw ([yshift=-3mm]A.north west) coordinate (A1) --++(180:8mm) node[left] (alpha) {$\alpha$};
\draw ([yshift=3mm]A.south west) coordinate (A2) --++(180:8mm) node[left] (beta) {$\beta$};
\node[box, above right= 6mm and 1cm of A.south east, anchor=north west] (B) {$U_{\gamma\beta}$};
\draw ([yshift=3mm]B.south west) coordinate (B2) -- (B2-|alpha.east) node [left] {$\gamma$};
\draw (B2-|B.east) --++(0:8mm) node [right] (gamma) {$\gamma$};
\draw (A2-|B.east)--(A2-|gamma.west) node [right] {$\beta$};
\draw (A1-|A.east)--(A1-|gamma.west) node [right] {$\alpha$};
\draw (A2-|A.east)--(A2-|B.west);

\end{tikzpicture}


\begin{tikzpicture}[box/.style={draw, minimum size=15mm},
    crossingline/.style={double, draw=white, double=black, very thick}]
    
\node[box] (A) {$U_{\gamma\beta}$};
\node[box, below right= 6mm and 3cm of A.north east, anchor=south west] (B) {$U_{\gamma\alpha}$};
\node[box, above right= 6mm and 1cm of B.south east, anchor=north west] (C) {$U_{\beta\gamma}$};

\draw ([yshift=3mm]A.south west) coordinate (A2) --++(180:8mm) node[left] (gamma) {$\gamma$};
\draw ([yshift=-3mm]A.north west) coordinate (A1) --++(180:8mm) node[left] (beta) {$\beta$};
\draw ([yshift=-3mm]B.north west) coordinate (B1) -- (B1-|gamma.east) node [left] {$\alpha$};

\draw (A1-|B.east)--(A1-|C.west);
\draw (A1-|C.east) --++(0:8mm) node[right] (beta) {$\beta$};
\draw (A2-|C.east) --(A2-|beta.west) node[right] {$\gamma$};
\draw (B1-|B.east) --(B1-|beta.west) node[right] {$\alpha$};

\path (A1-|A.east) -- coordinate[midway] (center1) (A1-|B.west);
\path (A2-|A.east) -- coordinate[midway] (center2) (A2-|B.west);

\draw[rounded corners] (A1-|A.east) -- ([xshift=-5mm]center1)--([xshift=5mm]center2)--(A2-|C.west);
\draw[rounded corners, crossingline] (A2-|A.east) -- ([xshift=-5mm]center2)--([xshift=5mm]center1)--(A1-|B.west);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .