Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove list searches in CouplingMap.distance()
Previously, the CouplingMap.distance() method was checking whether the qubit number was in the coupling graph by searching over a list for the coupling map indices. This search becomes a bottleneck at large qubit numbers because in the worst case it has to traverse the entire list to find a match. This also is unecessary because the coupling map indices are always an ordered range from 0 to n for n qubits. This commit fixes this bottleneck by updating the check to just error if the index is out of bounds for the size of the graph. Related to Qiskit#5197
- Loading branch information