7

I wanted to know how to make this drawing of a relation R in a set A. I've searched around a little but I don't find what I need. Thanks in advance! Sorry I don't know much of TikZ.

enter image description here

3
  • 5
    Welcome to TeX.SX! What have you tried so far? Please provide a minimal working example of your current attempt. You might be able to use the state transitions defined in the automata TikZ library for the relationships - the nodes itself should be rather straightforward.
    – epR8GaYuh
    Mar 14, 2021 at 7:08
  • 1
    I tried searching "tikz automata" and I found some interesting links. Thanks for your comment. Tomorrow I'm going to keep trying. Unfortunately I don't know TikZ very well so I couldn't try much Mar 14, 2021 at 7:13
  • I was going to recommend using dot2tex, but I forgot how to create a circular reference like what you've shown in dot.
    – Mast
    Mar 14, 2021 at 18:59

2 Answers 2

8

With circular loops and bent arrows. This can be achieved by using an arc in some to path construction.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,bending,calc}  
\begin{document}
\begin{tikzpicture}[carrow/.style={to path={%
    ($(\tikztotarget)+(#1:\pgfkeysvalueof{/tikz/cradius})+(#1+170:\pgfkeysvalueof{/tikz/cradius})$)
    arc[start angle=#1+170,end angle=#1-170,radius=\pgfkeysvalueof{/tikz/cradius}]},
    ->},dot/.style={circle,inner sep=1.2pt,fill,outer sep=0.5ex},
    cradius/.initial=0.4,
    >={Latex[bend]},bend angle=12]
 \path node[dot,label=225:{$a$}](a){}
  ++ (45:1.5) node[dot,label=45:{$b$}](b){}
  ++ (-30:1.5) node[dot,label=90:{$c$}](c){}
  ($(a)+(0,-1.8)$) node[dot,label=225:{$d$}](d){}
  ++ (1.5,0.1) node[dot,label=225:{$f$}](f){}
  ++ (1.5,-0.3) node[dot,label=-120:{$e$}](e){}
  ++ (0:1.8) node[dot,label=-60:{$h$}](h){}
  ++ (120:1.8) node[dot,label=90:{$g$}](g){};
 \path[shorten >=1ex, shorten <=0.5ex,semithick] 
 (a) edge[->,bend left] (b) edge[carrow=45] (b)
 (b) edge[->,bend left] (a) edge[carrow=-135,<-] (a)
 edge[carrow=-135,<-] (d)
 edge[carrow=-135,<-] (f)
 edge[carrow=-120] (e)
 edge[carrow=-60,<-] (h)
 edge[carrow=90,<-] (g)
 edge[carrow=90,<-] (c)
 (e) edge[->,bend left] (g)
 (g) edge[->,bend left] (e)
 (h) edge[->,bend left] (g)
 (g) edge[->,bend left] (h)
 (e) edge[->,bend left] (h)
 (h) edge[->,bend left] (e);    
\end{tikzpicture}
\end{document}

enter image description here

1
  • 1
    Beautiful result!
    – Benjamin R
    Mar 14, 2021 at 17:53
6

Part of your image:

enter image description here

\documentclass[margin=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata,
                positioning}

\begin{document}
    \begin{tikzpicture}[
                > = Stealth,
    node distance = 22mm,
every edge/.style = {->, draw, thick, bend angle=15},
every label/.style= {inner sep=1pt, font=\small},   
       dot/.style = {circle, fill, inner sep=1mm, outer sep=1mm}
                        ]
\node (a) [dot,label=above:a] {};
\draw (a) edge[out=225, in=315, looseness=9] (a);
%
\node (b) [dot,label=below:b, right=of a] {};
\draw (b) edge[out=225, in=315, looseness=9] (b);
%
\node (c) [dot,label=below:c, right=of b] {};
\node (d) [dot,label=above:d, above right=of c] {};
\node (e) [dot,label=below:e, below right=of d] {};
\draw (c) edge[out=225, in=315, looseness=9] (c)
      (c) edge[bend right] (d)
      (d) edge[bend right] (c)
      (d) edge[out=135, in= 45, looseness=9] (d)
      (d) edge[bend right] (e)
      (e) edge[bend right] (d)
      (e) edge[out=225, in=315, looseness=9] (e)
      (e) edge[bend right] (c)
      (c) edge[bend right] (e);
    \end{tikzpicture}
\end{document}

For other loop directions you need to select appropriate out and in angles.

You must log in to answer this question.

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