Drawing a clique graph with
import networkx as nx
....
nx.draw(G, layout=nx.spring_layout(G))
produces the following picture:
Obviously, the spacing between the nodes (e.g., the edge length) needs to be increased. I've googled this and found this suggestion here:
For some of the layout algorithms there is a scale
parameter that
might help. e.g.
import networkx as nx
G = nx.path_graph(4)
pos = nx.spring_layout(G) # default to scale=1
nx.draw(G, pos)
pos = nx.spring_layout(G, scale=2) # double distance between all nodes
nx.draw(G, pos)
However, the scale
parameter does not seem to have any effect.
What is the right method to get a better drawing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…