1
votes

Can the package NetworkX be used to draw complex network with weights given by a distribution, for example a power law? Then can I write a code to draw the weight distribution or strength distribution, or even further to draw the weighted average nearest neighbours degree of a node? then coloring each class of similar degrees, or similar strenghs, etc.

I have a large data of a complex network consisting of about 300 nodes, and data about individual egdes' weights. What is the best way to draw such a network?

1
Yes networkx can do all of those things. I suggest you go over the documentation and if you are stuck at any part ask those questions. By the way, I wouldn't consider a 300 node network as 'large'.Avaris
Thank you very much for your observation. I just started to realize the documentation accounts for weighted networks as well. So in the "degree" section when you compute the "degree" and add the weight in the parameters in the associated code you get the strength and so no.Aya

1 Answers

3
votes

Edges in networkx can use the special attribute 'weight' which can be used in a number of algorithms requiring weighted edges. You can use networkx drawing commands to take these weights into account (e.g., by the spring force in a spring embedded visualisation). Something like:

>>> import networkx as nx
>>> import matplotlib.pyplot as plt
>>> G = nx.Graph()
>>> # add nodes, edges, etc.
...
>>> nx.draw_spring(G)
>>> plt.show()