def abr_step(N,E,Q):
    """Run the expectation (abr) step of the EM algorithm.
    
    This variant assumes that the true-positive and false-postive rates are global,
    namely not node-specific.
    
    Parameters
    ----------
    N : numpy.array
        The number of times that each edge has been measured (i.e., the number
        of trials or experiments in which each edge could have been observed).
    E : numpy.array
        The actual observed number of edges between every pair of nodes.
    Q : numpy.array
        The current (algorithmically generated) estimate that each edge is
        actually present. Output of q_step.
        
    Returns
    -------
    alpha : float
        The estimate of the true-positive rate.
    beta : float
        The estimate of the false-positive rate.
    rho : float
        The estimate of network density, i.e. the probability of an edge existing
        between any two nodes chosen at random.
    """
    # Step 0: establish variables
    n = E.shape[0] #the number of nodes in the network, following Newman's notation
    
    #Temporary variables to hold the numerator and denominator sums of the alpha, 
    ## beta. and rho estimates.
    anum = 0
    aden = 0
    bnum = 0
    bden = 0
    rnum = 0

    #Step 1: loop through the upper triangle of matrix Q to calculate the sums
    for j in range(1,n):
        for i in range(j):
            anum += E[i,j]*Q[i,j]
            bnum += E[i,j]*(1-Q[i,j])
            rnum += Q[i,j]
            aden += N[i,j]*Q[i,j]
            bden += N[i,j]*(1-Q[i,j])
            
    # Step 2: calculate alpha, beta, and rho
    alpha = anum*1./(aden)
    beta = bnum*1./(bden)
    rho = 2./(n*(n-1))*rnum
    
    # Step 3: return alpha, beta, and rho
    return (alpha,beta,rho)