I am learning to draw graphs for my thesis and came up with the following ugly result:
\documentclass[tikz]{standalone}
\usetikzlibrary{cd,graphs,graphs.standard}
\begin{document}
\begin{tikzpicture}
\graph [simple, nodes={empty nodes, fill, circle, inner sep=1pt, draw}] {
subgraph I_n [n=4, grid placement, radius=2cm];
3[label=left:$v_3$]--["$K_1$"]1[label=left:$v_1$]--["$K_2$"]4[label=right:$v_4$]--["$K_4$"']2[label=right:$v_2$];
};
\end{tikzpicture}
\end{document}
The label "K_2
" is positioned inappropriately, but I guess it will be better if the graph is scaled such that the edges are longer. Neither scale=2
, nor radius=2cm
(see How to scale a tikz graph) works. The latter option does work if I replace grid placement
by clockwise
, but I prefer the positioning of the nodes as presented in the image.
How can I solve this?
Note: Maybe the graphs
library is a bit of overkill for this case, but I am trying to find some kind of generic way for drawing graphs, since I will have to draw complex examples later on.