1010from pathlib import Path
1111from typing import List , Optional , Tuple
1212
13- from .exceptions import (ConfigError , GraphFormatError , InputError ,
14- NotSupportedError , SSSPXError )
13+ from .exceptions import ConfigError , GraphFormatError , InputError , NotSupportedError , SSSPXError
1514from .export import export_dag_graphml , export_dag_json
1615from .graph import Graph
1716from .io import read_graph
@@ -105,26 +104,16 @@ def main(argv: Optional[List[str]] = None) -> int:
105104 default = None ,
106105 help = "Comma-separated list of source vertex ids" ,
107106 )
108- p .add_argument (
109- "--target" , type = int , default = None , help = "Target vertex id for path output"
110- )
107+ p .add_argument ("--target" , type = int , default = None , help = "Target vertex id for path output" )
111108
112- p .add_argument (
113- "--no-transform" , action = "store_true" , help = "Disable outdegree transform"
114- )
115- p .add_argument (
116- "--target-outdeg" , type = int , default = 4 , help = "Outdegree cap when transforming"
117- )
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" )
118111 p .add_argument ("--frontier" , choices = ["block" , "heap" ], default = "block" )
119112
120113 # Profiling + export
121114 p .add_argument ("--profile" , action = "store_true" , help = "Enable cProfile" )
122- p .add_argument (
123- "--profile-out" , type = str , default = None , help = "Dump .prof file to this path"
124- )
125- p .add_argument (
126- "--export-json" , type = str , default = None , help = "Write shortest-path DAG as JSON"
127- )
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" )
128117 p .add_argument (
129118 "--export-graphml" ,
130119 type = str ,
@@ -160,9 +149,7 @@ def main(argv: Optional[List[str]] = None) -> int:
160149 )
161150
162151 stream = sys .stdout if args .log_json else sys .stderr
163- level = (
164- "info" if args .log_json and args .log_level == "warning" else args .log_level
165- )
152+ level = "info" if args .log_json and args .log_level == "warning" else args .log_level
166153 logger = StdLogger (level = level , json_fmt = args .log_json , stream = stream )
167154
168155 if args .sources is not None :
@@ -189,15 +176,11 @@ def main(argv: Optional[List[str]] = None) -> int:
189176 t0 = time .perf_counter ()
190177 if args .profile :
191178 with ProfileSession (dump_path = args .profile_out ) as prof :
192- solver = SSSPSolver (
193- G , sources [0 ], config = cfg , logger = logger , sources = sources
194- )
179+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
195180 res = solver .solve ()
196181 sys .stderr .write (prof .report ().to_text (lines = 40 ))
197182 else :
198- solver = SSSPSolver (
199- G , sources [0 ], config = cfg , logger = logger , sources = sources
200- )
183+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
201184 res = solver .solve ()
202185 wall_ms = (time .perf_counter () - t0 ) * 1000.0
203186 _ , peak = tracemalloc .get_traced_memory ()
@@ -207,15 +190,11 @@ def main(argv: Optional[List[str]] = None) -> int:
207190 t0 = time .perf_counter ()
208191 if args .profile :
209192 with ProfileSession (dump_path = args .profile_out ) as prof :
210- solver = SSSPSolver (
211- G , sources [0 ], config = cfg , logger = logger , sources = sources
212- )
193+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
213194 res = solver .solve ()
214195 sys .stderr .write (prof .report ().to_text (lines = 40 ))
215196 else :
216- solver = SSSPSolver (
217- G , sources [0 ], config = cfg , logger = logger , sources = sources
218- )
197+ solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
219198 res = solver .solve ()
220199 wall_ms = (time .perf_counter () - t0 ) * 1000.0
221200 peak_mib = None
0 commit comments