# TikZ: Draw edge between node labels

I need to make a diagram in which the node labels are outside of the nodes themselves, and thus the edges in the graph should go from one node label to another. A simple snippet of what I currently have is

\begin{figure}[H]
\begin{tikzpicture}
\node[circle, draw=black, label=below:F] (F) at (0, 1) {};
\node[circle, draw=black, label=below:T] (T) at (-1, 0) {};
\node[circle, draw=black, fill=red, label=below:R] (R) at (1, 0) {};
\node[circle, draw=black, fill=red, label=above:Tt, below=of T] (Tt)  {};

\draw[-] (F) -- (T);
\draw[-] (R) -- (T);
\draw[-] (R) -- (F);
\draw[-] (T) -- (Tt);
\end{tikzpicture}
\end{figure}


which results in the following

Would there be any way to draw the edges so that the edge begins at T and ends at Tt?

• Welcome! Just name the labels. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \node[circle, draw=black, label=below:F] (F) at (0, 1) {}; \node[circle, draw=black, label={[name=LT,inner sep=1pt]below:T}] (T) at (-1, 0) {}; \node[circle, draw=black, fill=red, label=below:R] (R) at (1, 0) {}; \node[circle, draw=black, fill=red, label={[name=LTt,inner sep=1pt]above:Tt}, below=of T] (Tt) {}; \draw[-] (F) -- (T); \draw[-] (R) -- (T); \draw[-] (R) -- (F); \draw[-] (LT) -- (LTt); \end{tikzpicture} \end{document}
– user194703
Aug 30, 2019 at 3:45
• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Aug 30, 2019 at 8:22

Since a label is just another node, you can name it with the name key:

label={[name=<name>]<direction>:<text>}


However, we can get it automatically named by using \tikzlastnode and save a bit of typing. This way every label is named l-<name of parent node> (of course, this needs to be adjusted if you want to use more than one label).

## Code

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm,
n/.style={
circle, draw=black,
label={[name/.expanded=l-\tikzlastnode]#1}
}
]
\node[n=below:F]                        (F) at (0,  1) {};
\node[n=below:T]                        (T) at (-1, 0) {};
\node[n=below:R,  fill=red]             (R) at ( 1, 0) {};
\node[n=above:Tt, fill=red, below=of T] (Tt)           {};

\draw (l-F) -- (l-T);
\draw (l-R) -- (l-T);
\draw (l-R) -- (l-F);
\draw (l-T) -- (l-Tt);
\end{tikzpicture}
\end{document}