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

consistent output #17

Open
deitch opened this issue Jul 28, 2023 · 1 comment
Open

consistent output #17

deitch opened this issue Jul 28, 2023 · 1 comment

Comments

@deitch
Copy link

deitch commented Jul 28, 2023

Is there a way to get consistent (or nearly consistent) comparable output?

My specific use case is that we have protobufs, and expect to have the graph files checked into the repo as part of the commit. The simplest way to do this (we do it for generated language bindings) is to run protodot, and check if the file is different from what is checked in.

Except the output isn't consistent.

From my checks, I found several things:

  • date for generated by comment at the end; we can ignore that
  • subgraph cluster_<id>: the ID appears to be generated using some data about the content. As far as I can tell, this is consistent
  • node names, e.g. Node_Ja_<number>: the numbers appear to be consistent with the content in them
  • subgraph sort order: this appears to be one major source of discontinuity
  • node sort order within a subgraph: this appears to be another major source of discontinuity

I don't know the internals of protodot well enough, but it looks like consistent sorting of the subgraphs and nodes within subgraph might go a long way?

@deitch
Copy link
Author

deitch commented Jul 28, 2023

I delved into it quite a bit. It looks like it is because many of the elements (clusters in their parents, elements in their clusters, etc.) are all kept in maps, and then it ranges over the maps. It should be possible to range over the maps to get keys, then sort, then range over that. I tried, but I could not quite figure out where the right place to do it, as I don't understand the templating structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant