@@ -269,9 +269,11 @@ def tree_layout(G):
269269 node_size = min_sep * 2000
270270 return pos
271271
272+
272273def spiral_equidistant_layout (G , * args , ** kwargs ):
273274 return nx .spiral_layout (G , equidistant = True , * args , ** kwargs )
274275
276+
275277NETWORKX_LAYOUTS = {
276278 "circular" : nx .circular_layout ,
277279 "multipartite" : nx .multipartite_layout ,
@@ -285,11 +287,8 @@ def spiral_equidistant_layout(G, *args, **kwargs):
285287 "tree" : tree_layout ,
286288}
287289
288- LAYOUT_DENSITY_EXPONENT = {
289- "circular" : 0.9 ,
290- "spiral_equidistant" : 0.7 ,
291- "spiral" : 0.6 ,
292- }
290+ LAYOUT_DENSITY_EXPONENT = {"circular" : 0.9 , "spiral_equidistant" : 0.7 , "spiral" : 0.6 }
291+
293292
294293def clamp (value , min = - math .inf , max = math .inf ):
295294 if value <= min :
@@ -315,7 +314,9 @@ def harmonize_parameters(G, draw_options: dict):
315314 draw_options ["node_size" ] = node_size
316315 elif graph_layout in ["circular" , "spiral" , "spiral_equidistant" ]:
317316 exponent = LAYOUT_DENSITY_EXPONENT [graph_layout ]
318- node_size = draw_options ["node_size" ] = (2 * DEFAULT_NODE_SIZE ) / (len (G )+ 1 ) ** exponent
317+ node_size = draw_options ["node_size" ] = (2 * DEFAULT_NODE_SIZE ) / (
318+ len (G ) + 1
319+ ) ** exponent
319320 # print("XX", node_size, exponent)
320321
321322 if draw_options .get ("with_labels" , False ):
@@ -325,6 +326,8 @@ def harmonize_parameters(G, draw_options: dict):
325326 if "width" not in draw_options :
326327 width = clamp (node_size / DEFAULT_NODE_SIZE , min = 0.15 )
327328 draw_options ["width" ] = width
329+ print ("width" , draw_options ["width" ])
330+ print ("graph_layout" , graph_layout )
328331
329332 if "font_size" not in draw_options :
330333 # FIXME: should also take into consideration max width of label.
0 commit comments