qbraid.visualization.plot_conversion_graph

plot_conversion_graph(graph, title='qBraid Quantum Program Conversion Graph', legend=False, seed=None, node_size=1200, min_target_margin=18, show=True, save_path=None, colors=None)[source]

Plot the conversion graph using matplotlib. The graph is displayed using node and edge color conventions, with options for a title, legend, and figure saving.

Parameters:
  • graph (qbraid.interface.ConversionGraph) – The directed conversion graph to be plotted.

  • title (Optional[str]) – Title of the plot. Defaults to ‘qBraid Quantum Program Conversion Graph’.

  • legend (bool) – If True, display a legend on the graph. Defaults to False.

  • seed (Optional[int]) – Seed for the node layout algorithm. Useful for consistent positioning. Defaults to None.

  • node_size (int) – Size of the nodes. Defaults to 1200.

  • min_target_margin (int) – Minimum target margin for edges. Defaults to 18.

  • show (bool) – If True, display the figure. Defaults to True.

  • save_path (Optional[str]) – Path to save the figure. If None, the figure is not saved. Defaults to None.

  • colors (Optional[Dict[str, str]]) – Dictionary for node and edge colors. Expected keys are ‘qbraid_node’, ‘external_node’, ‘qbraid_edge’, ‘external_edge’. Defaults to None.

Return type:

None

Returns:

None