I am looking to draw the following graph-like structure via TikZ. How can I do that? I am struggling to obtain the \otimes-nodes, the \oplus-nodes, the \top-nodes, the \bot-nodes and the dotted lines.
1 Answer
This should get you started. There are other ways, but this uses beginner-friendly ideas. Place nodes using the \node
command. Then draw edges with \draw
. There are many ways to stylize this once you get the basic idea. The easiest ways to draw curves are using bend left
and bend right
(optional angles), or out=, in=
as options for to
.
Since all the nodes have the same style, I included a tikzset
style called mynode
. That way you don't have to keep typing it each time and you can easily make changes.
Here is the code:
\documentclass{article}
\usepackage{tikz}
\tikzset{mynode/.style={draw, circle, inner sep=0pt}}
\begin{document}
\begin{tikzpicture}[thick]
\node[mynode](A) at (0,0){$\oplus$};
\node[mynode](B) at (-1,1){$\otimes$};
\node[mynode](C) at (-1,6){$\oplus$};
\node[mynode](D) at (0,5){$\oplus$};
\node[mynode](E) at (-.5,2){$\bot$};
\draw (A) --++(0,-1)node[right]{$(A\otimes\top)\oplus B$};
\draw (C) --++(0,1)node[right]{$A\oplus(\bot\oplus B)$};
\draw (A) to[out=180, in=-90] (B);
\draw (B) to[bend left] (C);
\draw (C) to[bend left] (D);
\draw (D) to[bend right=10] (E);
\end{tikzpicture}
\end{document}
-
Many thanks, this was very helpful! I was able to work out what I needed from your answer. Commented Sep 1, 2022 at 20:09
nodes
and curves between them. Nodes can be placed manually (with absolute coordinates) or relatively one to another. Then edges are to be drawn for example with Bezier curves.