[Numpy-discussion] Stick intersection path algorithm

Daπid davidmenhur at gmail.com
Thu Sep 5 10:06:36 EDT 2013


On 5 September 2013 13:14, Josè Luis Mietta <joseluismietta at yahoo.com.ar>wrote:

> 2. Using networkx or other tool: how can I obtain the 'clusters size'
> distribution (that is: number of clusters of size 'D', for all
> cluster-sizes)?


This is best asked in their mailing list. A possible way is:

np.bincount([len(i) for i in nx.connected_components(G)])

For example:
np.bincount([len(i) for i in
nx.connected_components(nx.erdos_renyi_graph(100, 0.01))])
array([ 0, 39,  7,  3,  1,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,
0,  0,  1])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130905/d08772d5/attachment.html>


More information about the NumPy-Discussion mailing list