def graph_delta_values(y, edge_weights):
    """ Computes delta values from an arbitrary graph as in the objective
    function of GSFA. The feature vectors are not normalized to weighted
    unit variance or weighted zero mean.
    """
    R = 0
    deltas = 0
    for i, j in edge_weights.keys():
        w_ij = edge_weights[i, j]
        deltas += w_ij * (y[j] - y[i]) ** 2
        R += w_ij
    return deltas / R
