1

I wish to draw a graph using Tikz whose shape I could best describe as resembling a barbell from cartoons. A minimal working example is as follows:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{center}
\begin{tikzpicture}[-,thick,scale=1]

\node (0) at (0,0) {0};
\node (1) at (-1,1) {1};
\node (2) at (-1,2) {2};
\node (3) at (0,3) {3};
\node (4) at (1,3) {4};
\node (5) at (2,2) {5};
\node (6) at (2,1) {6};
\node (7) at (1,0) {7};

\node (8) at (5,0) {8};
\node (9) at (4,1) {9};
\node (10) at (4,2) {10};
\node (11) at (5,3) {11};
\node (12) at (6,3) {12};
\node (13) at (7,2) {13};
\node (14) at (7,1) {14};
\node (15) at (6,0) {15};

\draw (0) to (1) to (2) to (3) to (4) to (5) to (6) to (7) to (0);
\draw (8) to (9) to (10) to (11) to (12) to (13) to (14) to (15) to (8);
\draw (5) to (10);
\draw (6) to (9);

\end{tikzpicture}
\end{center}

\end{document}

However, I wish for the circles of nodes at the ends to resemble those achieved as follows:

\begin{center}
\begin{tikzpicture}[-,thick,scale=1]

\node (0) at (5*360/8 + 360/16: 1.6cm) {0};
\node (1) at (4*360/8 + 360/16: 1.6cm) {1};
\node (2) at (3*360/8 + 360/16: 1.6cm) {2};
\node (3) at (2*360/8 + 360/16: 1.6cm) {3};
\node (4) at (1*360/8 + 360/16: 1.6cm) {4};
\node (5) at (0*360/8 + 360/16: 1.6cm) {5};
\node (6) at (-1*360/8 + 360/16: 1.6cm) {6};
\node (7) at (-2*360/8 + 360/16: 1.6cm) {7};

\draw (0) to (1) to (2) to (3) to (4) to (5) to (6) to (7) to (0);

\end{tikzpicture}
\end{center}

However, I don't know how to specify the centre of the circle of nodes that is drawn using the above method and/or how to draw two circles of nodes next to each other using this method.

2

See, if this is what you looking for:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{center}
\begin{tikzpicture}[-,thick,scale=1]
\node (10) at (5*360/8 + 360/16: 1.6cm) {0};
\node (11) at (4*360/8 + 360/16: 1.6cm) {1};
\node (12) at (3*360/8 + 360/16: 1.6cm) {2};
\node (13) at (2*360/8 + 360/16: 1.6cm) {3};
\node (14) at (1*360/8 + 360/16: 1.6cm) {4};
\node (15) at (0*360/8 + 360/16: 1.6cm) {5};
\node (16) at (-1*360/8 + 360/16: 1.6cm) {6};
\node (17) at (-2*360/8 + 360/16: 1.6cm) {7};

\draw (10) to (11) to (12) to (13) to (14) to (15) to (16) to (17) to (10);

    \begin{scope}[xshift=50mm]
\node (20) at (5*360/8 + 360/16: 1.6cm) {0};
\node (21) at (4*360/8 + 360/16: 1.6cm) {1};
\node (22) at (3*360/8 + 360/16: 1.6cm) {2};
\node (23) at (2*360/8 + 360/16: 1.6cm) {3};
\node (24) at (1*360/8 + 360/16: 1.6cm) {4};
\node (25) at (0*360/8 + 360/16: 1.6cm) {5};
\node (26) at (-1*360/8 + 360/16: 1.6cm) {6};
\node (27) at (-2*360/8 + 360/16: 1.6cm) {7};

\draw (20) to (21) to (22) to (23) to (24) to (25) to (26) to (27) to (20);
    \end{scope}

\draw (15) to (22)  (16) to (21); 
\end{tikzpicture}
\end{center} 
\end{document}

example output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.