diff --git a/Overlap/Analysis/edgelist_to_Graphviz.py b/Overlap/Analysis/edgelist_to_Graphviz.py index b318df86e2973d3ec43bcbced6ee86f76f813f4e..a7f2991b22beb6af9e93e0bfc686d70aeea41402 100755 --- a/Overlap/Analysis/edgelist_to_Graphviz.py +++ b/Overlap/Analysis/edgelist_to_Graphviz.py @@ -1,24 +1,25 @@ #!/usr/bin/env python3 -import csv -import sys -from os import path +if __name__ == "__main__": + import csv + import sys + from os import path -import pygraphviz as pgv + import pygraphviz as pgv -import report_graph + import report_graph -if len(sys.argv) != 3: - sys.exit("Required arguments: input-edgelist output-Graphviz") + if len(sys.argv) != 3: + sys.exit("Required arguments: input-edgelist output-Graphviz") -dir_edgelist = path.dirname(sys.argv[1]) -fname = path.join(dir_edgelist, "e_overestim.txt") -with open(fname) as f_obj: e_overestim = int(f_obj.read()) -G = pgv.AGraph(directed = True) + dir_edgelist = path.dirname(sys.argv[1]) + fname = path.join(dir_edgelist, "e_overestim.txt") + with open(fname) as f_obj: e_overestim = int(f_obj.read()) + G = pgv.AGraph(directed = True) -with open(sys.argv[1], newline = '') as f: - reader = csv.reader(f, delimiter = " ", skipinitialspace = True) - for row in reader: G.add_edge(*row) + with open(sys.argv[1], newline = '') as f: + reader = csv.reader(f, delimiter = " ", skipinitialspace = True) + for row in reader: G.add_edge(*row) -report_graph.partition_graph_date(G, e_overestim) -G.write(sys.argv[2]) + report_graph.partition_graph_date(G, e_overestim) + G.write(sys.argv[2])