How to increase node spacing for networkx.spring_layout

The solution to this problem lies in the NetworkX version 1.8 which is yet to be released, but is available via git hub.

Do the following to increase the distance between nodes:

pos = nx.spring_layout(G, k=0.15, iterations=20)
# k controls the distance between the nodes and varies between 0 and 1
# iterations is the number of times simulated annealing is run
# default k=0.1 and iterations=50

Tweak with these parameters to see how it works. But despite this there is no guarantee that all nodes are non-overlapping

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)