New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graph object cannot have name "graph" as it breaks GraphViz #282
Comments
Obviously a very minor issue, but confusing for first-time users. |
I ran into the same issue when using "subgraph" as a node name. A little digging turned out they are reserved as dot file keywords (for anyone who comes across this PR). The exception message displayed if a node name is invalid:
I think this might be too cryptic for a dot file noob like me to figure out. |
According to that grammar, ID values can optionally be quoted — but since any ID might be a keyword, it's probably a good idea for any code generating graphs to just always quote all of them.
graph "graph" {
"1" [label=ROOT];
"2" [label=S];
"2" -- "1";
"3" [label=NP];
"3" -- "2";
"4" [label=VP];
"4" -- "2";
"5" [label=DT];
"5" -- "3";
"6" [label=VBZ];
"6" -- "4";
"7" [label=NP];
"7" -- "4";
"8" [label=This];
"8" -- "5";
"9" [label=is];
"9" -- "6";
"10" [label=DT];
"10" -- "7";
"11" [label=NN];
"11" -- "7";
"12" [label=a];
"12" -- "10";
"13" [label=test];
"13" -- "11";
} (It only "needs" to quote the |
Naming Graph "graph", eg.
graph = pydot.Dot("graph", graph_type="graph")
leads to following Dot string:
and following GraphViz error on any interaction:
The text was updated successfully, but these errors were encountered: