I would like to draw a deterministic finite-state machine which was created from a nondeterministic finite-state machine with Graphviz. To do so, I need to have labels like "{q1, q2}". When I try to do so with DOT, I get the following error:

$ dot -Tpng dfsm.gv -o myDeterministicFiniteStateMachine.png
Error: dfsm.gv:4: syntax error near line 4
context: node [shape = doublecircle]; "{q2, >>>  f}", <<<  "{f}";

Is there any way to get curly braces in a Graphviz label?

1 Answer 1


It would help if you showed your actual dot source code, because what you're trying to do should work fine. There are no major restrictions in Graphviz on what text you may place in a label. There's no major restriction on node names either; of course, if your node name contains more than just basic alphanumeric characters, you should enclose the node name in quotation marks. A simple example:

digraph fsm {
  node [shape=doublecircle]
  "{q2, f}"

Graphviz rendering

Note that the Graphviz web site has an fsm example. It does not use curly braces in its labels, but it might be useful if you need a reference for other reasons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.