Return a random tournament graph [1]_ with n nodes.

    Parameters
    ----------
    n : scalar(int)
        Number of nodes.

    random_state : int or np.random.RandomState, optional
        Random seed (integer) or np.random.RandomState instance to set
        the initial state of the random number generator for
        reproducibility. If None, a randomly initialized RandomState is
        used.

    Returns
    -------
    DiGraph
        A DiGraph representing the tournament graph.

    References
    ----------
    .. [1] `Tournament (graph theory)
       <https://en.wikipedia.org/wiki/Tournament_(graph_theory)>`_,
       Wikipedia.

def random_tournament_graph(n, random_state=None):
    """
    Return a random tournament graph [1]_ with n nodes.

    Parameters
    ----------
    n : scalar(int)
        Number of nodes.

    random_state : int or np.random.RandomState, optional
        Random seed (integer) or np.random.RandomState instance to set
        the initial state of the random number generator for
        reproducibility. If None, a randomly initialized RandomState is
        used.

    Returns
    -------
    DiGraph
        A DiGraph representing the tournament graph.

    References
    ----------
    .. [1] `Tournament (graph theory)
       <https://en.wikipedia.org/wiki/Tournament_(graph_theory)>`_,
       Wikipedia.

    """
    random_state = check_random_state(random_state)
    num_edges = n * (n-1) // 2
    r = random_state.random_sample(num_edges)
    row = np.empty(num_edges, dtype=int)
    col = np.empty(num_edges, dtype=int)
    _populate_random_tournament_row_col(n, r, row, col)
    data = np.ones(num_edges, dtype=bool)
    adj_matrix = sparse.coo_matrix((data, (row, col)), shape=(n, n))
    return DiGraph(adj_matrix)