def _is_complete_graph(G):
 if (G.number_of_selfloops() > 0):
  raise nx.NetworkXError('Self loop found in _is_complete_graph()')
 n = G.number_of_nodes()
 if (n < 2):
  return True
 e = G.number_of_edges()
 max_edges = ((n * (n - 1)) / 2)
 return (e == max_edges)

def _is_complete_graph ( G ) : if ( G . number_of_selfloops ( ) > 0 ) : raise nx . NetworkXError ( 'Self loop found in _is_complete_graph()' ) n = G . number_of_nodes ( ) if ( n < 2 ) : return True e = G . number_of_edges ( ) max_edges = ( ( n * ( n - 1 ) ) / 2 ) return ( e == max_edges )
returns true if g is a complete graph .