Re: [networkx-discuss] Cumulative Degree Distribution

350 views
Skip to first unread message

Aric Hagberg

unread,
Apr 27, 2013, 4:12:23 PM4/27/13
to networkx...@googlegroups.com
On Sat, Apr 27, 2013 at 1:26 PM, Yasir Mohmand
<yasir.t...@gmail.com> wrote:
> Dear All,
> Can anyone explain to me how to make a cumulative degree
> distribution chart in Networkx. I am completely new to this software, thus
> asking. Thanks in advance.

You can get a cumulative degree distribution like this (G is your graph):

list(cumulative_sum(nx.degree_histogram(G)))

Then plot the numbers, for example with matplotlib

import matplotlib.pyplot as plt
plt.plot(list(cumulative_sum(nx.degree_histogram(G))))

Aric
Reply all
Reply to author
Forward
0 new messages