(A cube with labeled vertices) How to draw a cube with a letter written on each of the vertices, and the invisibible edges are marked as dotted lines

3ddiagramsgraphicstikz-3dtikz-pgf

Please edit for suitable tags, if you know some related tag.

See the 3rd page of this paper by Bhargava.
There is a cube drawn there, which you can see in the image below (everything is black and white there, of course):

enter image description here

enter image description here

Notice that in this cube, a letter is written on each of the vertices.

I want to draw a cube where the invisible edges are marked with dotted lines (=dashed dots), and at the point of intersection with the visible edges, these edges are completely invisible from a small distance before and after (and not as a dotted line), like the 2nd and 4th images. And I need to emphasize that I cannot draw any of the pictures in this question:

enter image description here

enter image description here

enter image description here

And besides the dotted lines, is it possible to put a sphere in the vertices? Like the picture below:

enter image description here

enter image description here

I've seen suggestions in this question (What is the easiest way to draw a 3D cube with TikZ?), and also this question (How may I put labels on the corners/vertices of a cube?), and also this question (How can I draw a graph that looks like this hand drawn picture?), but they are not what I am looking for.



Using the codes presented in the answer by Qrrbrbirlbel, I tried to create the 2nd and the 5th cube, but it seems that I don't know how to use the crossing over command. Also, I don't know how to remove the circles.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{3d cd/.style={/tikz/every odd row/.append style={xshift={#1}}}}
\begin{document}
\begin{tikzcd}[
  3d cd=2em, arrows=dash, row sep=.6em, column sep=1.5em,
  dedo/.style={dash pattern=on \pgflinewidth off 2\pgflinewidth},% custom dashes
  cells={nodes={
      circle, draw, inner sep=+.2em, % make all nodes the same size:
      align=center, text width=width("$f$"), text depth=+0pt, text height=+.7em,
      t/.style={text={####1}}}}]
   |[t=yellow]| c_1 \ar[r]        \ar[d]
 & |[t=green]|  d_1 \ar[dd]       \ar[d]                          \\
   |[t=green]|  a_1 \ar[dd]       \ar[r, crossing over]
 & |[t=purple]| b_1 \ar[dd, crossing over]                                       \\
   |[t=red]|    c_2 \ar[d, dedo] \ar[r, dedo] \ar[uu, dedo]
 & |[t=yellow]| d_2 \ar[d]                                              \\
   |[t=yellow]| a_2 \ar[r]
 & |[t=green]|  b_2
\end{tikzcd}
\end{document}

Output

enter image description here

Best Answer

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzcdset{3d cd/.style={/tikz/every odd row/.append style={xshift={#1}}}}
\begin{document}
\begin{tikzcd}[
  3d cd=2em, arrows=dash, row sep=.6em, column sep=1.5em,
  dedo/.style={dash pattern=on \pgflinewidth off 2\pgflinewidth},% custom dashes
  cells={nodes={
      circle, draw, inner sep=+.2em, % make all nodes the same size:
      align=center, text width=width("$f$"), text depth=+0pt, text height=+.7em,
      t/.style={text={####1}}}}]
   |[t=yellow]| e \ar[r]        \ar[d]
 & |[t=green]|  b \ar[dd]       \ar[d, dedo]                          \\
   |[t=green]|  e \ar[dd]       \ar[r, dedo]
 & |[t=purple]| f \ar[dd, dedo]                                       \\
   |[t=red]|    c \ar[d] \ar[r, crossing over] \ar[uu, crossing over]
 & |[t=yellow]| d \ar[d]                                              \\
   |[t=yellow]| g \ar[r]
 & |[t=green]|  h
\end{tikzcd}
\end{document}

Output

enter image description here