Skip to content
Snippets Groups Projects
Commit ed1d57ee authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Choose output file name on the command line

Motivation: being able to choose a different output format at
run-time. We use the graphml format for the automated test, because
graphml is a text format, so we can compare the results of two runs.
parent 131b8d92
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
{ {
"title": "Segments", "title": "Segments",
"command": "command":
["$src_dir/segments.py", "$tests_old_dir/EGr2nd15md4/edgelist.csv"] [
"$src_dir/segments.py", "$tests_old_dir/EGr2nd15md4/edgelist.csv",
"segments.graphml"
]
} }
] ]
...@@ -14,7 +14,7 @@ import sys ...@@ -14,7 +14,7 @@ import sys
# load the edgelist file # # load the edgelist file #
########################## ##########################
if len(sys.argv) != 2: sys.exit("Required argument: edgelist-file") if len(sys.argv) != 3: sys.exit("Required arguments: input-file output-file")
t0 = time.perf_counter() t0 = time.perf_counter()
print('Loading edgelist file...') print('Loading edgelist file...')
g = graph_tool.load_graph_from_csv(sys.argv[1], g = graph_tool.load_graph_from_csv(sys.argv[1],
...@@ -77,7 +77,7 @@ t1 = time.perf_counter() ...@@ -77,7 +77,7 @@ t1 = time.perf_counter()
print(f"Done deleting in {t1 - t0:.0f} s") print(f"Done deleting in {t1 - t0:.0f} s")
t0 = t1 t0 = t1
print('Saving graph...') print('Saving graph...')
g.save('segmented.gt') g.save(sys.argv[2])
t1 = time.perf_counter() t1 = time.perf_counter()
print(f'Done saving in {t1 - t0:.0f} s.') print(f'Done saving in {t1 - t0:.0f} s.')
print("Everything is cool.") print("Everything is cool.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment