is_tournament#
- graph_tool.structure.is_tournament(g)[git][source]#
Check whether a directed graph is a tournament.
- Parameters:
- g
Graph Directed graph.
- g
- Returns:
- tournament
bool Trueif there is exactly one edge between every pair of distinct vertices, and no self-loops.
- tournament
See also
tournament_hamiltonian_pathHamiltonian path of a tournament
graph_tool.generation.generate_tournamentRandom tournament
Notes
A tournament is an orientation of a complete graph, i.e. a directed graph without self-loops in which every pair of distinct vertices is joined by exactly one edge, in one of the two directions. Its score sequence is given by the out-degrees. The time is \(O(V + E)\).
Examples
>>> g = gt.Graph([(i, j) if (i + j) % 2 else (j, i) ... for i in range(6) for j in range(i + 1, 6)]) >>> print(gt.is_tournament(g)) True