qiskit/transpiler/coupling.py
def distance(self, physical_qubit1, physical_qubit2):
        """Returns the undirected distance between physical_qubit1 and physical_qubit2.

        Args:
            physical_qubit1 (int): A physical qubit
            physical_qubit2 (int): Another physical qubit

        Returns:
            int: The undirected distance

        Raises:
            CouplingError: if the qubits do not exist in the CouplingMap
        """
        if physical_qubit1 not in self.physical_qubits:
            raise CouplingError("%s not in coupling graph" % (physical_qubit1,))
        if physical_qubit2 not in self.physical_qubits:
            raise CouplingError("%s not in coupling graph" % (physical_qubit2,))
        if self._dist_matrix is None:
            self._compute_distance_matrix()
        return self._dist_matrix[physical_qubit1, physical_qubit2]
def distance(self, physical_qubit1, physical_qubit2):
        if physical_qubit1 not in self.physical_qubits:
            raise CouplingError("%s not in coupling graph" % (physical_qubit1,))
        if physical_qubit2 not in self.physical_qubits:
            raise CouplingError("%s not in coupling graph" % (physical_qubit2,))
        if self._dist_matrix is None:
            self._compute_distance_matrix()
        return self._dist_matrix[physical_qubit1, physical_qubit2]
def distance ( self , physical_qubit1 , physical_qubit2 ) : if physical_qubit1 not in self . physical_qubits : raise CouplingError ( "%s not in coupling graph" % ( physical_qubit1 , ) ) if physical_qubit2 not in self . physical_qubits : raise CouplingError ( "%s not in coupling graph" % ( physical_qubit2 , ) ) if self . _dist_matrix is None : self . _compute_distance_matrix ( ) return self . _dist_matrix [ physical_qubit1 , physical_qubit2 ]
Returns the undirected distance between physical_qubit1 and physical_qubit2.

        Args:
            physical_qubit1 (int): A physical qubit
            physical_qubit2 (int): Another physical qubit

        Returns:
            int: The undirected distance

        Raises:
            CouplingError: if the qubits do not exist in the CouplingMap
Returns the undirected distance between physical_qubit1 and physical_qubit2 .