-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_edge_file.py
37 lines (24 loc) · 884 Bytes
/
make_edge_file.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import csv
import numpy as np
# adjM = []
# with open('./data/2_hours/adjM_new.csv', 'r') as csvfile:
# csvreader = csv.reader(csvfile)
# for row in csvreader:
# adjM.append(list(map(float, row)))
# adjM = np.asarray(adjM)
# size = adjM.shape[0]
# with open('./data/2_hours/edges_new.csv', mode='w') as employee_file:
# writer = csv.writer(employee_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
# for i in range(size):
# for j in range(size):
# if (adjM[i, j] == 1 and i!=j):
# writer.writerow([str(i), str(j)])
adjM = []
with open('./data/2_hours/edges_new.csv', 'r') as csvfile:
csvreader = csv.reader(csvfile)
for row in csvreader:
adjM.append(list(map(float, row)))
adjM = np.asarray(adjM)
adjM = adjM.astype(int)
print (adjM)
print (adjM.shape)