  Recently, the development of quantum chips has made great progress-- the
number of qubits is increasing and the fidelity is getting higher. However,
qubits of these chips are not always fully connected, which sets additional
barriers for implementing quantum algorithms and programming quantum programs.
In this paper, we introduce a general circuit optimizing scheme, which can
efficiently adjust and optimize quantum circuits according to arbitrary given
qubits' layout by adding additional quantum gates, exchanging qubits and
merging single-qubit gates. Compared with the optimizing algorithm of IBM's
QISKit, the quantum gates consumed by our scheme is 74.7%, and the execution
time is only 12.9% on average.
