I have an unique problem. I am using dot to represent a graph which is generic in nature. So, instead of using numbers, I was planning to use symbols like greek letters like alpha, beta, etc. I am curious to know how can we label nodes/edges in .dot file using some symbols?
for example,
node1 -> node2 [label= <something here which will show up as symbol of beta> style=dashed]
In Word, you can insert mathematical symbols into equations or text by using the equation tools. On the Insert tab, in the Symbols group, click the arrow under Equation, and then click Insert New Equation. Under Equation Tools, on the Design tab, in the Symbols group, click the More arrow.
You can use HTML-like a labels:
digraph G {
a [ label=<α>]
b [ label=<β>]
c [ label=<γ>]
a -> b -> c
}
will show alpha -> beta -> gamma
:
You could also used named HTML references to make it even clearer (mentioned in a comment):
label=<I love α and β>
The surrounding <>
indicate that the label should be parsed as a custom language that looks like an HTML subset: http://www.graphviz.org/doc/info/lang.html#html
Unicode characters
Sometimes you can get away with Unicode https://en.wikipedia.org/wiki/Greek_alphabet#Greek_in_Unicode
graph {
"α" -- "β"
}
Output:
You can also emulate some more math with Unicode, e.g.:
Tested on Ubuntu 16.10, graphviz 2.38.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With