5

I need to draw the following Figure:

Directed graph I already wrote the following code: In this code not generate the directions of the graph. How to do this and organizte according to Figure that I annexed?

\documentclass[border=1cm]{standalone}
\usepackage{tikz}

\begin{document} \begin{tikzpicture} %% vertices \draw[fill=black] (0,0) circle (3pt); \draw[fill=black] (4,0) circle (3pt); \draw[fill=black] (2,-1) circle (3pt); \draw[fill=black] (4,2) circle (3pt); \draw[fill=black] (0,2) circle (3pt);

    % labelleds
    \node at (-0.5,2) {$a$};
    \node at (-0.5,0) {$b$};
    \node at (4.5,0) {$c$};
    \node at (2.5,-1.2) {$e$};
    \node at (4,2.3) {$d$};
    %% arcs
    \draw[->]
    (2,-1) -- (0,0) -- (4,2) -- (4,0);
    \draw[->] (2,-1) -- (4,0);
    \draw[->] (0,0) -- (4,0);
    \draw[->] (0,2) -- (0,0);
\end{tikzpicture}

\end{document}

enter image description here

Roland
  • 6,655
Frank
  • 192

2 Answers2

6

Here is a way.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{myarrow/.style={postaction={decorate},
decoration={markings,% switch on markings
mark=at position #1 with {\arrow{latex}},
}}}

\path (0,0) coordinate (a) node[above]{$a$}--
++(-60:1.5) coordinate (b) node[below left]{$b$}-- ++(0:2.5) coordinate (c) node[above]{$c$}-- +(30:2) coordinate (d) node[right]{$d$}-- +(-130:2) coordinate (e) node[below]{$e$} ; \draw[myarrow=.5] (a)--(b); \draw[myarrow=.5] (b)--(c); \draw[myarrow=.5] (c)--(d); \draw[myarrow=.5] (e)--(c); \draw[myarrow=.5] (d) to[bend left=40] (c);

\foreach \p in {a,...,e} \fill (\p) circle(1.5pt); \end{tikzpicture} \end{document}

Black Mild
  • 17,569
6

Another possibilities:

  • for nodes is defined style dot with option for label
  • used are absolute coordinate (slightly modified from OP MWE)
  • for edge is defined style, which has option postaction=decorate
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                decorations.markings}

\begin{document} \begin{tikzpicture}[ decoration = {markings, mark=at position .5 with {\arrow{Stealth[length=2mm]}}}, dot/.style = {circle, fill, inner sep=2.4pt, node contents={}, label=#1}, every edge/.style = {draw, postaction=decorate} ] \node (a) at (0,5) [dot=$a$]; \node (b) at (1,2) [dot=below:$b$]; \node (c) at (4,2) [dot=$c$]; \node (d) at (6,4) [dot=right:$d$]; \node (e) at (3,0) [dot=right:$e$]; % \path (a) edge (b) (b) edge (c)
(c) edge (d) (c) edge (e) (d) edge[bend left] (c); \end{tikzpicture} \end{document}

enter image description here

Zarko
  • 296,517