NetworkX

Previous topic

networkx.LabeledGraph.add_path

Next topic

networkx.LabeledGraph.clear

Quick search

networkx.LabeledGraph.add_cycle

LabeledGraph.add_cycle(nlist, data=None)

Add a cycle.

Parameters:

nlist : list

A list of nodes. A cycle 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 the same as nlist.

Examples

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