is_tournament#
- is_tournament(G)[source]#
Returns True if and only if
G
is a tournament.A tournament is a directed graph, with neither self-loops nor multi-edges, in which there is exactly one directed edge joining each pair of distinct nodes.
- Parameters:
- GNetworkX graph
A directed graph representing a tournament.
- Returns:
- bool
Whether the given graph is a tournament graph.
Notes
Some definitions require a self-loop on each node, but that is not the convention used here.
Examples
>>> from networkx.algorithms import tournament >>> G = nx.DiGraph([(0, 1), (1, 2), (2, 0)]) >>> tournament.is_tournament(G) True