
答え1
\incomplete
ここにあなたの代わりに作業を行うマクロがあります。構文は次のとおりです。
\incomplete[<radius>]{<num vertices>}{<edge list>}
上記の2つの例は、\incomplete{5}{1/2,1/3,1/4,1/5,2/4,2/5}
およびで作成されています。\incomplete{6}{1/2,2/3,3/4,4/5,5/6,6/1,2/4}
<radius>
はオプションです。デフォルトは です1.5cm
。は、<edgelist>
という形式の各エントリをコンマで区切ったリストですvertex1/vertex2
。<edgelist>
は空にすることもできます (例: ) \incomplete{5}{}
。
コードは次のとおりです:
\documentclass{article}
\usepackage{tikz}
\tikzset{vertex/.style={draw, circle, inner sep=1mm}}
\newcommand{\incomplete}[3][1.5cm]{\begin{tikzpicture}
\foreach \n in {1,...,#2}{\node[vertex]at({90-360/#2*(\n-1)}:#1)(\n){\n};}
\foreach \v/\w in {#3}{\draw(\v)--(\w);}
\end{tikzpicture}}
\begin{document}
\incomplete{5}{1/2,1/3,1/4,1/5,2/4,2/5}\hspace{2cm}\incomplete{6}{1/2,2/3,3/4,4/5,5/6,6/1,2/4}
\end{document}
答え2
グラフが単純グラフマクロのエッジを変更したり、特別な-!-
エッジ仕様を使用してエッジを削除したりすることもできます。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs.standard}
\begin{document}
\begin{tikzpicture}
\graph[nodes={circle,draw},simple] {
subgraph K_n [n=5,clockwise];
2 -!- 3 -!- 4 -!- 5 -!- 3;
};
\end{tikzpicture}
\end{document}