hbmartin / graphviz2drawio

Convert graphviz (dot) files to draw.io / lucid (mxGraph) format. Beautiful and editable graphs in your favorite editor.
https://pypi.org/project/graphviz2drawio/
GNU General Public License v3.0
186 stars 32 forks source link

deterministic output #10

Closed jcaplan closed 6 years ago

jcaplan commented 6 years ago

Given an input, the output should be the same every time. This improves testability. Currently at least node orders are variable.

hbmartin commented 6 years ago

@jcaplan what's happening here is that nodes and edges are stored as dicts. Dict ordering is guaranteed in 3.6 (https://docs.python.org/3.6/whatsnew/3.6.html#new-dict-implementation) but is not in previous versions. It would require significant implementation changes to preserve order in the previous version which I think is unnecessary. So I think in terms of testing we either only test on 3.6+ or make the tests flexible enough to not require element ordering. I prefer the latter since testing on 3.4 has already had positive effects :)

jcaplan commented 6 years ago

This is in graphviz2drawio or elsewhere? Shouldn't be too hard to change to OrderedDict if it's only in this project https://docs.python.org/3/library/collections.html#collections.OrderedDict

hbmartin commented 6 years ago

Will close this once edges are ordered