Python如何根据邻接矩阵计算邻接表 看到大佬写的,只是记录一下。 数据保存到字典里面。 A_dict={i: np.nonzero(row)[0].tolist() for i, row in enumerate(A)} 链接: link