Code Monkey home page Code Monkey logo

Comments (7)

vfrz avatar vfrz commented on May 25, 2024

I'm ok with your first point, I'll add a piece of code to use a GUID if no identifier is set.
About the uniqueness of the identifiers, I think this is not the responsability of my current compiler implementation. I'd rather develop a parser that would validate graphs and return those type of errors.
I'm open to discussion :)

from dotnetgraph.

eXpl0it3r avatar eXpl0it3r commented on May 25, 2024

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. 🤔

from dotnetgraph.

eXpl0it3r avatar eXpl0it3r commented on May 25, 2024

With Guid.NewGuid() this becomes a bit harder to test, as you now introduce a random element.
Do you think, it would make sense to introduce a identifier generator or similar that could be mocked?
Or would you rather adjust the test, to no do exact string matching on the output?

from dotnetgraph.

vfrz avatar vfrz commented on May 25, 2024

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?

from dotnetgraph.

eXpl0it3r avatar eXpl0it3r commented on May 25, 2024

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.

from dotnetgraph.

vfrz avatar vfrz commented on May 25, 2024

I've started to implement it, you can check PR #11
For my current implementation if a node has no identifier it's generating one when the node is added to the graph. I am not sure this is the best design decision, and maybe it should be generated when the graph is compiled, so the IdentifierGenerator is linked to the compiler instead of the graph object.
What would be most practical for your use case?

from dotnetgraph.

vfrz avatar vfrz commented on May 25, 2024

Fixed by #28
Default identifier generator might be implemented in v3

from dotnetgraph.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.