pedWorks.py 文件源码

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

项目:PedWorks 作者: BrnCPrz 项目源码 文件源码
def calculate_indegree(graph):
    # will only work on DiGraph (directed graph)
    print "\tCalculating Indegree..."
    g = graph
    indeg = g.in_degree()
    nx.set_node_attributes(g, 'indegree', indeg)
    indeg_sorted = sorted(indeg.items(), key=itemgetter(1), reverse=True)
    for key, value in indeg_sorted[0:10]:
        print "\t   > ", key, value
    return g, indeg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号