1010from pathlib import Path
1111from typing import List , Optional , Tuple
1212
13- from .exceptions import ConfigError , GraphFormatError , InputError , NotSupportedError , SSSPXError
13+ from .exceptions import (ConfigError , GraphFormatError , InputError ,
14+ NotSupportedError , SSSPXError )
1415from .export import export_dag_graphml , export_dag_json
1516from .graph import Graph
1617from .io import read_graph
@@ -104,16 +105,26 @@ def main(argv: Optional[List[str]] = None) -> int:
104105 default = None ,
105106 help = "Comma-separated list of source vertex ids" ,
106107 )
107- p .add_argument ("--target" , type = int , default = None , help = "Target vertex id for path output" )
108+ p .add_argument (
109+ "--target" , type = int , default = None , help = "Target vertex id for path output"
110+ )
108111
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" )
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+ )
111118 p .add_argument ("--frontier" , choices = ["block" , "heap" ], default = "block" )
112119
113120 # Profiling + export
114121 p .add_argument ("--profile" , action = "store_true" , help = "Enable cProfile" )
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" )
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+ )
117128 p .add_argument (
118129 "--export-graphml" ,
119130 type = str ,
@@ -149,7 +160,9 @@ def main(argv: Optional[List[str]] = None) -> int:
149160 )
150161
151162 stream = sys .stdout if args .log_json else sys .stderr
152- level = "info" if args .log_json and args .log_level == "warning" else args .log_level
163+ level = (
164+ "info" if args .log_json and args .log_level == "warning" else args .log_level
165+ )
153166 logger = StdLogger (level = level , json_fmt = args .log_json , stream = stream )
154167
155168 if args .sources is not None :
@@ -176,11 +189,15 @@ def main(argv: Optional[List[str]] = None) -> int:
176189 t0 = time .perf_counter ()
177190 if args .profile :
178191 with ProfileSession (dump_path = args .profile_out ) as prof :
179- solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
192+ solver = SSSPSolver (
193+ G , sources [0 ], config = cfg , logger = logger , sources = sources
194+ )
180195 res = solver .solve ()
181196 sys .stderr .write (prof .report ().to_text (lines = 40 ))
182197 else :
183- solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
198+ solver = SSSPSolver (
199+ G , sources [0 ], config = cfg , logger = logger , sources = sources
200+ )
184201 res = solver .solve ()
185202 wall_ms = (time .perf_counter () - t0 ) * 1000.0
186203 _ , peak = tracemalloc .get_traced_memory ()
@@ -190,11 +207,15 @@ def main(argv: Optional[List[str]] = None) -> int:
190207 t0 = time .perf_counter ()
191208 if args .profile :
192209 with ProfileSession (dump_path = args .profile_out ) as prof :
193- solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
210+ solver = SSSPSolver (
211+ G , sources [0 ], config = cfg , logger = logger , sources = sources
212+ )
194213 res = solver .solve ()
195214 sys .stderr .write (prof .report ().to_text (lines = 40 ))
196215 else :
197- solver = SSSPSolver (G , sources [0 ], config = cfg , logger = logger , sources = sources )
216+ solver = SSSPSolver (
217+ G , sources [0 ], config = cfg , logger = logger , sources = sources
218+ )
198219 res = solver .solve ()
199220 wall_ms = (time .perf_counter () - t0 ) * 1000.0
200221 peak_mib = None
0 commit comments