@not_implemented_for('undirected')
@not_implemented_for('multigraph')
def is_tournament(G):
 return (all((((v in G[u]) ^ (u in G[v])) for (u, v) in combinations(G, 2))) and (G.number_of_selfloops() == 0))

@ not_implemented_for ( 'undirected' ) @ not_implemented_for ( 'multigraph' ) def is_tournament ( G ) : return ( all ( ( ( ( v in G [ u ] ) ^ ( u in G [ v ] ) ) for ( u , v ) in combinations ( G , 2 ) ) ) and ( G . number_of_selfloops ( ) == 0 ) )
returns true if and only if g is a tournament .