From 2e2762acfc7eadfaed583329d5a72501376f0c5b Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 2 Jan 2024 16:47:41 +0100 Subject: [PATCH] Polish --- Overlap/extract_component.py | 3 +-- Trajectories/draw_segments.py | 9 +++++---- Trajectories/segments.py | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Overlap/extract_component.py b/Overlap/extract_component.py index 3fbae67a..957573b4 100755 --- a/Overlap/extract_component.py +++ b/Overlap/extract_component.py @@ -34,13 +34,12 @@ else: # assert input_suffix in {".gt", ".graphml"} g = graph_tool.load_graph(sys.argv[1]) -g.set_directed(False) - for v in g.vertices(): if g.vp.name[v] == int(sys.argv[2]): break else: sys.exit("Node not found") +g.set_directed(False) label = topology.label_out_component(g, v) g.set_vertex_filter(label) g.purge_vertices() diff --git a/Trajectories/draw_segments.py b/Trajectories/draw_segments.py index 1be68917..9a9c6715 100755 --- a/Trajectories/draw_segments.py +++ b/Trajectories/draw_segments.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 """This script reads a graph of segments in graph-tool or graphml -format and creates the corresponding Graphviz file. If the graph has -cost values then the edges are labeled with them. If the option -t is -given then the label of each node tells which trajectory the segment -belongs to. +format and creates the corresponding Graphviz file. The node label is +the segment identifying number followed by the date index in +parentheses. If the graph has cost values then the edges are labeled +with them. If the option -t is given then the label of each node also +tells which trajectory the segment belongs to. """ diff --git a/Trajectories/segments.py b/Trajectories/segments.py index ca27e43c..a19d46de 100755 --- a/Trajectories/segments.py +++ b/Trajectories/segments.py @@ -43,7 +43,8 @@ t0 = t1 # e_overestim is not used in this script but it is useful to save it # to the output graph of this script for further processing of the -# output graph by other scripts: +# output graph by other scripts. We assume that e_overestim.txt is in +# the same directory as the input edgelist: g.graph_properties["e_overestim"] = g.new_graph_property("int") dir_edgelist = path.dirname(sys.argv[1]) -- GitLab