def ladder_graph(n, create_using=None):
 if ((create_using is not None) and create_using.is_directed()):
  raise nx.NetworkXError('Directed Graph not supported')
 G = empty_graph((2 * n), create_using)
 G.name = ('ladder_graph_(%d)' % n)
 G.add_edges_from(pairwise(range(n)))
 G.add_edges_from(pairwise(range(n, (2 * n))))
 G.add_edges_from(((v, (v + n)) for v in range(n)))
 return G

def ladder_graph ( n , create_using = None ) : if ( ( create_using is not None ) and create_using . is_directed ( ) ) : raise nx . NetworkXError ( 'Directed Graph not supported' ) G = empty_graph ( ( 2 * n ) , create_using ) G . name = ( 'ladder_graph_(%d)' % n ) G . add_edges_from ( pairwise ( range ( n ) ) ) G . add_edges_from ( pairwise ( range ( n , ( 2 * n ) ) ) ) G . add_edges_from ( ( ( v , ( v + n ) ) for v in range ( n ) ) ) return G
return the ladder graph of length n .