python读取txt文件存为邻接矩阵
python读取txt文件存为邻接矩阵
import numpy as np
def getdata(filename):
linedata = open("socfb-Amherst41.txt", 'r') #读取txt文件
cnt = 0
res = [] #存读取后的数据,二元列表
n = 2235
matrix = np.zeros((n, n))
for line in linedata:
linelist =
原创
2020-11-19 23:46:55 ·
2292 阅读 ·
4 评论