> I tried specifying the seed parameter as follows: > > s = [] > s.append(range(len(g.vs))) > s.append(range(len(g.vs))) > l = g.layout_kamada_kawai(seed = s) > > but the layout is still different each time. On my machine, I get the following exception when running your code:
InternalError: Error at ../../src/layout_kk.c:99: Invalid start position matrix size in Kamada-Kawai layout, Invalid value This is because the layout function requires the transposed format where you have two columns and N rows. Another problem is that you need to provide not only the same seed matrix but also the same seed to the random number generator to make the layout fully deterministic. When you use the Python interface of igraph, igraph itself relies on the built-in RNG of Python, so you can either do this: import random random.seed(12345) l1 = g.layout_kamada_kawai(seed=s) random.seed(12345) l2 = g.layout_kamada_kawai(seed=s) or simply get the state of the RNG before creating the layout and then restore it: state = random.getstate() l1 = g.layout_kamada_kawai(seed=s) random.setstate(state) l2 = g.layout_kamada_kawai(seed=s) I hope this helps; let me know if it doesn't work for you. All the best, T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
