我有以下代码,可以给出附图。
\documentclass[border=4mm]{standalone}
\usepackage{tkz-berge}
\begin{document}
\begin{tikzpicture}
[->, >=stealth', auto, thick,
main node/.style=
{circle, fill=black!30, draw, minimum size=.3cm, inner sep=0pt]},
scale=2
]
\newcommand\vx{0.5}
\newcommand\vy{.5}
\newcommand\fx{1} % 4.x
\node[main node] (*) at (-\vx, 0 ) {$*$};
\node[main node] (n) at ( \vx, \vy) {$n$};
\node[main node] (m) at (\vx, -\vy) {$m$};
\node (x_1) at (-2*\vx,-\vy) {$x_1 $};
\node (x_mid) at (-2*\vx,0) {$... $};
\node (x_i) at (-2*\vx,\vy) {$x_i$};
\node (y_1) at (4*\vx,\vy) {$y_1$};
\node (y_mid) at (4*\vx,0) {$...$};
\node (y_j) at (4*\vx,-\vy) {$y_j$};
\path[-]
(*)
edge node {} (m)
edge node {} (n)
;
\begin{scope}[every path/.style={->}]
\draw (*) --(x_1);
\draw (*) -- (x_mid);
\draw (*) -- (x_i);
\draw (*) -- (y_1);
\draw (*) -- (y_mid);
\draw (*) -- (y_j);
\end{scope}
\end{tikzpicture}
\end{document}
得出:
但是我想用第二张图片中类似的东西替换右边的箭头。我需要箭头沿着类似的路径然后分开。有人能给我一些建议吗?如果我也可以像图中那样添加一个圆圈就太好了。
答案1
在有用的位置添加一个新节点,例如2*\vx,0
,并通过该节点绘制线条:
\documentclass[border=4mm]{standalone}
\usepackage{tkz-berge}
\begin{document}
\begin{tikzpicture}
[->, >=stealth', auto, thick,
main node/.style=
{circle, fill=black!30, draw, minimum size=.3cm, inner sep=0pt]},
scale=2
]
\newcommand\vx{0.5}
\newcommand\vy{.5}
\newcommand\fx{1} % 4.x
\node[main node] (*) at (-\vx, 0 ) {$*$};
\node[main node] (n) at ( \vx, \vy) {$n$};
\node[main node] (m) at (\vx, -\vy) {$m$};
\node (x_1) at (-2*\vx,-\vy) {$x_1 $};
\node (x_mid) at (-2*\vx,0) {$... $};
\node (x_i) at (-2*\vx,\vy) {$x_i$};
\node (y_1) at (4*\vx,\vy) {$y_1$};
\node (y_mid) at (4*\vx,0) {$...$};
\node (y_j) at (4*\vx,-\vy) {$y_j$};
\node [draw,circle,minimum size=6mm] (kink) at (2*\vx,0) {}; %%% <-- added
\path[-]
(*)
edge node {} (m)
edge node {} (n)
;
\begin{scope}[every path/.style={->}]
\draw (*) --(x_1);
\draw (*) -- (x_mid);
\draw (*) -- (x_i);
\draw (*) -- ([yshift=1mm]kink.center) -- (y_1); %% added middle coordinate
\draw (*) -- (y_mid);
\draw (*) -- ([yshift=-1mm]kink.center) -- (y_j); %% added middle coordinate
\end{scope}
\end{tikzpicture}
\end{document}