def calculate_epsilon_effective(rho, epsilon, seed_degree, neighbor_degrees, mean_degree):
    """
    Semi-automatic effective epsilon threshold calculation.
    """
    # Calculate a weighted neighborhood degree average.
    # neighborhood_degree = rho*seed_degree + (1-rho)*neighbor_degrees.mean()
    neighborhood_degree = neighbor_degrees.mean()

    # Calculate the seed neighborhood normalized effective epsilon.
    epsilon_effective = (epsilon*np.log(1 + seed_degree))/np.log(1 + neighborhood_degree)

    # Calculate the maximum epsilon for at least one push on a neighboring node.
    # Also the minimum epsilon for a push on all the neighboring nodes.
    epsilon_effective_maximum = np.max(1/(seed_degree*neighbor_degrees))
    epsilon_effective_minimum = np.min(1/(seed_degree*neighbor_degrees))

    # print(epsilon_effective, epsilon_effective_maximum, epsilon_effective_minimum)

    # The maximum epsilon is absolute, whereas we regularize for the minimum.
    if epsilon_effective > epsilon_effective_maximum:
        epsilon_effective = epsilon_effective_maximum
    elif epsilon_effective < epsilon_effective_minimum:
        epsilon_effective = (epsilon_effective_minimum + epsilon_effective)/2

    return epsilon_effective
def calculate_epsilon_effective ( rho , epsilon , seed_degree , neighbor_degrees , mean_degree ) : neighborhood_degree = neighbor_degrees . mean ( ) epsilon_effective = ( epsilon * np . log ( 1 + seed_degree ) ) / np . log ( 1 + neighborhood_degree ) epsilon_effective_maximum = np . max ( 1 / ( seed_degree * neighbor_degrees ) ) epsilon_effective_minimum = np . min ( 1 / ( seed_degree * neighbor_degrees ) ) if epsilon_effective > epsilon_effective_maximum : epsilon_effective = epsilon_effective_maximum elif epsilon_effective < epsilon_effective_minimum : epsilon_effective = ( epsilon_effective_minimum + epsilon_effective ) / 2 return epsilon_effective
Semi-automatic effective epsilon threshold calculation.