Draw Book Embeddings with tikz

tikz-pgf

I found this picture of a Book Embedding of $K_5$ and I wonder if it is possible in an easy way to perform such a picture with tikz.

I can subdivide the problem in some smaller problems, but I wasn't able to find helpful suggestions for this problems, but I'm sure, that's my fault.

I would say, the best approach for the problem seems to draw any book site at its own (all in the same, the x-z-Plane) and then rotate the first of n pages $1/n2Pi$ around the z-axis, the second $2/n2Pi$…and so on.

I'm not able to rotate only one shape, I rotate the whole coordinate system. Maybe there is the possibility to integrate more coordinate systems in one picture, but the better way would be to rotate only parts of the graph.

Book embedding with three sites of the complete graph with five vertices

The picture above is taken from https://en.wikipedia.org/wiki/Book_embedding.

I am grateful for any further idea.

Best regards,
Clemens

Best Answer

Welcome to TeX.SE!!

Here is a solution. Basically, I use the TikZ 3d library to define a vertical rotated canvas inside a scope. Then, in the scope I draw the rectangles and the arcs. Of course I need to do this three times, one for each plane. The last thing to draw are the nodes (balls), this way they don't interfere with the visibility.

Something like this:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}

\tikzset
{
  my rectangle/.style={dotted,fill=white,fill opacity=0.5},
  my node/.style={circle,draw,shading=ball,ball color=yellow}
}

\begin{document}
\begin{tikzpicture}[isometric view,line cap=round,line join=round]
% coordinates
\foreach[count=\j]\i in {1,3,5,7,9}
  \coordinate (\j) at (0,0,\i);
% blue plane
\begin{scope}[rotate around z=10,canvas is xz plane at y=0,blue]
  \draw[my rectangle] (0,0) -| (5,10) -- (0,10);
  \foreach\i in {2,3}
    \draw[thick] (\i) arc (-90:90:5-\i);
\end{scope}
% green plane
\begin{scope}[rotate around z=135,canvas is xz plane at y=0,,green!50!black]
  \draw[my rectangle] (0,0) -| (5,10) -- (0,10);
  \foreach\i in {1,2,3,4}
    \pgfmathsetmacro\j{\i+1}
    \draw[thick] (\i) arc (-90:90:1);
  \draw[thick] (1) arc (-90:90:4);
  \draw[thick] (2) arc (-90:90:2);
\end{scope}
% red plane
\begin{scope}[rotate around z=255,canvas is xz plane at y=0,red]
  \draw[my rectangle] (0,0) -| (5,10) -- (0,10);
  \foreach\i in {2,3}
    \draw[thick] (1) arc (-90:90:\i);
\end{scope}
% nodes / balls
\draw[dotted,thick] (0,0,-1) -- (0,0,11);
\foreach\i in {1,...,5}
  \node[my node] at (\i) {};
\end{tikzpicture}
\end{document}

enter image description here

Related Question