Agizin / Algorithm-Visualization

0 stars 1 forks source link

Control PyGraphViz RNG seed #16

Open Byvire opened 6 years ago

Byvire commented 6 years ago

Part of #14

Find a way to control the seed of the RNG that pygraphviz uses. Otherwise, whenever algviz produces a large batch of graph images, some of them will look awful. (If this isn't feasible, we can work around it by not overwriting certain existing images when algviz runs. We'll probably need to do something like that for efficiency anyway. But as a user, I'd prefer to be able to delete everything except the markdown file and then reproduce all the images exactly as before.)

Byvire commented 6 years ago

At a glance, this might be what you want. I haven't tried to set it through pygraphviz, though. https://graphviz.org/doc/info/attrs.html#d:start In general, that page is very useful for learning how to control graphviz. (PyGraphViz is just a python interface to GraphViz, so the parameters for GraphViz usually can be set through pygraphviz.)

Donistivanov commented 6 years ago
myRandomSeed = 100
G = AGraph(...)
G.graph_attr['start'] = myRandomSeed