无箭头的循环

无箭头的循环

我怎样才能创建没有箭头的循环?(Vertex 7)谢谢。:)

\documentclass[tikz]{standalone}
\begin{tikzpicture}[shorten >=1pt,->,baseline=(12.base)]
\tikzset{vertex/.style={circle,fill=blue!25,minimum size=12pt,inner sep=2pt}}
\node[vertex] (7) at (0,0)  [shape=circle,draw=black] {1};
\node[vertex] (8) at (2,0) [shape=circle,draw=black] {2};
\node[vertex] (9) at (1,-1) [shape=circle,draw=black] {3};
\draw (7) edge[-] (8);
\draw (7) edge[-] (9);
\draw (8) edge[-] (9);
%\nccircle{->}{7,7}{.5cm};
%\EdgeInGraphLoop{8}{8};
%\draw (8) loap[-] (8);
\path (7) edge [loop above] node {} (7);
\path (7) edge [loop] node {} (7);
%\path[-] (8) edge[loop] node[above] {} (8);
\path[-] (8) edge[bend left] (9);
\end{tikzpicture}
\end{document}

答案1

您可以从前导中的每个循环中删除箭头,如代码所示。您的代码中还有一些其他小的更改,这些更改对您来说可能不是必要的。但这是我目前正在使用的解决方案。如果您只想为某些循环添加箭头,则在边缘定义中添加箭头,如图所示。

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}%[shorten >=1pt]
  \tikzset{vertex/.style={circle,fill=blue!25,minimum size=12pt,inner sep=2pt}}
  \tikzset{every loop/.style={}}%removes arrow head from all loops.
  \node[vertex] (7) at (0,0)  [shape=circle,draw=black] {1};
  \node[vertex] (8) at (2,0) [shape=circle,draw=black] {2};
  \node[vertex] (9) at (1,-1) [shape=circle,draw=black] {3};

  \draw [->]  (7) -- (8);
  \draw [->]  (7) -- (9);
  \draw [->]  (8) -- (9);

  \path  (7) edge [->,loop above] node {} (7);%add an arrow to the loop edge
  \path   (7) edge [loop] node {} (7);%there will be no arrow head on this loop.
  \path  (8) edge[->,bend left] (9);%add an arrow to the loop edge
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容