-
Notifications
You must be signed in to change notification settings - Fork 22
Missing node identifier produces invalid dot file #10
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
Comments
I'm ok with your first point, I'll add a piece of code to use a GUID if no identifier is set. |
With GUIDs the unique identifier thing, isn't really an issue anymore, as I can simply never set one and the GUID will guarantee uniqueness. As such I can live without it. Personally, I'd have such a constraint, either on the graph itself or latest in the compiler. And depending on whether you count a graph with duplicated node identifiers as valid or not, it can well be argued that it's the compiler's responsibility to generate a valid graph/dot file. 🤔 |
With |
I think yes it could make sense to introduce a identifier generator since it's not a lot of work and it allows more freedom. I've tested to create a graph with two nodes having the same identifier and it compiles, you can have a look here: https://dreampuf.github.io/GraphvizOnline/#digraph%20G%20%7B%0A%0A%20%20a%20%5Bcolor%3Dred%5D%0A%20%20a%20%5Bcolor%3Dgreen%5D%0A%7D Maybe letting the developer to choose wether or not to check uniqueness (with simple bool parameter, disabled by default) could be a good compromise. What do you think? |
Yeah, dot does generate some graph, as such it might technically not be wrong (don't really fancy reading the spec), it's just that you'll usually end up with unexpected out comes. Sounds like a good compromise to me. |
I've started to implement it, you can check PR #11 |
Fixed by #28 |
The constructor of
DotNode
takes an optional string identifier parameter. If none is provided, the identifier is set tonull
. However, if you do not set an identifiert, the compiled dot file is invalid, as the nodes can not be identified.I see multiple solutions and was wondering what you think would be the preferred one:
Since the identifier is not visible in the rendered graph from a dot file and since picking a unique name for each node can be a bit annoying, I'd suggest to leave it optional and just generate GUID if not set.
While we're on the topic of uniqueness, currently there are no checks to ensure that the graph has unique identifiers. So if you add two nodes with the same identifier, only one will be rendered. Any ideas on how to solve this?
The text was updated successfully, but these errors were encountered: