绘制具有多个节点的半圆弧

绘制具有多个节点的半圆弧

我需要绘制下图 在此处输入图片描述

我试过了,但我无法在节点之间画出箭头,而且这似乎不是画出我想要的东西的正确方法,非常感谢任何帮助

\begin{figure} 
 \centering
  \begin{tikzpicture}
  \draw[thick,dashed] (0,0) arc (0:180:2.5cm); 
  \draw[fill=white] (-2,0) rectangle (-3,-0.4);  \node at (-2.5,-0.2){{\tiny STP}};
  \draw[fill=white] (0,0) circle [radius=0.3cm]; \node at (0,0){{\tiny P$_{r}$}};
  \draw[fill=black] (-0.5,1.5) circle [radius=0.3cm]; 
  \draw[fill=white] (-1.5,2.3) circle [radius=0.3cm];  \node at(-1.5,2.3) {{\tiny P$_{i}$}} ;
  \draw[fill=black] (-2.5,2.5) circle [radius=0.3cm]; 
  \draw[fill=black] (-3.5,2.3) circle [radius=0.3cm]; 
  \draw[fill=white] (-4.5,1.5) circle [radius=0.3cm] ;  \node at (-4.5,1.5){{\tiny P$_{2}$}};
  \draw[fill=white] (-5,0) circle [radius=0.3cm]; \node at (-5,0){{\tiny P$_{1}$}} ;
 \end{tikzpicture}
\end{figure}

答案1

在此处输入图片描述

使用tikzarrows.metaautomata并且quotes

\begin{tikzpicture}[
state/.append style = {fill=white, 
                       minimum size=2em, inner sep=0pt,
                       font=\footnotesize},
every edge quotes/.append style = {font=\footnotesize}
                        ]
\node (n0) [state]  {STP};
%
\node (n1) [state,label=left:{$T=[v+t_1]$}]   at (180:2.4)   {$P_1$};
\node (n2) [state,label=left:{$T=[v+t_2]$}]   at (150:2.4)   {$P_2$};
\node (n3) [state,label={$T=[v+t_i]$}]        at ( 90:2.4)   {$P_i$};
\node (n4) [state,label=right:{$T=[v+t_r]$}]  at (  0:2.4)   {$P_r$};
%
\draw[-Straight Barb]
    (n4) edge ["{$[T+V]$}"]   (n0)
    (n0)  to  ["{$[V]$}"]     (n1);

%
\draw[-Straight Barb, densely dashed]
    (n1) edge [out=85, in=245] (n2)
    (n2) edge [out=55, in=185] (n3)
    (n3) edge [out=-5, in= 95] (n4);
\end{tikzpicture}

另一种解决方案是使用更漂亮的半圆和箭头在节点之间的中间位置进行治疗。另外使用 tikzdecorations.markings

在此处输入图片描述

\begin{tikzpicture}[
                  > = {Straight Barb[line width=1pt]},
state/.append style = {fill=white,
                       minimum size=2em, inner sep=0pt,
                       font=\footnotesize},
         decoration = {markings, mark=at position 0.09  with {\arrow{>}},
                                 mark=at position 0.35 with {\arrow{>}},
                                 mark=at position 0.75 with {\arrow{>}}
                        },
every edge quotes/.append style = {font=\footnotesize}
                    ]
\draw[densely dashed, postaction={decorate}] (-2.4,0) arc (180:0:2.4);
\node (n0) [state]  {STP};
%
\node (n1) [state,label=left:{$T=[v+t_1]$}]   at (180:2.4)   {$P_1$};
\node (n2) [state,label=left:{$T=[v+t_2]$}]   at (150:2.4)   {$P_2$};
\node (n3) [state,label={$T=[v+t_i]$}]        at ( 90:2.4)   {$P_i$};
\node (n4) [state,label=right:{$T=[v+t_r]$}]  at (  0:2.4)   {$P_r$};
%
\draw[-Straight Barb]
    (n4) edge ["{$[T+V]$}"]   (n0)
    (n0)  to  ["{$[V]$}"]     (n1);
\end{tikzpicture}

相关内容