

def add_cycle(self, nodes, **attr):
    'Add a cycle.\n\n        Parameters\n        ----------\n        nodes: iterable container\n            A container of nodes.  A cycle will be constructed from\n            the nodes (in order) and added to the graph.\n        attr : keyword arguments, optional (default= no attributes)\n            Attributes to add to every edge in cycle.\n\n        See Also\n        --------\n        add_path, add_star\n\n        Examples\n        --------\n        >>> G=nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_cycle([0,1,2,3])\n        >>> G.add_cycle([10,11,12],weight=7)\n\n        '
    nlist = list(nodes)
    edges = zip(nlist, (nlist[1:] + [nlist[0]]))
    self.add_edges_from(self, **attr)

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.add_cycle/VarMisuse@50/273 `edges`->`self`