29

Is it possible to have a dash in the node name? I tried escaping with backslash, but it didn't work.

Example:

digraph test {
    some-name -> other-name;
}

3 Answers 3

37

Just include the node names in double quotes like this:

digraph test {
    "some-name" -> "other-name";
}
0
2

Since I faced the problem, the same goes for subgraphes names:

digraph G {
    {node "A-1"}
    {node "B"}
    subgraph "A-1B" {edge [dir=none]"A-1" -> "B"}
}
1

You can also use identifier-like names (i.e. without spaces, dashes, etc.), but also provide a better name as a label attribute, by declaring node explicitly first.

digraph D {
  nodeA [label="Node A"];
  nodeB [label="Node B"];
  nodeA -> nodeB;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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