mqt.qecc.cococo.dag_helper¶
Helper functions for DAG.
Functions¶
|
Count CX gates per DAG layer. |
|
Assumes tuples of int, and int values (i.e. agnostic of layout). |
|
Given (a subset of) terminal pairs used in TeleportationRouter translate it back to integer qubit labels using layout and transform it into its dag. |
|
Extracts a layer from the dag without assuming a layout. i.e. returns tuple[int,int] and int. |
|
Extracts a layer from the dag and translates it into a terminal pairs list depending on the given layout. |
|
This step could be avoided in principle but i do not want to change the structure of utils too much. |
Module Contents¶
- count_cx_gates_per_layer(dag: DAGCircuit) list[int][source]¶
Count CX gates per DAG layer.
If a layer has no CX layers, it is skipped.
- pairs_into_dag_agnostic(pairs: list[tuple[int, int] | int], q: int) DAGCircuit[source]¶
Assumes tuples of int, and int values (i.e. agnostic of layout).
- terminal_pairs_into_dag(terminal_pairs: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]], layout: dict[int, mqt.qecc.cococo.types.pos]) DAGCircuit[source]¶
Given (a subset of) terminal pairs used in TeleportationRouter translate it back to integer qubit labels using layout and transform it into its dag.
- Parameters:
terminal_pairs (list[tuple[pos, pos] | pos]) – A list of gates in terms where quibt labels are their positions (type pos) on the grid. ‘pos’ is a T gate and ‘tuple[pos,pos]’ a CNOT gate.
layout (dict[int, pos]) – keys are integer logical qubit labels and values are the pos values on the respective logical qubit on the grid.
- Returns:
DAG of the circuit.
- Return type:
DAGCircuit
- extract_layer_from_dag_agnostic(dag: DAGCircuit, layer: int) list[tuple[int, int] | int][source]¶
Extracts a layer from the dag without assuming a layout. i.e. returns tuple[int,int] and int.
- extract_layer_from_dag(dag: DAGCircuit, layout: dict[int, mqt.qecc.cococo.types.pos], layer: int) Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]][source]¶
Extracts a layer from the dag and translates it into a terminal pairs list depending on the given layout.
- push_remainder_into_layers_dag(dag: DAGCircuit, terminal_pairs_remainder: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]], layout: dict[int, mqt.qecc.cococo.types.pos], current_layer: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]]) tuple[list[Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]]], DAGCircuit][source]¶
This step could be avoided in principle but i do not want to change the structure of utils too much.
Take the dag, remove the very first layer and add terminal pairs remainder as operationis in front.