Please use python to write a program to draw a network topology map

The following is the Python code: 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()

Guess you like

Origin blog.csdn.net/weixin_35751412/article/details/129500836