I am having some problems in visualizing the graphs created with python-networkx, I want to able to reduce clutter and regulate the distance between the nodes (I have also t
You have a lot of data in your graph, so it is going to be hard to remove clutter.
I suggest you to use any standard layout. You said that you used spring_layout
. I suggest you to try it again but this time using the weight
attribute when adding the edges.
For example:
import networkx as nx
G = nx.Graph();
G.add_node('A')
G.add_node('B')
G.add_node('C')
G.add_node('D')
G.add_edge('A','B',weight=1)
G.add_edge('C','B',weight=1)
G.add_edge('B','D',weight=30)
pos = nx.spring_layout(G,scale=2)
nx.draw(G,pos,font_size=8)
plt.show()
Additionally you can use the parameter scale
to increase the global distance between the nodes.