简单路径#

使用matplotlib绘制图形。

plot simple path
import matplotlib.pyplot as plt
import networkx as nx

G = nx.path_graph(8)
pos = nx.spring_layout(G, seed=47)  # 设定布局种子以确保可重复性
nx.draw(G, pos=pos)
plt.show()

Total running time of the script: (0 minutes 0.021 seconds)

Gallery generated by Sphinx-Gallery