def degree_histogram(pedgraph):
"""Return a list of the frequency of each degree value.
Parameters
----------
pedgraph : Networkx graph
A graph
Notes
-----
Note: the bins are width one, hence len(list) can be large
(Order(number_of_edges))
"""
degree_sequence = sorted(nx.degree(pedgraph).values(), reverse=True) # degree sequence
# print "Degree sequence", degree_sequence
dmax = max(degree_sequence)
plt.loglog(degree_sequence, 'b-', marker='o', markersize=5, markerfacecolor='#FF8C00', antialiased=True,
color='#000000')
plt.title("(out)Degree Rank Plot")
plt.ylabel("(out)Degree")
plt.xlabel("Rank")
print "\t > Degree histogram plot created in ~/dgRankPlot.png"
plt.savefig("dgRankPlot.png")
#plt.show()
评论列表
文章目录