iqm.qrisp_iqm.passes.routing.core.vf2pp.vf2pp_subgraph_isomorphism#
- iqm.qrisp_iqm.passes.routing.core.vf2pp.vf2pp_subgraph_isomorphism(pattern_indices: ndarray, pattern_indptr: ndarray, target_indices: ndarray, target_indptr: ndarray, max_attempts: int = 0) ndarray#
Find one subgraph isomorphism mapping from pattern graph to target.
Uses a Numba-optimized VF2++-style search.
The first pattern node’s candidates are explored in parallel across CPU cores, each thread with its own budget slice.
- Parameters:
pattern_indices (ndarray) – CSR column indices of the pattern graph.
pattern_indptr (ndarray) – CSR row pointers of the pattern graph.
target_indices (ndarray) – CSR column indices of the target graph. Neighbor lists must be sorted for binary search to work.
target_indptr (ndarray) – CSR row pointers of the target graph.
max_attempts (int) – Total maximum number of feasible candidate assignments to try (split equally across parallel threads) before giving up. 0 (default) means unlimited.
- Returns:
mapping[i]is the target node matched to pattern nodei. If no mapping is found, returns an array of all -1. If the identity mapping is itself an embedding it is always the one returned, so a pattern that already sits on the target is left where it is.- Return type: