wednesday.py 文件源码

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

项目:singlecell-dash 作者: czbiohub 项目源码 文件源码
def network_layout(matrix, k=30):
    nbrs = NearestNeighbors(k, algorithm='brute', metric='cosine').fit(matrix)
    G = networkx.from_scipy_sparse_matrix(nbrs.kneighbors_graph(matrix))

    node_labels = label_propagation(G, verbose=True)
    communities_labelprop = np.array([node_labels[i] for i in range(matrix.shape[0])])

    pos = graphviz_layout(G, prog="sfdp")
    coords = np.array([pos[i] for i in range(len(pos))])
    print(coords.shape)

    return coords, communities_labelprop
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号