schcc.py 文件源码

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

项目:pyconnectome 作者: neurospin 项目源码 文件源码
def create_graph(connectome, labels):
    """ Create a graph structure from the connectome matrix.

    Parameters
    ----------
    connectome: array (N, N)
        a matrix representing the structural connections.
    labels: list of str (N,)
        the labels used to create the connectome matrix.

    Returns
    -------
    graph: Graph
        a graph structure.
    """
    graph = nx.from_numpy_matrix(connectome)
    for index, name in enumerate(labels):
        name = name.rstrip("\n")
        graph.node[index] = {"label": name}
    return graph
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号