From c7af969571396e387660aeac729c3cb014c47fae Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 20 Feb 2024 22:27:09 +0100 Subject: [PATCH] Write `e_overestim` to the graph-tool file So we can use the output file of `extract_component.py` as input of `draw_segments.py`, for example. --- Overlap/extract_component.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Overlap/extract_component.py b/Overlap/extract_component.py index 4452979e..46957ea3 100755 --- a/Overlap/extract_component.py +++ b/Overlap/extract_component.py @@ -11,6 +11,7 @@ each vertex of the graph. import csv import pathlib import sys +from os import path import graph_tool from graph_tool import topology @@ -32,6 +33,12 @@ if input_suffix == ".csv": hash_type="int", csv_options = {'delimiter': ' ', 'skipinitialspace': True}) + dir_edgelist = path.dirname(sys.argv[1]) + e_overestim_file = path.join(dir_edgelist, "e_overestim.txt") + g.graph_properties["e_overestim"] = g.new_graph_property("int") + + with open(e_overestim_file) as f_obj: + g.graph_properties["e_overestim"] = int(f_obj.read()) else: # assert input_suffix in {".gt", ".graphml"} g = graph_tool.load_graph(sys.argv[1]) -- GitLab