Hello,
I am totally new to networkx and trying to use Networkx to visualize a simple Graph where I have nodes connected by weighted edges.
In my case, each edge weight represents the "connection strength" between two nodes. The stronger the connection, the closest should the nodes be represented in 2D and 3D space.
So the edges length in the final drawing should be inversely proportional to the edge weight. The result should be islands of nodes with strong connections isolated from other islands or sinle nodes with weak connections.
I wish for a layout algorithm that respects this as much as possible, knowing that being limited to 2 dimensions it will not be always possible for all edges.
I have tried the spring_layout in the way copied below but it does not result in what I am expecting (playing with the iterations number is even seems 'random' to me.
The nodes are nicely distributed in space but weights do not seem to influence edges lengths. So the spring layout might not be the right one for my case ?
Help would be greatly appreciated.
Thank you
pos = nx.spring_layout(G, iterations=10,weight='weight')
labels = nx.get_edge_attributes(G, 'weight')
edges = G.edges()
nx.draw(G, pos, edges=edges,with_labels=True,font_size=12,edge_labels=labels)
nx.draw_networkx_edge_labels(G, pos, edge_labels=labels)