I am trying to fix the layout that I get every time that I re-run my script.
I gave input pos to sfdp a propertymap that initializes all positions to
However, the output pos that I am getting is slightly different every time.
Any solutions? Thanks!
If you put all vertices on the same position, the repulsive force
between them will be undefined. What the algorithm does in this case, is
to push the vertices apart in random directions. To avoid this, you
should put them initially in different positions.
Furthermore, you should disable parallel processing with OpenMP which
will introduce another source of non-determinism. You can do this by
Thanks for the reply. I still have the same issue. I am running the
following code in Jupyter
prop = g.new_vertex_property("vector<double>")
for i in xrange(n):
prop[i] = [1 + i,1 + i]
pos = sfdp_layout(g, gamma=10.0, mu=10.0, mu_p=10.0, verbose = False,
I disabled the openmp command because it gives me an error that it's not
"OpenMP was not enabled during compilation".
Every time that I press shift + enter in Jupyter to re-run the above piece
of code (without running
anything else in-between) I get a different pos output.
I cannot reproduce this. Can you please provide a short, complete and
self-contained example that shows the problem?
Any news in that front? I tried various things but every time I get different
Is the method deterministic? If not how can I initialize its seed?
It should be deterministic, but it is not. This is a bug and will be
In the mean time you can make it deterministic by seeding the RNG before
Ok thanks Tiago. I made a hack by saving the pos variable and loading it back
when I need.
I will try your solution which sounds easier.
This is of course much faster, and makes a lot more sense if you just
need a single drawing for the same graph.