def buildNeighbors(user_commonViewings):
    """
    Extracts the list of neighbors of each user from the commonViewings matrix
    :param user_commonViewings: Matrix indicating the number of common viewed films for each two users, as returned by
                                buildUsersGraph()
    :return: A list of lists, indicating for each user his neighbors in the graph, ie the users which have at least one
    film in common with him
    Note : can be used in the same way for the films point of view based model
    """
    nU = user_commonViewings.shape[0]
    neighbors = []
    for ui in range(nU):
        n = []
        for uj in range(nU):
            if user_commonViewings[ui, uj] > 0:
                n.append(uj)
        neighbors.append(n)
    return neighbors