以下为Python代码:
import networkx as nx
import matplotlib.pyplot as pltG = nx.Graph() G.add_nodes_from([1,2,3,4,5]) G.add_edges_from([(1,2),(1,3),(2,4),(3,4),(3,5),(4,5)]) nx.draw(G, with_labels=True) plt.show()
文章标签 python 绘制拓扑图 python matplotlib 开发语言 Python 文章分类 Python 后端开发
import networkx as nx
import matplotlib.pyplot as pltG = nx.Graph() G.add_nodes_from([1,2,3,4,5]) G.add_edges_from([(1,2),(1,3),(2,4),(3,4),(3,5),(4,5)]) nx.draw(G, with_labels=True) plt.show()
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M