我有兩個水平放置的狀態,需要連接它們,即 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}