hcNetworks.py 文件源码

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

项目:synchrony 作者: cknd 项目源码 文件源码
def inputASL(network,inputc):
    """
    Returns the average shortest path length within the input-receiving subgraph.

    Args:
        network: networkx graph
        inputc: MxN array, all nonzero positions are treated as 'input receiving'
    """
    inputnodes = [tuple(ind) for ind in np.transpose(inputc.nonzero())]
    lengths = [nx.shortest_path_length(network,src,trg) for src in inputnodes for trg in inputnodes]
    return np.mean(lengths)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号