def EigenvectorCentralityExperiment(G, min_target, max_target, filename):
    print nx.info(G)
    print 'average eigenvector centrality: ', UF.average_eigenvector_centrality(G)

    X_eigenvector_centrality = []
    Y_nD = []

    target = min_target
    while target <= max_target:       
        copyG = G.copy()
        new_G = SimulatedAnnealing(copyG, target, eigenvector_centrality_cost_function)
        eigenvector_centrality = UF.average_eigenvector_centrality(new_G)
        nD = SCT.controllability(new_G)

        X_eigenvector_centrality.append(eigenvector_centrality)
        Y_nD.append(nD)

        print "target = ", target, " EC = ", eigenvector_centrality, 'nD = ', nD
        
        target += 0.01

    s = 'results/' + filename
    with open(s, "w") as f:
        for i in range(len(Y_nD)):
            print >> f, "%f %f"%(X_eigenvector_centrality[i], Y_nD[i])

    return (X_eigenvector_centrality, Y_nD)
def eigenvector_centrality_cost_function(G, target):
    return math.fabs(UF.average_eigenvector_centrality(G) - target)