Is it possible to have a dash in the node name?
Asked Answered
N

3

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;
}
Nino answered 19/2, 2013 at 13:9 Comment(0)
P
37

Just include the node names in double quotes like this:

digraph test {
    "some-name" -> "other-name";
}
Pericranium answered 19/2, 2013 at 13:14 Comment(0)
C
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"}
}
Coagulant answered 5/11, 2013 at 13:27 Comment(0)
C
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;
}
Cripps answered 11/9, 2019 at 20:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.