You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

graph_generator.py 616B

123456789101112131415161718
  1. import networkx as nx
  2. import scipy.io
  3. import numpy as np
  4. graphs = []
  5. indexes = [(3, 4)]
  6. for tupp in indexes:
  7. graphs.append(nx.grid_2d_graph(tupp[0], tupp[1]))
  8. for g in range(len(indexes)):
  9. curr_graph = nx.to_numpy_array(graphs[g])
  10. curr_graph_att = np.ones((len(curr_graph), 60))
  11. scipy.io.savemat('produced_graphs/testgraph_{}_{}__.txt.mat'.format(indexes[g][0], indexes[g][1], g),
  12. {'data': curr_graph})
  13. scipy.io.savemat('produced_graphs/testgraph_{}_{}__.usr.mat'.format(indexes[g][0], indexes[g][1], g),
  14. {'attributes': curr_graph_att})
  15. print(graphs)