\documentclass{article} \usepackage[T2A]{fontenc} \usepackage[russian,english]{babel} \usepackage[utf8]{inputenc} \usepackage{amsmath,amssymb} \usepackage{tikz} \begin{document} \pagestyle{empty} \begin{tikzpicture}[scale=0.8,level 2/.style={sibling distance=10mm}] \node[thick,circle,draw] (c) at (0, 0) {$c$} child { node[thick,circle,draw] (h) {$h$} edge from parent [<-,thick] child { node[thick,circle,draw] (b) {$b$} edge from parent [<-,thick] } } child { node[thick,circle,draw] (e) {$e$} edge from parent [<-,thick] }; \node[thick,circle,draw] (f) at (2, 0) {$f$} child { node[thick,circle,draw] (d) {$d$} child { node[thick,circle,draw] (g) {$g$} edge from parent [<-,thick] } edge from parent [<-,thick] }; \draw [->,thick] (c) to[loop above] node[auto] {} (c); \draw [->,thick] (f) to[loop above] node[auto] {} (f); \node (L) at (3, -1) {} ; \node (R) at (5.5, -1) {} ; \draw [->,dashed,thick] (L) -- (R) node [midway,above] {\texttt{join(e,d)}}; \node[thick,circle,draw] (f) at (7, 0) {$f$} child { node[thick,circle,draw] (c) {$c$} edge from parent [<-,thick,dashed,red] child [solid,black] { node[thick,circle,draw] (h) {$h$} edge from parent [<-,thick] child { node[thick,circle,draw] (b) {$b$} edge from parent [<-,thick] } } child [solid,black] { node[thick,circle,draw] (e) {$e$} edge from parent [<-,thick] } } child { node[thick,circle,draw] (d) {$d$} child { node[thick,circle,draw] (g) {$g$} edge from parent [<-,thick] } edge from parent [<-,thick] }; \draw [->,thick] (f) to[loop above] node[auto] {} (f); \end{tikzpicture} \end{document}