I'm trying to respresent a binary tree with GraphViz using DOT, can I have a longer text string as a node's text but them just refer to it using a shortname when linking it? I'm working with GraphViz through Pandoc and Pandoc-plot.
I've tried setting and node's ID, name, label and refering to it but it just doesn't work. In my document it just got the codeblock instead a rendered graph, I've tested it with a simple graph and it renders fine.
I've tried a graph like this in the GraphViz online editor and the node's with the long names don't get connected in the right way.
graph {
"Adam \n 01/01"[id="adam"]
"Bella \n01/02"[id="bella"]
"Eloise \n01/05"
adam -- bella
bella -- eloise
}
Looks like you mix up node names and node labels (by default the node name is equal to the node label, so in your case the node name is "Adam \n 01/01"
and also the label is "Adam \n 01/01"
so you have to refer to it like:
"Adam \n 01/01" -- "Bella \n01/02"
but this is quite cumbersome and error prone so looks like you are looking for (as indicated bu "short names" request):
graph {
adam [label="Adam \n 01/01"]
bella [label="Bella \n01/02"]
eloise [label ="Eloise \n01/05"]
adam -- bella
bella -- eloise
}