Note
Click here
to download the full example code
Simple Path
Draw a graph with matplotlib.
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.055 seconds)
Gallery generated by Sphinx-Gallery