-
Notifications
You must be signed in to change notification settings - Fork 158
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
Special chars Node naming making get_subgraph() access complicated #246
Comments
Hi @florian0410, thanks for reporting. This is indeed very inconvenient. If with "mix-up of language" you mean the mixing of the name with the DOT quotes, I fully agree with you that that is the root cause. I am considering to separate the two by internally storing DOT IDs such as subgraph/cluster names without quotes and, if necessary, storing any quoting style information in a new pydot attribute, hopefully starting with pydot 2.0.0. See my comments in the last two paragraphs of #72 (comment). In that regard, your report can be considered a duplicate of #72, except that that one starts with the parser and this issue starts with Do you also have an issue with the
I would not know immediately. If you are not using any of pydot's cluster-specific functionality (e.g. Or maybe instead of If we succeed to drop the quoting from the name fields in pydot 2.0.0, you should at least be able to drop the two checks for quoted alternatives from your code. I don't know about the separate check for
For the quoting issue, I don't think |
For now (pydot 1.4.x), you might also be able to save checks for quoted and unquoted by calling subg = main_graph.get_subgraph(pydot.quote_if_necessary(group))
if not subg:
subg = main_graph.get_subgraph(pydot.quote_if_necessary('cluster_{0}'.format(group))) |
Hello Peter and thank you for your answers, I read the issue and it definitely is a dupplicate of #72 as you said with the cluster case here. Didn't see that one before ^^ About the cluster_ prefix, yes I have some trouble using it for the reasons you mentionned, since it's a specific name to Graphviz, it's complex to resolve and require knowledge about the tool to debug it. I think that a get_subgraph function with an option to search for clusters could help a bit but partly since it would add the prefix I suppose. Your idea of a separate pydot attribute is the same idea that came to my mind when encountering the issue, writing at the end the prefix sound like the best solution to me. For the clash issue, I have the same concern than you, but since there is an already existing Subgraph class, if someone added manually this to the name before, he may use the Subgraph class instead, even today (not convinced yet, but sounds like reasonnable...) ? Again thank you for your answers, I'll take a closer look to these ways, particularly on the quote_if_necessary method that should simplify things. And yes for the post errors I mixed up some experiences, I juste edited the post to fix that. Regards |
Ok, I will keep this issue open now then for two reasons:
Thanks! |
SUMMARY
Special Nodes names quoted, making get method complicated to use
ISSUE TYPE
help_wanted, details-needed
COMPONENT NAME
quote_if_necessary()
get_subgraph()
ADDITIONAL INFORMATION
Hello and thank you for maintaining this project.
During my developments, I ran into an issue that bother me.
After creating a cluster using the Cluster class,
The complex name attribute value (SAP+ here) is being quoted by quote_if_necessary() method.
My issue come after, at some point in my code, I try to access my created subgraph using get_subgraph() method. But when I'm using the base name I used to initialize it, I cannot find it back because it already have its quotes.
To fix this, I have to format specifically the name and add some exceptions:
I'm not sure we can say it's a bug but it's very inconvenient for accessing easily to the subgraphs.
Is there a better way to access this subgraph ? Should the method be enhanced/fixed to support this specific case ?
The real root cause looks like a mix-up of language to me.
Regards
The text was updated successfully, but these errors were encountered: