# Tikz graph with citations

I am trying to create a graph whose nodes are some author-year citation from the bibliography. This question is very similar to this post but, unfortunately, the answers provided suggest using the Forest package, which is meant to draw trees, or to manually position the nodes. Neither of those are convenient and I would really like to use the various tools and options of the algorithmic graph drawing capabilities of Tikz.

Simply using the \cite{} command inside a graph throws a missing \endcsname error. I have tried to remove some of the formatting done by the \cite command to fix this, without success.

I fear this is beyond my very limited Latex coding capabilities and any help would be appreciated.

Note that I would rather use bibtex to create the bibliography, but will welcome a transition to biber if it fixes the issue. I experimented with biblatex mostly to try the \citefield command.

Here is a MWE:

\RequirePackage{filecontents}
\begin{filecontents}{testGraph.bib}
@book{BookA,
author    = "A",
title     = "A book",
year      = 2000,
}

@book{BookB,
author    = "B",
title     = "B book",
year      = 2002,
}
\end{filecontents}

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs}

\usepackage[%
backend=bibtex,
]{biblatex}

\DeclareCiteCommand{\citeGraph}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}}
{\thefield{title}}

\begin{document}

% Does not work

%\begin{figure}[h]
%\centering
%\tikz  \graph  {
%\cite{bookA} -> B
%};
%\end{figure}

% Does not work either...

%\begin{figure}[h]
%\centering
%\tikz  \graph  {
%{\citeGraph{Book1}} -> B}
%};
%\end{figure}

\begin{figure}[h]
\centering
\begin{tikzpicture}[show/.style={draw}]
\node[show]    (bookA)    at    (0,0)
{\citeGraph{BookA}};
\node[show]    (bookB)   at     (3,0)
{\citeGraph{BookB}};
\draw[->]    (bookA) -- (bookB);
\end{tikzpicture}
\end{figure}

\printbibliography

\end{document}
\endinput


Nodes in a graph are given names that are identical to the content, and you can't name a node \cite{...}. To get around that use e.g. A[as=\citeGraph{BookA}], then the node gets the name A, but the content \citeGraph{BookA}.

\RequirePackage{filecontents}
\begin{filecontents}{testGraph.bib}
@book{BookA,
author    = "A",
title     = "A book",
year      = 2000,
}

@book{BookB,
author    = "B",
title     = "B book",
year      = 2002,
}
\end{filecontents}

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs}

\usepackage[%
backend=bibtex,
]{biblatex}

\DeclareCiteCommand{\citeGraph}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}}
{\thefield{title}}

\begin{document}

\tikz  \graph  {
A[as=\cite{BookA}] -> B
};

\printbibliography

\end{document}