Skip to main content
`Ctrl`+`K`

# path_graph

path_graph(n, create_using=None)

  Returns the Path graph `P_n` of linearly connected nodes.

  (`Source code`, `png`)

  Parameters:
    n int or iterable

      If an integer, nodes are 0 to n - 1. If an iterable of nodes, in the order they appear in the path. Warning: n is not checked for duplicates and if present the resulting graph may not be as desired. Make sure you have no duplicates.

    create_using NetworkX graph constructor, optional (default=nx.Graph)

      Graph type to create. If graph instance, then cleared before populated.