Comments (7)
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.
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.
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.
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.
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.
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.
Fixed by #28
Default identifier generator might be implemented in v3
from dotnetgraph.
Related Issues (19)
- Character escaping issue HOT 5
- Restore minification as an option HOT 2
- Properties with real type instead of *Attribute for better autocompletion HOT 1
- Missing Attribute Pos HOT 2
- DotArrow should output -- in undirected graphs HOT 2
- Label question HOT 8
- Add support for layouts HOT 2
- Possible missing features HOT 5
- How to specify `rankdir` graph attribute HOT 3
- missing System.Drawing.Color assembly HOT 14
- Make a simple logo out of a free icon
- Create a parser
- Readme vs class - DotSubGraph vs DotSubgraph HOT 2
- DotGraph.getNode(string identifier) or DotEdge.From(string identifier).To(string identifier) HOT 2
- Feature Request: Add support for subgraphs/clusters HOT 2
- Please provide a signed assembly
- doesn't support records? HOT 1
- Question: Default Styles (or theme)? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnetgraph.