python中如何把点的关系数据转换为邻接矩阵?
关注者
12
被浏览
15,446
2 个回答
G = nx.Graph()
path = './node_node_weight.txt'
word_list = []
with open(path,'r') as f:
for line in f:
cols = line.strip().split('\t')
G.add_nodes_from([cols[0],cols[1]])