#=========================================
# CREATE THE NETWORK
#=========================================

# Create a random undirected graph and check valid (n=50, m=100)
n = 20
G = []
while True:
    G = nx.gnm_random_graph(n, 2*n)
    if nx.is_connected(G):
        break

# No dynamics are required
G.graph['node_dyn'] = True
G.graph['edge_dyn'] = False

netevo.set_all_node_dynamics(G, rossler_node_dyn)

#=========================================
# EVOLVE THE NETWORK
#=========================================

# Perform the evolution (using simulated dynamics as part of the performance measure)
iteration, G_final = netevo.evolve_sa(G, order_parameter, rewire, 
                                      initial_temp=100.0, min_temp=0.0001, 
                                      reporter=netevo.evo_sa_reporter)

# Output GML files containing the initial and final toplogies (viewable in Cytoscape/yEd)
netevo.write_to_file(G, 'evolution_sa_dyn_initial.gml')
netevo.write_to_file(G_final, 'evolution_sa_dyn_final.gml', node_keys=['state'])
        return float('inf')

#=========================================
# CREATE THE NETWORK
#=========================================

# Create a random undirected graph and check valid (n=50, m=100)
n = 50
G = []
while True:
    G = nx.gnm_random_graph(n, 2*n)
    if eigenratio(G) != float('inf'):
        break

# No dynamics are required
G.graph['node_dyn'] = False
G.graph['edge_dyn'] = False

#=========================================
# EVOLVE THE NETWORK
#=========================================

# Perform the evolution
iteration, G_final = netevo.evolve_sa(G, eigenratio, rewire, 
                                      initial_temp=100.0, min_temp=0.0000001, 
                                      reporter=netevo.evo_sa_reporter)

# Output GML files containing the initial and final toplogies
netevo.write_to_file(G, 'evolution_sa_initial.gml')
netevo.write_to_file(G_final, 'evolution_sa_final.gml')