I'm using Graph Drawing with Force algorithm to place nodes and edges, but for some reason the edges do not display the arrows when [spring layout] is used.
It works correctly when manually placing the nodes and the edges without the algorithmic layout.
My question is how to make the spring layout display the edge arrows correctly as in the second tikz picture.
Follows the MWE.
\documentclass[tikz,border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, graphdrawing, quotes }
\usegdlibrary {force}
\tikzset{
node distance = 20mm,
provides/.style = {->},
every edge quotes/.style = {fill=white,sloped},
}
\begin{document}
\begin{tikzpicture}[spring layout]
\node [draw] (a) {A};
\node [draw] (b) {B};
\draw [provides] (a) edge ["stuff"] (b);
\end{tikzpicture}
\begin{tikzpicture}
\node [draw] (a) {A};
\node [draw, below = of a] (b) {B};
\draw [provides] (a) edge ["stuff"] (b);
\end{tikzpicture}
\end{document}
graphdrawing
library only catches the options that are given directly at theedge
, i.e.\path (a) edge [provides, "stuff"] (b);
. (Don't use\draw
with onlyedge
s.)graphdrawing
only defines--
types of edges.