def warshall_adjacency(matrix):
    """Applies the Warshall transitive closure algorithm to a adjacency matrix.

    Args:
        matrix: The adjacency matrix.

    Returns:
        The closed form of the adjacency matrix.
    """
    for k in range(0, len(matrix)):
        for i in range(0, len(matrix)):
            if matrix[i][k] == 1:
                for j in range(0, len(matrix[0])):
                    if matrix[k][j] == 1:
                        matrix[i][j] = 1
    return matrix