Self-loop can be drawn on a node; there are plenty of examples in documentation e.g. tikz: self loop with two arrows at the end (i.e. ending by ->>).
I can achieve it via graphviz easily.
I am using tikz-graphdrawing library and I want to draw a self-loop on a node. I tried the following
\tikz \graph[ layered layout ] { {1,2} -- n -- n -- {3,4}; };
And
\tikz \graph[ layered layout ] { {1,2} -- n[loop] -- {3,4}; };
MWE
% Compile using lualatex --shell-escape
\RequirePackage{luatex85}
\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{layered}
\begin{document}
\tikz \graph[ layered layout ] { {1,2} -- n -- n -- {3,4}; };
\tikz \graph[ layered layout ] { {1,2} -- n[loop] -- {3,4}; };
\end{document}

