PCC
Tasks312simpler

Description

This code generates a simple diagram using the TikZ package in LaTeX.

The first part of the code defines a new box called "task", which is a small rectangle split into five parts.

The main part of the code creates a TikZ picture consisting of a chain of nodes connected by arrows. The nodes are circular and labeled t[0], t[1], t[2], and t[3]. The arrows connect each node to its immediate neighbors and loop back to the first node.

The arrows are drawn using the "bend left" option to create a curved path.

Overall, this code generates a simple circular linked list diagram.

Keywords

tikz, arrows, positioning, calc, chains, shapes.

Source Code

PCC

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc}
\usetikzlibrary{chains}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{shapes}
\begin{document}
 
\newsavebox{\task}
\savebox{\task}{%
    \begin{tikzpicture}[font=\small,
            >=stealth,
        ]
    \tikzset{every node/.style={rectangle split, draw, rotate=90}, rectangle split parts=5}
    \node[rectangle split, minimum width= 1.2cm,
                        minimum height = 1cm]  {};
    \end{tikzpicture}%
}
 
\begin{tikzpicture}
    {[start chain]
        \node[circle, start chain, draw] (t1){t[0]};
        \node[circle, on chain, right=1cm of t1, draw] (t2) {t[1]};
        %\node[block,on chain,join=by {arrow},right=1cm of N1] (N2) {N2};
        \node[circle,on chain,right=1cm of t2, draw] (t3) {t[2]};
        \node[circle,on chain, right=1cm of t3] (t4) {$\cdots$};
        \node[circle,on chain,right=1cm of t4, draw] (t5) {t[3]};
    }
    % Arrows
     \path (t1) edge[very thick,->,bend left=30] node [left] {} (t2);
     \path (t2) edge[very thick,->,bend left=30] node [left] {} (t3);
     \path (t3) edge[very thick, ->,bend left=30] node [left] {} (t4);
     \path (t4) edge[very thick, ->,bend left=30] node [left] {} (t5);
     
    % Arrows
     \path (t5) edge[very thick, ->,bend left=30] node [left] {} (t4);
     \path (t4) edge[very thick, ->,bend left=30] node [left] {} (t3);
     \path (t3) edge[very thick, ->,bend left=30] node [left] {} (t2);
     \path (t2) edge[very thick, ->,bend left=30] node [left] {} (t1);
\end{tikzpicture}
 
\end{document}
Deploy to Overleaf