4

I have this:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{graphs, graphs.standard}

\begin{document}

\tikz
\graph [simple, nodes={draw, circle, minimum size = .5cm}, clockwise] {
  subgraph C_n [name=inner, radius = 1.5cm, n=3];
  subgraph C_n [name=outer, radius = 3cm, n=4];
};

\end{document}

enter image description here

And now I want to draw single edges from nodes of inner to nodes of outer. How do I do that?

8

Use the names inner and outer as prefix for the node numbers:

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs, graphs.standard}

\begin{document}

\begin{tikzpicture}
\graph [simple, nodes={draw, circle, minimum size = .5cm}, clockwise] 
{
  subgraph C_n [name=inner, radius = 1.5cm, n=3];
  subgraph C_n [name=outer, radius = 3cm, n=4];
};
\draw
 (inner 1) -- (outer 2)
 (inner 3) -- (outer 4)
 (inner 2) -- (outer 4)
 (inner 3) -- (outer 1)
 (inner 2) -- (outer 3);
\end{tikzpicture}

\end{document}

The result:

enter image description here

Of course, you can also use the edge path:

\path
 (inner 1) edge (outer 2)
 (inner 3) edge (outer 4)
 (inner 2) edge (outer 4)
 (inner 3) edge (outer 1)
 (inner 2) edge (outer 3);

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.