Simple Path#

Draw a graph with 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)  # Seed layout for reproducibility
nx.draw(G, pos=pos)
plt.show()

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

Gallery generated by Sphinx-Gallery