def f1(true_edges, estimated_edges):
    """Given a list of true and estimed edges, return f1."""
    tp = sum(1.0 for edge in estimated_edges if edge in true_edges)
    fp = len(estimated_edges) - tp
    fn = sum(1.0 for edge in true_edges if edge not in estimated_edges)
    return 2 * tp / (2 * tp + fp + fn)