3

I want to display two separate arrows in this graph between nodes 1&4 and nodes 1&3. I read somewhere about bending the arrows, but I'd really like them to remain straight. Also saw there was an option to make them leave nodes at different angles but can't work out the code for this. Could someone help me please!

This is the code I have

\begin{tikzpicture}
\tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
\tikzset{edge/.style = {->,> = latex'}}
% vertices
\node[vertex] (1) at  (0,0) {$1$};
\node[vertex] (2) at  (2,0) {$2$};
\node[vertex] (3) at  (0,-2) {$3$};
\node[vertex] (4) at  (2,-2) {$4$};
%edges
\draw[edge] (1) to (2);
\draw[edge] (1) to (3);
\draw[edge] (1) to (4);
\draw[edge] (2) to (3);
\draw[edge] (2) to (4);
\draw[edge] (3) to (1);
\draw[edge] (4) to (3);
\draw[edge] (4) to (1);
\end{tikzpicture}

Graph

I'd like it to look similar to this, with two arrows rather than onegraph 2

  • Hi ! Could you show a picture of what you want, please ? – flav Apr 18 '16 at 14:31
  • I've added an image to demonstrate. (Please note the nodes are not it the same places) – Alice Roberts Apr 18 '16 at 14:40
2

You can access the point on the edge of a node that is at a specific angle using nodename.angle. See an example below where I've used this.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
\tikzset{edge/.style = {->,> = latex'}}
% vertices
\node[vertex] (1) at  (0,0) {$1$};
\node[vertex] (2) at  (2,0) {$2$};
\node[vertex] (3) at  (0,-2) {$3$};
\node[vertex] (4) at  (2,-2) {$4$};
%edges
\draw[edge] (1) to (2);
\draw[edge] (1.260) to (3.100);
\draw[edge] (1.325) to (4.125);
\draw[edge] (2) to (3);
\draw[edge] (2) to (4);
\draw[edge] (3.80) to (1.280);
\draw[edge] (4) to (3);
\draw[edge] (4.145) to (1.305);
\end{tikzpicture}
\end{document}

enter image description here

0

You can use the anchor refer to the doc section 67 shape

\documentclass[border=1pt, tikz]{standalone}

\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
  \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
  \tikzset{edge/.style = {->,> = latex}}
  % vertices
  \node[vertex] (1) at  (0,0) {$1$};
  \node[vertex] (2) at  (2,0) {$2$};
  \node[vertex] (3) at  (0,-2) {$3$};
  \node[vertex] (4) at  (2,-2) {$4$};
  % edges
  \draw[edge] (1.10) to (2.170);
  \draw[edge] (2.190) to (1.350);

  \draw[edge] (1) to (3);
  \draw[edge] (1.300) to (4.150);
  \draw[edge] (2) to (3);
  \draw[edge] (2) to (4);
  \draw[edge] (3) to (1);
  \draw[edge] (4) to (3);
  \draw[edge] (4.120) to (1.330);
\end{tikzpicture}
\end{document}

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.