#=========================================
# 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'])
# 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 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, kuramoto_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.00001, 
                                      reporter=netevo.evo_sa_reporter)

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