def edge_overlap(A, B):
    """
    Compute edge overlap between two graphs (amount of shared edges).

    Args:
        A (sp.csr.csr_matrix): First input adjacency matrix.
        B (sp.csr.csr_matrix): Second input adjacency matrix.

    Returns:
        Edge overlap.
    """

    return A.multiply(B).sum() / 2