Skip to content

Data Analysis and Graphs

The input to the analyzer tool is a quantum circuit in OpenQasm or Cirq format. The different analysis data and graphs can be accessed using Classiq's Python SDK After synthesizing a circuit, initialize the Analyzer class using the circuit returned from the synthesis process.

from classiq import Analyzer, Model

circuit = Model(...).synthesize()
analyzer = Analyzer(circuit=circuit)

Graphs and Data

Analysis results are organized into two categories: hardware data and logical data.

Hardware Data

Quantum circuits are more than just a beautiful image; they are meant to run on real quantum hardware to solve and supply interesting and new answers. The hardware analysis supplies the user with two main insights.

Qubit Connectivity

The qubit connectivity is your quantum circuit represented as a graph. Each node of the graph corresponds to a qubit and the node color represents the number of connections this qubit has. A connection is two or more qubits gates. The edges between nodes represent the strength of the association. The thicker an edge, the more connections the nodes (qubits) have. Each connection is a two (or more) qubit operation between these qubits.

analyzer.plot_qubits_connectivity()

An explanation is available in Qubit connection.

connectivity

Available Devices

To perform hardware-aware analysis, you may want to know which devices are available using the Classiq platform. You can get a list of the devices that are both available and suit the circuit (i.e., has a sufficient number of qubits).

analyzer.get_available_devices()

This command returns the available devices of all the providers, in dictionary format, where providers are the keys and lists of available devices are the values:

{
    "IBM Quantum": [
        "almaden",
        "boeblingen",
        "brooklyn",
        "cairo",
        "cambridge",
        "guadalupe",
        "hanoi",
        "johannesburg",
        "kolkata",
        "manhattan",
        "melbourne",
        "montreal",
        "mumbai",
        "paris",
        "poughkeepsie",
        "rochester",
        "rueschlikon",
        "singapore",
        "sydney",
        "tokyo",
        "toronto",
        "washington",
    ],
    "Azure Quantum": ["ionq", "quantinuum"],
}

You can also request the devices of a specific provider:

analyzer.get_available_devices(["IBM Quantum"])

Hardware-Circuit Connection

The Hardware-Circuit Connection graph is a representation of a circuit as implemented on a specific (physical) quantum device selected by the user. You can interactively select hardware from hardware providers such as IBM Quantum, Amazon Braket, and Microsoft Azure. The analyzer compiles the circuit for the selected hardware, This allows easy inspection of which physical qubits will be used for execution on the device and, in turn, accordingly modifying the circuit if needed. This information is important if you want to execute the circuit on real quantum hardware, so you can make any necessary modifications to the circuit.

This graph is accessible from the SDK only if you install the analyzer_adk extension with the command - pip install classiq[analyzer_sdk] and use Jupyter as your coding platform. Once the extension is installed, run this command:

# Run inside jupyter
analyzer.plot_hardware_connectivity()

connectivity

Alternatively, you can open the graph directly with a specific provider and device:

analyzer.plot_hardware_connectivity(provider="IBM Quantum", device="washington")

Hardware Comparison Table

The hardware comparison table compares the transpiled circuit on different hardware. The table includes information about the circuit depth, number of multi-qubit gates, and total number of gates.

providers = ["IBM Quantum", "Azure Quantum", "AWS Braket"]
analyzer = Analyzer(circuit=circuit)
analyzer.get_hardware_comparison_table(providers=providers)
analyzer.plot_hardware_comparison_table()

The variable providers is a list of providers ("IBM Quantum", "Azure Quantum" and "AWS Braket"), where the table includes only the backends of providers that appear in the list, and the default is to use all the providers. The table has the following form:

comparison_table

Sort the table according to the table properties using the dropdown button on the upper left of the table. ```

Note

Using the default device/providers option (all) or comparing a large number of devices might take a long time, especially when analyzing large circuits. It is advised to compare a small number of devices when you are interested in analyzing large circuits.

Resynthesize the Circuit

The analyzer support hardware-aware resynthesis. After synthesizing the circuit (without hardware specification) and comparing the fit of the circuit to the different devices, the user can resynthesize the same model with a selected device:

provider = "IBM Quantum"
device = "washington"
analyzer.optimized_hardware_resynthesize(
    device=device,
    provider=provider,
)

device and provider are the names (type: strings) of the device and provider used to resynthesize the circuit. Both can be taken from the comparison table. Alternatively, you can perform hardware-aware resynthesis optimized to a comparison property:

comparison_property = "depth"
analyzer.optimized_hardware_resynthesize(comparison_property=comparison_property)

This method performs the model resynthesis for the device with the best score regarding the comparison_property selected. comparison_property can be one of the following:

  • 'depth'
  • 'multi qubit gate count'
  • 'total gate count'

This method also accepts the devices and providers variables, similarly to get_hardware_comparison_table. If devices and providers are empty, the method uses the same devices from the table (if the table was generated).

Logical Analysis

Additional information about the circuit.

Circuit Heatmap

The heatmap is a shallower representation of the gate-level circuit image. It provides some intuition about the activity in the circuit (analogous to the classic chip design heat maps). The different gates are divided into single or multi-qubit gates (for example, two- and three-qubit gates have different colors). The following line, which can only be run in a jupyter notebook, generates the heatmap:

analyzer.plot_heatmap()

heatmap

Each row of this diagram represents a single qubit, and the columns represent

the circuit step. The color at each cell represents whether no operation is applied to the qubit, a single-qubit gate is applied, or a multi-qubit gate is applied (where the qubit is used as either target or control).

Gate Count Histogram

Histogram of the gates acts on each qubit.

histogram

[1] M. Van den Nest, W. Dur, G. Vidal, H. J. Briegel, "Classical simulation versus universality in measurement-based quantum computation", Phys. Rev. A 75, 012337 (2007).

[2] S. Oum, "Rank-width: Algorithmic and structural results", Lect. Notes Comput. Sci. 3787, 49 (2005)

[3] S. Oum, "Rank-width is Less than or Equal to Branch-Width", J. Graph Theory, 57 (3), 239-244 (2008)

[4] Hans L. Bodlaender. "Discovering Treewidth". Institute of Information and Computing Sciences, Utrecht University. Technical Report UU-CS-2005-018. http://www.cs.uu.nl