`#参考:https://blog.csdn.net/weixin_42052081/article/details/89108966 import numpy as np import networkx as nx import matplotlib.pyplot as plt from networkx import to_numpy_matrix #首先使用numpy编写有向图的邻接矩阵表征 A=np.matrix([[0,1,0,0],[0,0,1,1],[0,1,0,0],[1,0,1…