@nodes_or_number(0)
def complete_graph(n, create_using=None):
 (n_name, nodes) = n
 G = empty_graph(n_name, create_using)
 G.name = ('complete_graph(%s)' % (n_name,))
 if (len(nodes) > 1):
  if G.is_directed():
   edges = itertools.permutations(nodes, 2)
  else:
   edges = itertools.combinations(nodes, 2)
  G.add_edges_from(edges)
 return G

@ nodes_or_number ( 0 ) def complete_graph ( n , create_using = None ) : ( n_name , nodes ) = n G = empty_graph ( n_name , create_using ) G . name = ( 'complete_graph(%s)' % ( n_name , ) ) if ( len ( nodes ) > 1 ) : if G . is_directed ( ) : edges = itertools . permutations ( nodes , 2 ) else : edges = itertools . combinations ( nodes , 2 ) G . add_edges_from ( edges ) return G
return the complete graph k_n with n nodes .