path_graph#
- path_graph(n, create_using=None)[source]#
Returns the Path graph
P_n
of linearly connected nodes.(
Source code
,png
)- Parameters:
- nint 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_usingNetworkX graph constructor, optional (default=nx.Graph)
Graph type to create. If graph instance, then cleared before populated.
Additional backends implement this function
cugraph : GPU-accelerated backend.