def random_tournament(n):
 coins = (random.random() for i in range(((n * (n - 1)) // 2)))
 pairs = combinations(range(n), 2)
 edges = (((u, v) if (r < 0.5) else (v, u)) for ((u, v), r) in zip(pairs, coins))
 return nx.DiGraph(edges)

def random_tournament ( n ) : coins = ( random . random ( ) for i in range ( ( ( n * ( n - 1 ) ) // 2 ) ) ) pairs = combinations ( range ( n ) , 2 ) edges = ( ( ( u , v ) if ( r < 0.5 ) else ( v , u ) ) for ( ( u , v ) , r ) in zip ( pairs , coins ) ) return nx . DiGraph ( edges )
returns a random tournament graph on n nodes .