pedWorks.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:PedWorks 作者: BrnCPrz 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号