NetworkX

Previous topic

networkx.null_graph

Next topic

networkx.star_graph

Quick search

networkx.path_graph

path_graph(n, create_using=None)

Return the Path graph P_n of n nodes linearly connected by n-1 edges.

Node labels are the integers 0 to n - 1. If create_using is a DiGraph then the edges are directed in increasing order.