two_color_mapper#
- iqm.qaoa.transpiler.sparse.two_color_mapper.two_color_mapper(problem_bqm, qpu)[source]#
Finds an initial mapping between logical and hardware qubits.
The mapping is constructed so that almost all interactions of two colors of an edge coloring of the problem graph can be executed in the first two layers of the phase separator. It uses an internal function to find a (near-)optimal coloring of the problem graph, take the subgraph induced by the two largest colors and decompose the subgraph into chains and loops. The loops are then broken down into chains and all these small chains are then placed onto a big chain embedded along the
qpu
.- Parameters:
problem_bqm (BinaryQuadraticModel) – The
BinaryQuadraticModel
representation of the problem.qpu (QPU) – The QPU, an object of the
QPU
class (or any of its subclasses).
- Returns:
The initial mapping (as
Mapping
) and a list of two lists ofLogEdge
interactions that can be implemented in the first two layers of the routing algorithm.- Return type: