net_metrics.py 文件源码

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

项目:HRG 作者: nddsg 项目源码 文件源码
def get_graph_hops(graph, num_samples):
    c = Counter()
    for i in range(0, num_samples):
        node = sample(graph.nodes(), 1)[0]
        b = nx.bfs_successors(graph, node)

        for l, h in hops(b, node):
            c[l] += h

    hopper = Counter()
    for l in c:
        hopper[l] = float(c[l]) / float(num_samples)
    return hopper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号