\documentclass{article}
\usepackage{animate}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\usetikzlibrary{lindenmayersystems}
\usepackage[paperheight=20.2cm,paperwidth=16.2cm,bottom=-1cm,top=-1cm,left=-1.8cm,right=0cm]{geometry}
\begin{document}
\begin{tikzpicture}
\foreach \x in {31,91,...,391}{%
\draw (\x:3cm) circle (5pt)[fill=black];
\draw (\x:5cm) circle (5pt)[fill=black];
\draw (\x:3cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+180:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-120:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x+144:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x:3cm);}
\draw(31:3cm)node[right=2pt]{\huge $v_6$};
\draw(91:3cm)node[above=2pt]{\huge $v_1$};
\draw(151:3cm)node[left=2pt]{\huge $v_2$};
\draw(211:3cm)node[left=2pt]{\huge $v_3$};
\draw(271:3cm)node[below=2pt]{\huge $v_4$};
\draw(331:3cm)node[right=2pt]{\huge $v_5$};
\draw(271:5cm)node[below=3.5cm]{\huge $S'(K_6)$};
\draw(31:5cm)node[right=2pt]{\huge $v_6'$};
\draw(91:5cm)node[above=2pt]{\huge $v_1'$};
\draw(151:5cm)node[left=2pt]{\huge $v_2'$};
\draw(211:5cm)node[left=2pt]{\huge $v_3'$};
\draw(271:5cm)node[below=2pt]{\huge $v_4'$};
\draw(331:5cm)node[right=2pt]{\huge $v_5'$};
\end{tikzpicture}
\end{document}
위의 그래프를 그리는데, 내부 레이블이 가장자리와 겹쳐집니다. 누군가가 겹쳐서 그릴 수 있다면, 누군가는 같은 그래프를 다른 방식으로 그릴 수 있다면 나에게도 도움이 될 것입니다.
답변1
첫째, 코드에 오류가 있습니다. 루프 본문을 종료하는 중괄호를 주석 처리했습니다 foreach
.
레이아웃 문제에 관하여: controls
두 점을 사용하십시오.
\draw (A) .. controls (a) and (b) .. (B);
(A)
선은 방향을 향해 출발 하고 방향에서 (a)
접근하게 됩니다 .(B)
(b)
귀하의 응용 프로그램에서 교체를 고려하십시오
\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
~에 의해
\draw (\x:5cm)[line width=1pt]..controls(\x+100:10cm) and (\x+120:11cm)..(\x+180:3cm);
\documentclass{article}
\usepackage{animate}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\usetikzlibrary{lindenmayersystems}
\usepackage[paperheight=20.2cm,paperwidth=16.2cm,bottom=-1cm,top=-1cm,left=-1.8cm,right=0cm]{geometry}
\begin{document}
\begin{tikzpicture}
\foreach \x in {31,91,...,391}{%
\draw (\x:3cm) circle (5pt)[fill=black];
\draw (\x:5cm) circle (5pt)[fill=black];
\draw (\x:3cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+120:3cm);
\draw (\x:3cm) [line width=1pt]-- (\x+180:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+60:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x-120:3cm);
\draw (\x:5cm) [line width=1pt]-- (\x+120:3cm);
%\draw (\x:5cm)[line width=1pt]..controls(\x+120:11cm)..(\x+180:3cm);
\draw (\x:5cm)[line width=1pt]..controls(\x+100:10cm) and (\x+120:11cm)..(\x+180:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x+144:3cm);
%\draw (\x:3cm) [line width=3pt] -- (\x:3cm);
}
\draw(31:3cm)node[right=2pt]{\huge $v_6$};
\draw(91:3cm)node[above=2pt]{\huge $v_1$};
\draw(151:3cm)node[left=2pt]{\huge $v_2$};
\draw(211:3cm)node[left=2pt]{\huge $v_3$};
\draw(271:3cm)node[below=2pt]{\huge $v_4$};
\draw(331:3cm)node[right=2pt]{\huge $v_5$};
\draw(271:5cm)node[below=3.5cm]{\huge $S'(K_6)$};
\draw(31:5cm)node[right=2pt]{\huge $v_6'$};
\draw(91:5cm)node[above=2pt]{\huge $v_1'$};
\draw(151:5cm)node[left=2pt]{\huge $v_2'$};
\draw(211:5cm)node[left=2pt]{\huge $v_3'$};
\draw(271:5cm)node[below=2pt]{\huge $v_4'$};
\draw(331:5cm)node[right=2pt]{\huge $v_5'$};
\end{tikzpicture}
\end{document}