如何添加虚线和弧线?

如何添加虚线和弧线?

我希望添加连接两个节点的虚线和一条弧线,如照片中所示。 在此处输入图片描述

这是我的代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{
    shapes.geometric,
    positioning,
    fit,
    calc
}
\usepackage{tikz}
\begin{document}

\tikzset{
 block/.style = {circle, draw,
    text width=1em,align=center,inner sep=0pt},
  line/.style = {draw,thick,->},
}
\begin{tikzpicture}
\node [block] (s1) {1};
\node [block, below = of s1](s2){2};
\path [line] (s1) -- node [right] {b} (s2);
\end{tikzpicture}
\end{document} 

答案1

怎么样

截屏

我已使用该库将路径稍微向左calc移动。a

\documentclass[tikz]{standalone}
\usetikzlibrary{
    positioning,
    calc
}
\usepackage{tikz}
\begin{document}

\tikzset{
 block/.style = {circle, draw,
    text width=1em,align=center,inner sep=0pt},
  line/.style = {draw,thick,->},
}
\begin{tikzpicture}
\node [block] (s1) {1};
\node [block, below = of s1](s2){2};
\path [line] (s1) -- node [right] {b} (s2);
\draw[dashed,->]  (s1.west) to[bend right=30] (s2);
\draw[->]  ($(s1.west)+(-1,0)$) to[bend right=30] node[left,block]{a}($(s2)+(-1,0)$);
\end{tikzpicture}
\end{document} 

相关内容