1010from pathlib import Path
1111from typing import List , Optional , Tuple
1212
13- from .exceptions import (
14- ConfigError ,
15- GraphFormatError ,
16- InputError ,
17- NotSupportedError ,
18- SSSPXError ,
19- )
13+ from .exceptions import ConfigError , GraphFormatError , InputError , NotSupportedError , SSSPXError
2014from .export import export_dag_graphml , export_dag_json
2115from .graph import Graph
2216from .io import read_graph
@@ -110,26 +104,16 @@ def main(argv: Optional[List[str]] = None) -> int:
110104 default = None ,
111105 help = "Comma-separated list of source vertex ids" ,
112106 )
113- p .add_argument (
114- "--target" , type = int , default = None , help = "Target vertex id for path output"
115- )
107+ p .add_argument ("--target" , type = int , default = None , help = "Target vertex id for path output" )
116108
117- p .add_argument (
118- "--no-transform" , action = "store_true" , help = "Disable outdegree transform"
119- )
120- p .add_argument (
121- "--target-outdeg" , type = int , default = 4 , help = "Outdegree cap when transforming"
122- )
109+ p .add_argument ("--no-transform" , action = "store_true" , help = "Disable outdegree transform" )
110+ p .add_argument ("--target-outdeg" , type = int , default = 4 , help = "Outdegree cap when transforming" )
123111 p .add_argument ("--frontier" , choices = ["block" , "heap" ], default = "block" )
124112
125113 # Profiling + export
126114 p .add_argument ("--profile" , action = "store_true" , help = "Enable cProfile" )
127- p .add_argument (
128- "--profile-out" , type = str , default = None , help = "Dump .prof file to this path"
129- )
130- p .add_argument (
131- "--export-json" , type = str , default = None , help = "Write shortest-path DAG as JSON"
132- )
115+ p .add_argument ("--profile-out" , type = str , default = None , help = "Dump .prof file to this path" )
116+ p .add_argument ("--export-json" , type = str , default = None , help = "Write shortest-path DAG as JSON" )
133117 p .add_argument (
134118 "--export-graphml" ,
135119 type = str ,
@@ -165,9 +149,7 @@ def main(argv: Optional[List[str]] = None) -> int:
165149 )
166150
167151 stream = sys .stdout if args .log_json else sys .stderr
168- level = (
169- "info" if args .log_json and args .log_level == "warning" else args .log_level
170- )
152+ level = "info" if args .log_json and args .log_level == "warning" else args .log_level
171153 logger = StdLogger (level = level , json_fmt = args .log_json , stream = stream )
172154
173155 if args .sources is not None :
@@ -194,15 +176,11 @@ def main(argv: Optional[List[str]] = None) -> int:
194176 t0 = time .perf_counter ()
195177 if args .profile :
196178 with ProfileSession (dump_path = args .profile_out ) as prof :
197- solver = SSSPSolver (
198- G , sources [0 ], config = cfg , logger = logger , sources = sources
199- )
179+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
200180 res = solver .solve ()
201181 sys .stderr .write (prof .report ().to_text (lines = 40 ))
202182 else :
203- solver = SSSPSolver (
204- G , sources [0 ], config = cfg , logger = logger , sources = sources
205- )
183+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
206184 res = solver .solve ()
207185 wall_ms = (time .perf_counter () - t0 ) * 1000.0
208186 _ , peak = tracemalloc .get_traced_memory ()
@@ -212,15 +190,11 @@ def main(argv: Optional[List[str]] = None) -> int:
212190 t0 = time .perf_counter ()
213191 if args .profile :
214192 with ProfileSession (dump_path = args .profile_out ) as prof :
215- solver = SSSPSolver (
216- G , sources [0 ], config = cfg , logger = logger , sources = sources
217- )
193+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
218194 res = solver .solve ()
219195 sys .stderr .write (prof .report ().to_text (lines = 40 ))
220196 else :
221- solver = SSSPSolver (
222- G , sources [0 ], config = cfg , logger = logger , sources = sources
223- )
197+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
224198 res = solver .solve ()
225199 wall_ms = (time .perf_counter () - t0 ) * 1000.0
226200 peak_mib = None
0 commit comments