qbraid.transpiler.ConversionScheme
- class ConversionScheme(conversion_graph=None, max_path_attempts=3, max_path_depth=None, extra_kwargs=<factory>)[source]
A data class for managing conversion configurations for quantum device operations.
- conversion_graph
Graph coordinating conversions between different quantum software program types. If None, the default qBraid graph is used.
- Type:
Optional[ConversionGraph]
- max_path_attempts
The maximum number of conversion paths to attempt before raising an exception. Defaults to 3.
- Type:
int
- max_path_depth
The maximum depth of conversions within a given path to allow. A depth of 2 would allow a conversion path like [‘cirq’ -> ‘qasm2’ -> ‘qiskit’]. Defaults to None, meaning no limit.
- Type:
Optional[int]
- extra_kwargs
A dictionary to hold any additional keyword arguments that users want to pass to the transpile function at runtime.
- Type:
dict[str, Any]
- to_dict()[source]
Converts the conversion scheme to a flat dictionary suitable for passing as kwargs.
- __init__(conversion_graph=None, max_path_attempts=3, max_path_depth=None, extra_kwargs=<factory>)
Methods
__init__
([conversion_graph, ...])find_nodes_reachable_within_max_edges
(graph, ...)Find all nodes reachable from a target node within a specified number of edges.
to_dict
()Convert the ConversionScheme fields to a flat dictionary suitable for passing as kwargs.
update_graph_for_target
(target_spec)Update the conversion graph to include only nodes with paths to the target node(s), and remove all conversions that do not end in the target node(s).
update_values
(**kwargs)Updates the attributes of the conversion scheme with new values provided as keyword arguments.
Attributes