def add_cycle(G, nodes, **attr):
 G.add_edges_from(pairwise(nodes, cyclic=True), **attr)

def add_cycle ( G , nodes , ** attr ) : G . add_edges_from ( pairwise ( nodes , cyclic = True ) , ** attr )
add a cycle to the graph g .