I try to rebuild a graph within tikz. This Graph has some edges which have an arrow underneath of them. Important for me is the bend which should be the same as the red edges. Not like in the reference picture where the arrows are not perfectly fit into the edge flow.

image description here

Thats how my current graph looks like:

image description here

The problem I have is that I am not able to create those curved edges with an arrow tip. So that they are this short as you can the in the reference picture and bending correctly.

Thats my code on some tests:



    \begin{tikzpicture}[nodes={draw,circle},decoration={markings, mark=at position 0.5 with {\arrow[scale=1.5,>=stealth,color=black]{>}}}]
        \node (A) at (0,0) {A};
        \node[right=5cm of A] (B) {B};

        \draw[postaction={decorate}, color=white] (A) to[out=-45, in=-135] (B);
        \path[shorten >=40pt,shorten <=40pt,->] (A) edge[bend left] (B);
        \path[dashed] (A) edge[bend left] (B);

enter image description here

As you can see I can get it somehow smaller than the actual edge. But using higher values for shorten only makes the edge looks very weird and offsets its position even more. Using the method with a white edge will fit perfectly my arrow on the edge but it does not have a little tail.

I do have already skimmed through the 3.xx manual of pgf and tikz but could not really find anything that fit my needs.

1 Answer 1

  record points/.style={postaction=decorate,decoration={markings,
  mark={at position 0.4 with {\coordinate(#1-1);}},
  mark={at position 0.5 with {\coordinate(#1-2);}},
  mark={at position 0.6 with {\coordinate(#1-3);}},
  mark={at position 0.7 with {\coordinate(#1-4);}}}}]

  \path (0,0) node (s) {s} (-5,2) node (53) {53} (-5,0) node (52) {52}
  (-5,-2) node (51) {51};
  \begin{scope}[on background layer]
  \draw[line width=6pt,red!10,record points=T]
  ([yshift=6pt]s.center) to[out=170,in=-45] 
  \draw[line width=6pt,red!10,record points=M]
  ([yshift=0pt]s.center) to (52.center);
  \draw[line width=6pt,red!10,record points=B]
  ([yshift=-6pt]s.center) to[out=190,in=45] (51.center);
  \foreach \X in {T,M,B}
  {\draw[-latex] plot[smooth,variable=\x,samples at={1,...,4}](\X-\x);}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.