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, edge_labels=False, experiment_type=None, target_nodes=None, **kwargs)[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 (ConversionGraph) – The directed conversion graph to be plotted.

  • title (str, optional) – 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 (int, optional) – 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 (str, optional) – Path to save the figure. If None, the figure is not saved. Defaults to None.

  • colors (dict[str, str], optional) – Node and edge colors with keys ‘target_node_outline’, ‘qbraid_node’, ‘external_node’, ‘qbraid_edge’, ‘external_edge’. Defaults to None.

  • edge_labels (bool) – If True, display edge weights as labels. Defaults to False.

  • experiment_type (Union[ExperimentType, Iterable[ExperimentType]], optional) – Filter the graph by experiment type. Defaults to None, meaning all experiment types are included.

  • target_nodes (Iterable[str], optional) – Nodes to be outlined in the plot. Defaults to None.

Return type:

None

Returns:

None