forked from DanielBres45/MLSTP-branch_and_bound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.py
34 lines (21 loc) · 772 Bytes
/
convert.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
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 5 17:13:12 2022
@author: Daniel
"""
import csv
import os
if __name__ == "__main__":
for i in range(5):
graph = [[0,0]]
with open(os.path.join(os.getcwd(), "Instances", "out_file{}_answers.csv").format(i), 'r') as f:
reader = csv.reader(f)
for v, vertex_list in enumerate(reader):
graph[0][0] += 1
for edge in vertex_list:
graph[0][1] += 1
graph.append([v, edge])
print(graph)
with open("Hard.out", 'a', newline='') as f:
writer = csv.writer(f)
writer.writerows(graph)