我目前有以下代码:
\begin{figure}[H]
\centering
\begin{tikzpicture}
\graph[nodes={circle, draw}] { subgraph K_n [n=4,clockwise, radius=1.5cm]};
\end{tikzpicture}
\caption{\textit{Not} a planar map}
\end{figure}
生成以下图表:
我现在想删除连接顶点 (1) 和 (3) 的边,并用弯曲图形的东西替换它。这是我的尝试:
\begin{figure}[H]
\centering
\begin{tikzpicture}
\graph[nodes={circle, draw}] { subgraph K_n [n=4,clockwise, radius=1.5cm], 1 -- [bend left] 3 };
\end{tikzpicture}
\caption{Planar representation of above graph}
\end{figure}
现在,当然,这不会移除之前的边,所以我有一条额外的边。此外,我不确定如何改变边弯曲的量,使其不再与任何其他边相交。任何帮助都将不胜感激!谢谢。
答案1
通过指定图表简单的,可以修改图形宏的边缘:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs.standard}
\begin{document}
\begin{tikzpicture}
\graph[nodes={circle,draw},simple] {
subgraph K_n [n=4,clockwise,radius=1.5cm];
1 --[bend left] 3;
};
\end{tikzpicture}
\end{document}
甚至删除它们(如问题标题所要求的),使用特殊的-!-
边缘规范:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs.standard}
\begin{document}
\begin{tikzpicture}
\graph[nodes={circle,draw},simple] {
subgraph K_n [n=4,clockwise,radius=1.5cm];
1 -!- 3;
};
\end{tikzpicture}
\end{document}
答案2
这个怎么样?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node[circle, draw] (a) at (0:1) {$2$};
\node[circle, draw] (b) at (90:1) {$1$} edge (a);
\node[circle, draw] (c) at (180:1) {$4$} edge (a) edge (b);
\node[circle, draw] (d) at (270:1) {$3$} edge (a) edge (b) edge (c);
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}
\node[circle, draw] (a) at (0:1) {$2$};
\node[circle, draw] (b) at (90:1) {$1$} edge (a);
\node[circle, draw] (c) at (180:1) {$4$} edge (a) edge (b);
\node[circle, draw] (d) at (270:1) {$3$} edge (a) edge (c);
\node[radius=0pt, outer sep=-0.5pt, inner sep=0pt] (e) at (0:1.9) {}
edge [bend right=55] (b) edge [bend left=55] (d);
\end{tikzpicture}
\end{center}
\end{document}