Closed maxhoerstr closed 1 year ago
I suspect you're using an old version of Python (2.x) in which dict
iteration order varies from one execution to another. This may influence the order in which GraphViz
considers them for computing a layout. On my recent version of Python, the result is deterministic with dot
layout. However, note that GraphViz
may use randomized algorithms for other layouts, so the result may be non-deterministic by construction.
I've just committed a patch to plugin gv
that sorts the nodes provided to GraphViz
, this should solve your issue if it indeed caused by iteration orders. Let me know if it's better now.
Thank you very much for the quick response! This indeed solved my problem and now all my nets are drawn the same on every run, nice! I'm using Python 3.10 at the moment, and python version 3.x before, so i dont think Python 2.x was the source of problem. My team members also had the same problems.
Could you update the pip package so we can use the updated version? Thanks in advance!
My bad, I tested without restarting Python, and indeed iteration order may vary from one execution to another, even with newer Python versions. Anyway, sorting fixes the problem. I'll push a new release on PyPi.
Hello,
if i execute the following dummy code to draw the created petri net, the result seems to be different in every run.
I need the drawing to be deterministic, so on every run, the same petri net is drawn. Is this possible in the current version of the library?
Below, 2 possible images for the petri net above are shown.
Thank you in advance!