9

I am trying to draw a diagram with tikz that has multiple arrows (here I have 4) between nodes, where the nodes are placed arbitrarily in a diagram. My best (that is, shortest and easiest to understand) solution has been to use the draw option double, but this creates unwanted overlap of the arrows, as in I cannot see the arrows below other arrows, and I would like to see all of them.

My current situation has the below code:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{state/.style={circle,draw=black, very thick,minimum size=8ex,fill=white}}

\begin{document}

\begin{tikzpicture}

\node (x) at (0,0) {};
\coordinate (1) at ($(x) + (125:2)$) ;
\coordinate (2) at ($(x) + (55:2)$) ;
\coordinate (3) at ($(x) + (350:2)$);
\coordinate (t1) at ($(x) + (190:2)$);
\foreach \i\j in {1/2,2/3,1/t1,2/t1,1/3,3/t1} {
    \draw[draw=black,double distance=15pt] (\i) to (\j);
    \draw[draw=black,double distance=5pt] (\i) to (\j);}
\node[state] (1a) at (1) {1};
\node[state] (2a) at (2) {2};
\node[state] (3a) at (3) {3};
\node[state] (t1a) at (t1) {3};
\draw[loosely dotted,ultra thick] ($(x)+(290:1.8)$) to [bend left=30] ($(x)+(250:1.8)$);

\end{tikzpicture}

\end{document}

Yielding the following result:

enter image description here

I want to see all the arrow lines, not just the ones drawn last.

This situation happens because with the double option two lines are actually drawn, one thinner than the other, the inside one being colored white. Looking at some similar questions here, the solutions were either case-specific or used nodename.west or similar directions along with a \foreach loop and some \yshift commands. However, since my arrows do not all go either horizontally or vertically, and I would like the normal distance between two adjacent arrows to be the same throughout, and since I am not a tikz whiz, I could not adjust those solutions to my needs.

Any help on this issue is much appreciated.

2
  • You sure you want the lines being parallel? I could see it looking real nice originating at one point but ending up at different points using the to syntax. Oct 27, 2012 at 5:59
  • @PeterGrill Each node in the diagram is supposed to represent a group of vertices of a graph, and the edges are all possible edges between two groups of vertices. So I guess parallel isn't necessary (though I like how it looks), but I don't want all arrows coming out of/going into a single coordinate. However, I think that if they all start at the center of one of the nodes, it might work at creating the desired impression. Oct 27, 2012 at 10:53

1 Answer 1

6

Furnishing further with Jake's PSTricks' ncbar equivalent style (from Is there a TikZ equivalent to the PSTricks \ncbar command? ), it's possible to draw 2n lines instead of n double lines.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\tikzset{
    ncbar angle/.initial=90,
    ncbar/.style={
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!
        \pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!
        \pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    ncbar/.default=0.5cm,
}
\begin{document}
\begin{tikzpicture}[
    mystate/.style={circle,draw=black, very thick,minimum size=8ex,fill=white}
    ]
\def\mylabellist{{1,2,3,"$t-1$"}}
\foreach \x[count=\y] in{125,55,350,190}{\coordinate (n\y) at (\x:2);}

\foreach \x in {1,...,3}{
    \foreach \y in {\x,...,4}{
        \foreach \zz in {90,-90}{
            \draw (n\x) to[ncbar=0.1cm,ncbar angle=\zz] (n\y);
            \draw (n\x) to[ncbar=0.3cm,ncbar angle=\zz] (n\y);
        }
    }
}
\foreach \y in{1,...,4}{\node[mystate] (n\y a) at (n\y)
{\pgfmathparse{\mylabellist[\number\numexpr\y-1\relax]}\pgfmathresult};}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .