NetworkX

Previous topic

networkx.LabeledDiGraph.add_star

Next topic

networkx.LabeledDiGraph.add_cycle

Quick search

networkx.LabeledDiGraph.add_path

LabeledDiGraph.add_path(nlist, data=None)

Add a path.

Parameters:

nlist : list

A list of nodes. A path will be constructed from the nodes (in order) and added to the graph.

data : list or iterable, optional

Data to add to the edges in the path. The length should be one less than len(nlist).

Examples

>>> G=nx.Graph()
>>> G.add_path([0,1,2,3])
>>> G.add_path([10,11,12],data=['a','b'])