5.2.6. networkx.generators.classic.cycle_graph

networkx.generators.classic.cycle_graph(n, create_using=None)[source]

Return the cycle graph C_n of cyclicly connected nodes.

C_n is a path with its two end-nodes connected.

Parameters:

n : int or iterable container of nodes

If n is an integer, nodes are from range(n). If n is a container of nodes, those nodes appear in the graph.

create_using : Graph, optional (default Graph())

If provided this graph is cleared of nodes and edges and filled with the new graph. Usually used to set the type of the graph.

Notes

If create_using is directed, the direction is in increasing order.