@@ -280,18 +280,22 @@ def _generate_plot_content(self, plot, is_report_static, static_dir: str = STATI
280280 else :
281281 plot_content .append (f"""fig_altair\n ```\n """ )
282282 elif plot .plot_type == r .PlotType .INTERACTIVE_NETWORK :
283- G = plot .read_network ()
284- num_nodes = G .number_of_nodes ()
285- num_edges = G .number_of_edges ()
286- plot_content .append (f'**Number of nodes:** { num_nodes } \n ' )
287- plot_content .append (f'**Number of edges:** { num_edges } \n ' )
288-
283+ network_data = plot .read_network ()
289284 if is_report_static :
290285 plot .save_netwrok_image (G , static_plot_path , "png" )
291286 plot_content .append (self ._generate_image_content (static_plot_path ))
292287 else :
293- # Get the Network object
294- net = plot .create_and_save_pyvis_network (G , html_plot_file )
288+ if isinstance (network_data , str ) and network_data .endswith ('.html' ):
289+ # If network_data is the path to an HTML file, just visualize it
290+ html_plot_file = network_data
291+ else :
292+ num_nodes = network_data .number_of_nodes ()
293+ num_edges = network_data .number_of_edges ()
294+ plot_content .append (f'**Number of nodes:** { num_nodes } \n ' )
295+ plot_content .append (f'**Number of edges:** { num_edges } \n ' )
296+ # Get the Network object
297+ net = plot .create_and_save_pyvis_network (network_data , html_plot_file )
298+
295299 plot_content .append (self ._generate_plot_code (plot , html_plot_file ))
296300 else :
297301 self .report .logger .warning (f"Unsupported plot type: { plot .plot_type } " )
0 commit comments