1234567891011121314151617 |
- import networkx as nx
- import scipy.io
- import numpy as np
-
- graphs = []
- indexes = [(3,4)]
- for tupp in indexes:
- graphs.append(nx.grid_2d_graph(tupp[0], tupp[1]))
-
-
- for g in range(len(indexes)):
- curr_graph = nx.to_numpy_array(graphs[g])
- curr_graph_att = np.ones((len(curr_graph), 60))
- scipy.io.savemat('produced_graphs/testgraph_{}_{}__.txt.mat'.format(indexes[g][0], indexes[g][1], g), {'data': curr_graph})
- scipy.io.savemat('produced_graphs/testgraph_{}_{}__.usr.mat'.format(indexes[g][0], indexes[g][1], g), {'attributes': curr_graph_att})
-
- print(graphs)
|