GateConnectivityValidator

class braket.emulation.passes.circuit_passes.gate_connectivity_validator.GateConnectivityValidator(gate_connectivity_graph, directed=True)[source]

Bases: ValidationPass

A GateConnectivityValidator instance takes in a gate connectivity graph and validates that a circuit that uses verbatim circuits makes valid hardware gate references in single and two-qubit gate operations on the corresponding edges.

Parameters:
  • gate_connectivity_graph (dict[tuple[Any, Any], Iterable[str]], DiGraph, optional) – Either a sparse matrix or DiGraph representation of the supported gates for the edges on the device.

  • directed (bool) – Denotes if the connectivity graph is directed or undirected. If the connectivity graph is undirected, this constructor attempts to fill in any missing back edges.

Raises:

ValueError – If the inputs do not correctly yield a gate connectivity graph.

validate(circuit)[source]

Verifies that any multiqubit gates used within a verbatim box are supported by the devices gate connectivity defined by this criteria.

Parameters:

circuit (Circuit | ProgramSet) – The circuit whose gate instructions need to be validated against this validator’s gate connectivity graph.

Raises:
  • ValueError if any of the gate operations use qubits or qubit edges that don't exist

  • in the qubit connectivity graph or the gate operation is not supported by the edge.

Return type:

None