def get_weights_order(graph, nodes=atlas_rois):
"returns weights in the order of nodes requested"
# order is not guaranteed below
edge_dict = nx.get_edge_attributes(graph, 'weight')
# so ordering it here, to ensure correspondence across subjects
weights = [ graph[x][y]['weight'] for x in nodes for y in nodes if (x,y) in edge_dict ]
return np.array(weights)
评论列表
文章目录