[Tex/LaTex] doubly linked list tikz

tikz-pgftikz-styles

I want to draw two doubly linked lists and I know that I can use the tikz package. But I don't know how to. Could anyone show an example code piece for the following doubly linked list?

I found some questions that are related to drawing doubly linked lists, e.g., How should I draw a singly/double linked list?. But I don't how to draw the "…" in the figure.

enter image description here

Best Answer

Arguably overkill, but here's a version using the TikZ libraries shapes.multipart, chains and positioning:

\documentclass[border=20pt,tikz]{standalone}
\usetikzlibrary{shapes.multipart,chains, positioning}
\begin{document}
\begin{tikzpicture}
    [
      double link/.style n args=2{% page 726
        on chain,
        rectangle split,
        rectangle split horizontal,
        rectangle split parts=2,
        draw,
        anchor=center,
        text height=1.5ex,
        node contents={#1\nodepart{two}#2},
      },
      start chain=going right,
    ]
    \node [on chain] {$\phi$};
    \node [join={by <-}, double link={a}{b}];
    \node [join={by <->}, double link={c}{d}];
    \node (a) [join={by <->}, double link={e}{f}];
    \node (b) [on chain, right=2.5pt of a.east] {$\cdots$};
    \node [double link={y}{z}, right=2.5pt of b.east];
    \node [join={by ->}, on chain] {$\phi$};
\end{tikzpicture}
\end{document}

double trouble

EDIT

In response to the comment asking about the addition of arcs, there are various options. Here are 4 different arcs in various colours for ease of identification. To please egreg, I assume that the thing which I read as the Greek letter phi is, in fact, intended to be an empty set.

\documentclass[border=20pt,tikz]{standalone}
\usetikzlibrary{shapes.multipart,chains, positioning}
\begin{document}
\begin{tikzpicture}
    [
      double link/.style n args=2{% page 726
        on chain,
        rectangle split,
        rectangle split horizontal,
        rectangle split parts=2,
        draw,
        anchor=center,
        text height=1.5ex,
        node contents={#1\nodepart{two}#2},
      },
      start chain=going right,
    ]
    \node [on chain] {$\emptyset$};
    \node (c) [join={by <-}, double link={a}{b}];
    \node [join={by <->}, double link={c}{d}];
    \node (a) [join={by <->}, double link={e}{f}];
    \node (b) [on chain, right=2.5pt of a.east] {$\cdots$};
    \node [join={with c by <->, bend right, draw=blue}, join={with c by <->, bend left, draw=green}, join={with c by <->, out=90, in=90, draw=red}, join={with c by <->, out=-135, in=-45, draw=magenta}, double link={y}{z}, right=2.5pt of b.east];
    \node [join={by ->}, on chain] {$\emptyset$};
\end{tikzpicture}
\end{document}

arcs of various kinds

Related Question