I use the following code to draw a line to connect two nodes in my graphic:
\draw ( p-\prow-\col) -- (p-\row-\col);
At the edge of the figure, however, not every node will have a predecessor from which the line can originate.
What I would like to do is only draw the line conditionally, depending on whether the node
( p-\prow-\col) already exists or not.
I have seen this question, but the implementation and usage aren't clear to me (and it also seems to be handling the opposite case, executing when the node is undefined).
I'm simply looking for the correct syntax for the command
if node is defined: do this