Skip to content
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

node and edge handle string input differently #100

Closed
hodgett opened this issue Jun 10, 2020 · 1 comment
Closed

node and edge handle string input differently #100

hodgett opened this issue Jun 10, 2020 · 1 comment

Comments

@hodgett
Copy link

hodgett commented Jun 10, 2020

If I pass the string n1 = "http://brick.oclc.com.au:81/" to node g.node(n1) then it appears in the .gv file as "http://brick.oclc.com.au:81/". When I pass the same string to edge g.edge(n1,n2) it appears in the .gv file as http:"//brick.oclc.com.au":81/ which causes an error;
syntax error in line 3001 near '/'
The quotation marks get messed up. Why do the two functions handle the same string differently?

@xflr6
Copy link
Owner

xflr6 commented Jun 10, 2020

The edge method currently accepts :-separated strings as node_ids (DOT language), currently splitting them naively into node, port, and compass (underdocumented unfortunately). AFAIU the DOT language principally allows port and compass also in node statements but they seem to be ignored, which is why the node method is different here.

The best current workaround is probably to use node names and labels where the wanted labels could contain colons:

In [1]: import graphviz
   ...: 
   ...: g = graphviz.Graph()
   ...: g.node('A', 'http://brick.oclc.com.au:81/')
   ...: g.node('B', 'spam')
   ...: g.edge('A', 'B')
   ...: g

graph

Duplicate of #53 (see discussion there).

@xflr6 xflr6 closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants