def computePrecisionCurve(predicted_edge_list, true_digraph, max_k=-1):
    """Function to calculate the precision curve
           
           Attributes:
               predicted_edge_list (list): List of predicted edges.
               true_digraph (object): original graph
               max_k(int): precision@k

            Returns:
                ndarray: precision_scores, delta_factors
    """
    if max_k == -1:
        max_k = len(predicted_edge_list)
    else:
        max_k = min(max_k, len(predicted_edge_list))
    sorted_edges = sorted(predicted_edge_list, key=lambda x: x[2], reverse=True
        )
    precision_scores = []
    delta_factors = []
    correct_edge = 0
    for i in range(max_k):
        if true_digraph.has_edge(sorted_edges[i][0], sorted_edges[i][1]):
            correct_edge += 1
            delta_factors.append(1.0)
        else:
            delta_factors.append(0.0)
        precision_scores.append(1.0 * correct_edge / (i + 1))
    return precision_scores, delta_factors
