@@ -284,9 +284,9 @@ def format_graph(G):
284284 node_size = 300 # This is networkx's default
285285
286286 graph_layout = G .graph_layout if hasattr (G , "graph_layout" ) else None
287- vertex_labeling = G .vertex_labeling if hasattr (G , "vertex_labeling " ) else False
288- if vertex_labeling :
289- vertex_labeling = vertex_labeling .to_python () or False
287+ vertex_labels = G .vertex_labels if hasattr (G , "vertex_labels " ) else False
288+ if vertex_labels :
289+ vertex_labels = vertex_labels .to_python () or False
290290
291291 if hasattr (G , "title" ) and G .title .get_string_value ():
292292 fig , ax = plt .subplots () # Create a figure and an axes
@@ -299,9 +299,23 @@ def format_graph(G):
299299 else :
300300 layout_fn = None
301301
302+ options = {
303+ # "font_size": 36,
304+ "node_size" : node_size ,
305+ # "node_color": "white", # Set below
306+ # "edgecolors": "black", # Set below
307+ # "linewidths": 5,
308+ # "width": 5,
309+ "with_labels" : vertex_labels ,
310+ }
311+
312+ if vertex_labels :
313+ options ["node_color" ] = "white"
314+ options ["edgecolors" ] = "black"
315+
302316 if layout_fn :
303- nx .draw (G , pos = layout_fn (G ), with_labels = vertex_labeling , node_size = node_size )
317+ nx .draw (G , pos = layout_fn (G ), ** options )
304318 else :
305- nx .draw_shell (G , with_labels = vertex_labeling , node_size = node_size )
319+ nx .draw_shell (G , ** options )
306320 plt .show ()
307321 return None
0 commit comments