3

I am trying to implement the following graph :

here.

I came up with a MWE, but I am unable to draw the curved edges. The code is shown below:

        \documentclass[11pt]{scrartcl} 
        \PassOptionsToPackage{usenames,dvipsnames,svgnames}{xcolor}  
        \usepackage{tikz}
        \usetikzlibrary{arrows,positioning,automata}

        \begin{document}
        \begin{tikzpicture}[>=stealth',shorten >=1pt,node distance=3cm,on grid,initial/.style    ={}]
          \node[state]          (A)                        {$Author$};
          \node[state]          (P) [above right =of A]    {$Paper$};
          \node[state]          (T) [below right =of A]    {$Topic$};
          \node[state]          (V) [below right =of P]    {$Venue$};
        \tikzset{mystyle/.style={->,double=orange}} 
        \tikzset{every node/.style={fill=white}} 
        \path (V)     edge [mystyle]    node   {$publish$} (P)
              (P)     edge [mystyle]    node   {$mention$} (T)
              (T)     edge [mystyle]    node   {$mention-1$} (P)
              (P)     edge [mystyle]    node   {$write-1$} (A)
              (T)     edge [mystyle]    node   {$contain$} (T);
        \tikzset{mystyle/.style={double=orange}}   
        \tikzset{mystyle/.style={<->,relative=false,in=0,out=60,double=orange}}
        \end{tikzpicture}
        \end{document}
1

1 Answer 1

3

One way would be to use the to[ <options> ] syntax:

\draw [red, ultra thick, ->] (A.north west) to[out=190, in=170, distance=1.5cm] (A.south west);
\draw [red, ultra thick, ->] (T.-150) to[out=-80, in=-100, distance=1.5cm] (T.-30);

where you can specify the terminal points of the curved line via a compass direction (A.north west) or using an angle as in (T.-150), and control the in=, out= angles along with the distance=:

enter image description here

Notes:

  • Not sure why you were doing a \tikzset at \end{tikzpicture}. I have removed that portion of the code as it has no effect here.

Code:

\documentclass[11pt]{scrartcl} 
\PassOptionsToPackage{usenames,dvipsnames,svgnames}{xcolor}  
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,automata}

\begin{document}
\begin{tikzpicture}[>=stealth',shorten >=1pt,node distance=3cm,on grid,initial/.style    ={}]
  \node[state]          (A)                        {$Author$};
  \node[state]          (P) [above right =of A]    {$Paper$};
  \node[state]          (T) [below right =of A]    {$Topic$};
  \node[state]          (V) [below right =of P]    {$Venue$};
\tikzset{mystyle/.style={->,double=orange}} 
\tikzset{every node/.style={fill=white}} 
\path (V)     edge [mystyle]    node   {$publish$} (P)
      (P)     edge [mystyle]    node   {$mention$} (T)
      (T)     edge [mystyle]    node   {$mention-1$} (P)
      (P)     edge [mystyle]    node   {$write-1$} (A)
      (T)     edge [mystyle]    node   {$contain$} (T);
      
\draw [red, ultra thick, ->] (A.north west) to[out=190, in=170, distance=1.5cm] (A.south west);
\draw [red, ultra thick, ->] (T.-150) to[out=-80, in=-100, distance=1.5cm] (T.-30);

\end{tikzpicture}
\end{document}
2
  • So unlike the edge command, the draw command does not have a feature to label/name the edge? Commented Apr 5, 2016 at 14:54
  • The labeling is done on a node not an edge. You can add a node to the \draw and label it also. Commented Apr 5, 2016 at 22:52

You must log in to answer this question.

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