1

enter image description here

This is what I was able to do based on the knowledge I have.I need edges between the nodes 3 and 3', 4 and 4'. etc. Also I need dashed edges between each and every node in the first hexagon. The problem is I dont need the circles on the edges(like between 1' and 2').I'm unable to delete the circle. I got a code on internet and made some changes of my own, the code is messy. Thanks for the help!!

Code:

\documentclass{minimal}

\usepackage{tikz}
\newcommand{\LD}{\langle}

\newcommand{\RD}{\rangle}

\begin{document}

\begin{center}

\begin{tikzpicture}

\tikzstyle{every node}=[draw,circle,fill=white,minimum size=4pt,
                        inner sep=0pt]

% First, draw the inner hexagon with a ``pin'' -- namely, (3214)
\draw (0,0) node (1) [label=1] {}
-- ++(330:2.0cm) node (2) [label=2] {}
-- ++(270:2.0cm) node (3)
[label=right:3] {}
-- ++(210:2.0cm) node (4)
[label=4] {}
-- ++(150:2.0cm) node (5)
[label=left:5] {}
 -- ++(90:2.0cm) node (6)
[label=6] {}
 -- ++(30:2.0cm) node (1)
 {}
;
\draw   node (1) [label=1] {}
-- ++(0:6.0cm) [dashed] node (1') [label=1']
{}
-- ++(330:2.0cm)[-] node (2') [label=2'] {}
-- ++(270:2.0cm) node (3')
[label=right:3'] {}
-- ++(210:2.0cm) node (4')
[label=4'] {}
-- ++(150:2.0cm) node (5')
[label=left:5'] {}
 -- ++(90:2.0cm) node (6')
[label=6'] {}
 -- ++(30:2.0cm) node (1')
     {};

\path [-](1') edge node[left] {} (2');
\path [-](2') edge node[left] {} (3');
\path [-](3') edge node[left] {} (4');
\path [-](4') edge node[left] {} (5');
\path [-](5') edge node[left] {} (6');
\path [-](6') edge node[left] {} (1');

\path [dashed](1) edge [bend left=20]node[left] {} (1');
\path [dashed](2) edge [bend left=20]node[left] {} (2');


\end{tikzpicture}
\end{center}

\end{document}
Torbjørn T.
  • 206,688
Kas1
  • 113

2 Answers2

3

Does this meet your needs? There are a load of node[left] {} defined on paths which are responsible for the circles midway along the line, then to draw lines between each vertex of the first hexagon I've used a \foreach loop at the end.

The circles on the second hexagon are dashed in your original image because of the [dashed] part in \draw node (1) [label=1] {} -- ++(0:6.0cm) [dashed] node (1') [label=1'] {}... this sets all the nodes drawn to be dashed, removing this gives full circles.

As for more formatting, the line \path [blah] (A) edge (B); draws an edge between coordinates A and B, and applies formatting blah - is shorthand for a straight line, dashed is a dashed line, to colour it we can do the likes of [dashed, green] for a green dashed line. I've coloured a couple of edges in the code as examples, making one of the dashed lines red and making one of the full edges both green and changing its thickness.

enter image description here

Compiled with the following code

\documentclass{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\tikzstyle{every node}=[draw,circle,fill=white,minimum size=4pt,
                        inner sep=0pt]

% First, draw the inner hexagon with a ``pin'' -- namely, (3214)
\draw (0,0) node (1) [label=1] {}
-- ++(330:2.0cm) node (2) [label=2] {}
-- ++(270:2.0cm) node (3)
[label=right:3] {}
-- ++(210:2.0cm) node (4)
[label=4] {}
-- ++(150:2.0cm) node (5)
[label=left:5] {}
 -- ++(90:2.0cm) node (6)
[label=6] {}
 -- ++(30:2.0cm) node (1)
 {}
;
\draw   node (1) [label=1] {}
-- ++(0:6.0cm) node (1') [label=1']
{}
-- ++(330:2.0cm)[-] node (2') [label=2'] {}
-- ++(270:2.0cm) node (3')
[label=right:3'] {}
-- ++(210:2.0cm) node (4')
[label=4'] {}
-- ++(150:2.0cm) node (5')
[label=left:5'] {}
 -- ++(90:2.0cm) node (6')
[label=6'] {}
 -- ++(30:2.0cm) node (1')
     {};

\path [-](1') edge (2');
\path [-](2') edge (3');
\path [-,green,ultra thick](3') edge (4');
\path [-](4') edge (5');
\path [-](5') edge (6');
\path [-](6') edge (1');

\path [dashed](1) edge [bend left=20] (1');
\path [dashed](2) edge [bend left=20] (2');
\path [dashed,red](3) edge [bend left=-20] (3');
\path [dashed](4) edge [bend left=-20] (4');
\path [dashed](5) edge [bend left=-20] (5');
\path [dashed](6) edge [bend left=20] (6');


\foreach \i in {1,...,6}{
\foreach \j in {1,...,6}{
\path [dashed] (\i) edge (\j);
}}

\end{tikzpicture}

\end{document}

Finally I should note briefly the overlap between the lines draws dashed lines between all the dotted lines, this duplicates things and makes it slightly heavier, the following instead plots only the necessary lines such that each pair of vertices are connected.

\foreach \i in {1,...,4}{
\pgfmathsetmacro{\unmappedvertices}{\i+2}
\foreach \j in {\unmappedvertices,...,6}{
\path [dashed] (\i) edge (\j);
}}
Dai Bowen
  • 6,117
  • Thanks, also could you tell me what I can do, if I want to change the color of edge. For example to change the color of the node between the vertex 1 and 1'. Also what should I do if I want to scale the picture. Like decrease the size of the picture – Kas1 Aug 27 '16 at 20:42
  • The circles in the 2nd Hexagon looks dotted. Could you please tell me how to change that? – Kas1 Aug 27 '16 at 20:47
  • See my edits for examples of formatting and why the circles look dotted/how to correct that. As for modifying the size of tikzpictures, this question should cover everything you need to know http://tex.stackexchange.com/questions/4338/correctly-scaling-a-tikzpicture – Dai Bowen Aug 27 '16 at 21:07
  • @Krishna is this sufficiently clear for you/everything from the original question covered? If nothing is outstanding, please do consider accepting one of the answers to this question. – Dai Bowen Sep 09 '16 at 22:47
3

another way in which you can choose the number of top by changing the value of \nb

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}

\def\nb{6} %number of corner
\begin{tikzpicture}
\node[regular polygon,regular polygon sides=\nb,minimum size=3cm,draw, black] (A) at (0,0){};
\node[regular polygon,regular polygon sides=\nb,minimum size=3cm,draw, black] (B) at (6,0){};

\foreach \pos in {1, 2, ...,\nb}{
\draw[green, thick,dashed] (A.corner \pos)node[above,black]{\pos} to [bend left=20] (B.corner \pos)node[above,black]{\pos '};
}

\end{tikzpicture}

\end{document}

enter image description here

rpapa
  • 12,350
  • The hexagons are different than the ones in the OP. Also, the numbering should proceed in a clockwise fashion. – Alenanno Aug 27 '16 at 23:33