iqm.qrisp_iqm.passes.routing.core.vf2pp.is_identity_embedding#
- iqm.qrisp_iqm.passes.routing.core.vf2pp.is_identity_embedding(pattern_indices: ndarray, pattern_indptr: ndarray, target_indices: ndarray, target_indptr: ndarray) bool#
Check whether the pattern graph is a subgraph of the target graph.
Tests the identity mapping, i.e. whether node
iof the pattern graph can stay on nodeiof the target graph. For the layout passes this answers “does the circuit already have a valid layout?”, so circuit qubitimaps directly to physical qubiti.- Parameters:
pattern_indices (ndarray) – CSR neighbor indices of the circuit’s interaction graph, with one node per circuit qubit.
pattern_indptr (ndarray) – CSR index pointer of the circuit’s interaction graph.
target_indices (ndarray) – CSR neighbor indices of the target graph (device topology with one node per physical qubit). Neighbor lists must be sorted — the same requirement the VF2++ search makes.
target_indptr (ndarray) – CSR index pointer of the target graph.
- Returns:
Trueif every edge of the pattern graph is also an edge of the target graph between the nodes of the same indices,Falseotherwise (including when the pattern graph has more nodes than the target graph).- Return type: