28

Is it possible to have a dash in the node name? I tried escaping with backslash (searching the web didn't helped either). Example:

digraph test {
    some-name -> other-name;
}
Dag
  • 10,079
  • 8
  • 51
  • 74

3 Answers3

36

Just include the node names in double quotes like this:

digraph test {
    "some-name" -> "other-name";
}
tuxtimo
  • 2,730
  • 20
  • 29
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"}
}
rioualen
  • 948
  • 8
  • 17
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;
}
wonder.mice
  • 7,227
  • 3
  • 36
  • 39