How do I use special characters in a dot file node_id?
Asked Answered
S

1

8

I am looking forward to write a script that will automatically take input from a file and declare the nodes and edges, and produce a graph that can be visualized in any visualization software.

I tried dot language and graphViz. This language uses grammar which clearly declare the nodes of the graph like this: node1;, node2; and does not allow any special character except _.

It works well in all the cases but when I want to declare a node named java.lang.object it shows grammatical error because of presence of . and I can't change its grammar.

Can anyone help me by suggestion some other language which can take input from text file and can draw a graph on any visualization software.

Shotgun answered 26/8, 2013 at 12:42 Comment(0)
L
12

That's actually quite easy to do in graphviz, simply put some quotes around the node names. Or you may define first your node using a simple identifier and a label attribute.

Both techniques demonstrated here:

digraph g {
  "java.lang.object" -> "my.class";
  "my.class" -> "special < chars >";
  n1 [label="more.strange<node>names"];
  "special < chars >" -> n1;
}
Leveroni answered 26/8, 2013 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.