def turan_graph(n, r):
 if (not (1 <= r <= n)):
  raise nx.NetworkXError('Must satisfy 1 <= r <= n')
 partitions = (([(n // r)] * (r - (n % r))) + ([((n // r) + 1)] * (n % r)))
 G = complete_multipartite_graph(*partitions)
 G.name = 'turan_graph({},{})'.format(n, r)
 return G

def turan_graph ( n , r ) : if ( not ( 1 <= r <= n ) ) : raise nx . NetworkXError ( 'Must satisfy 1 <= r <= n' ) partitions = ( ( [ ( n // r ) ] * ( r - ( n % r ) ) ) + ( [ ( ( n // r ) + 1 ) ] * ( n % r ) ) ) G = complete_multipartite_graph ( * partitions ) G . name = 'turan_graph({},{})' . format ( n , r ) return G
return the turan graph the turan graph is a complete multipartite graph on n vertices with r disjoint subsets .