tikz自动机边缘重叠

tikz自动机边缘重叠

我有两个水平放置的状态,需要将它们连接起来,即 A -> B 和 A <- B,我怎样才能以不重叠的方式定位边缘,并且我的图表不会变成 A <-> B,但可以看到人们可以相互导航,并且能够将输入消息放在上方和下方。

 (APPEND_COL) edge[???] node[anchor=east,above,xshift=+3.0em]{delete column} (DELETE_COL)
 (DELETE_COL) edge[???] node[anchor=east,above,xshift=+3.0em]{append column} (APPEND_COL)

我尝试将???设置为上方、下方、向左弯曲=20、向右弯曲=20,但这些都没有产生预期的行为......

更新:好的,这是完整的代码,还有一件事,我怎样才能使左右循环不那么大?

\begin{tikzpicture}[->,>=stealth']

 % State: FULL_QR
 \node[initial above,state,anchor=north] (FULL_QR)
 {\begin{tabular}{l}
  Recompute QR \\
 \end{tabular}};

 % State: Append column update
 \node[state,           % layout (defined above)
  below left of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,  % distance to FULL_QR
  anchor=south] (APPEND_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}     % content
  Append column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Delete column update
 \node[state,            % layout (defined above)
  below right of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,   % distance to FULL_QR
  anchor=south] (DELETE_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}      % content
  Delete column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Append column update
 \node[state,                % layout (defined above)
  below right of=APPEND_COL, % Position is to the bottom of APPEND_COL
  node distance=5.0cm,       % distance to APPEND_COL
  anchor=south] (APPEND_ROW) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}          % content
  Append row \\
  \ \ QR update
 \end{tabular}
 };

 % draw the paths and and print some Text below/above the graph
 \path (FULL_QR) edge[bend right=20] node[anchor=west,above,xshift=-3.0em]{append column} (APPEND_COL)
       (FULL_QR) edge[bend left=20] node[anchor=east,above,xshift=+3.0em]{delete
 column} (DELETE_COL)
       (APPEND_COL) edge[bend right=20]
 node[anchor=west,below,xshift=-3.0em]{append row} (APPEND_ROW)
       (DELETE_COL) edge[bend left=20]
 node[anchor=east,below,xshift=+3.0em]{append row} (APPEND_ROW)
       (APPEND_COL) edge[above]
       node[anchor=west,above,xshift=+0.0em]{delete column} (DELETE_COL)
       (DELETE_COL) edge[below]
       node[anchor=east,below,xshift=+0.0em]{append column} (APPEND_COL)
       (APPEND_COL) edge[loop left] node[anchor=west,above,yshift=+1.5em,xshift=+2.0em]{append column}
       (APPEND_COL) (DELETE_COL) edge[loop right] node[anchor=east,above,yshift=+1.5em,xshift=-2.0em]{delete column}
       (DELETE_COL);

\end{tikzpicture}

在此处输入图片描述

答案1

由于连接线的方向相反,因此您必须bend left=<value>对两条线都使用,而不是bend left只对一条线使用,bend right对另一条线也使用:

    \documentclass{article}

    \usepackage{pgf}
    \usepackage{tikz}
    \usetikzlibrary{arrows,automata}
    \usepackage[latin1]{inputenc}
    \begin{document}
\begin{tikzpicture}[->,>=stealth']

 % State: FULL_QR
 \node[initial above,state,anchor=north] (FULL_QR)
 {\begin{tabular}{l}
  Recompute QR \\
 \end{tabular}};

 % State: Append column update
 \node[state,           % layout (defined above)
  below left of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,  % distance to FULL_QR
  anchor=south] (APPEND_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}     % content
  Append column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Delete column update
 \node[state,            % layout (defined above)
  below right of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,   % distance to FULL_QR
  anchor=south] (DELETE_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}      % content
  Delete column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Append column update
 \node[state,                % layout (defined above)
  below right of=APPEND_COL, % Position is to the bottom of APPEND_COL
  node distance=5.0cm,       % distance to APPEND_COL
  anchor=south] (APPEND_ROW) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}          % content
  Append row \\
  \ \ QR update
 \end{tabular}
 };

 % draw the paths and and print some Text below/above the graph
 \path (FULL_QR) edge[bend right=20] node[anchor=west,above,xshift=-3.0em]{append column} (APPEND_COL)
       (FULL_QR) edge[bend left=20] node[anchor=east,above,xshift=+3.0em]{delete
 column} (DELETE_COL)
       (APPEND_COL) edge[bend right=20]
 node[anchor=west,below,xshift=-3.0em]{append row} (APPEND_ROW)
       (DELETE_COL) edge[bend left=20]
 node[anchor=east,below,xshift=+3.0em]{append row} (APPEND_ROW)
       (APPEND_COL) edge[above, bend left=5]
       node[anchor=west,above,xshift=+0.0em]{delete column} (DELETE_COL)
       (DELETE_COL) edge[below, bend left=5]
       node[anchor=east,below,xshift=+0.0em]{append column} (APPEND_COL)
       (APPEND_COL) edge[loop left] node[anchor=west,above,yshift=+1.5em,xshift=+2.0em]{append column}
       (APPEND_COL) (DELETE_COL) edge[loop right] node[anchor=east,above,yshift=+1.5em,xshift=-2.0em]{delete column}
       (DELETE_COL);

\end{tikzpicture}


    \end{document} 

相关内容