def caveman_graph(l, k):
 G = nx.empty_graph((l * k))
 G.name = ('caveman_graph(%s,%s)' % ((l * k), k))
 if (k > 1):
  for start in range(0, (l * k), k):
   edges = itertools.combinations(range(start, (start + k)), 2)
   G.add_edges_from(edges)
 return G

def caveman_graph ( l , k ) : G = nx . empty_graph ( ( l * k ) ) G . name = ( 'caveman_graph(%s,%s)' % ( ( l * k ) , k ) ) if ( k > 1 ) : for start in range ( 0 , ( l * k ) , k ) : edges = itertools . combinations ( range ( start , ( start + k ) ) , 2 ) G . add_edges_from ( edges ) return G
returns a caveman graph of l cliques of size k .