Dag
Dag

Reputation: 10539

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

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;
}

Upvotes: 29

Views: 9038

Answers (3)

wonder.mice
wonder.mice

Reputation: 7563

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;
}

Upvotes: 1

rioualen
rioualen

Reputation: 968

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"}
}

Upvotes: 2

tuxtimo
tuxtimo

Reputation: 2790

Just include the node names in double quotes like this:

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

Upvotes: 39

Related Questions