Repository: Qiskit/qiskit

Issue:
CouplingMap doesn't document it creates (and requires) a graph with contiguous qubit ids
### Information

- **Qiskit Terra version**: `qiskit-terra==0.18.1`
- **Python version**: `3.7.3`
- **Operating system**: `macOS Mojave`

### What is the current behavior?
transpiler CouplingMap method fails to recognize that the graph with edges `(0, 1), (1, 4)` is connected.

### Steps to reproduce the problem
```
import networkx as nx
from qiskit.transpiler import CouplingMap

edges = [(0, 1), (1, 4)]
subg_coupling = CouplingMap(edges)
print(subg_coupling.get_edges())
print(subg_coupling.is_connected())
print(nx.is_connected(nx.Graph(edges)))
```


### What is the expected behavior?
The CouplingMap is_connected() method returns False, while the networkx  method returns True. 


### Suggested solutions
One option is to use the `networkx` is_connected() method instead of the `retworkx` method.




Discussion:
This isn't an issue with the underlying graph library being used, networkx would return the same result as retworkx if you were using the same graph (they use basically the same algorithm for determining weakly connected directed graphs anyway). The issue you're hitting here is that you're making a coupling map with 5 qubits/nodes, 2 of which aren't connected to anything. The coupling map object requires that all nodes are contiguously indexed starting at 0. So when you pass the constructor 0, 1, and 4 as indices it fills the gaps. For example drawing you above example:

```python
from qiskit.transpiler import CouplingMap
cmap = CouplingMap([(0, 1), (1, 4)])
cmap.draw()
```

![cmap](https://user-images.githubusercontent.com/2447371/132605839-26c32138-1a91-4939-8f0d-60441886797b.png)

this is a documentation bug in the coupling map class because https://qiskit.org/documentation/stubs/qiskit.transpiler.CouplingMap.html?highlight=couplingmap#qiskit.transpiler.CouplingMap doesn't explain this at all which we should fix.
Hi! Would it be possible to be assigned to this issue?
Also, as the name says, we should check when coupling map is created, if the coupling map has contiguous qubit ids.
Sure I'll assign you it now, it's actually just missing documentation on the `CouplingMap` class the constructor already identifies holes in the qubit ids passed in the edge list and fills them (see my earlier comment with the example). But, this behavior and the general requirement that the indices are contiguous starting at 0 is completely undocumented and not mentioned in the class documentation.

Resolving patch:
diff --git a/qiskit/transpiler/coupling.py b/qiskit/transpiler/coupling.py
--- a/qiskit/transpiler/coupling.py
+++ b/qiskit/transpiler/coupling.py
@@ -46,6 +46,8 @@ def __init__(self, couplinglist=None, description=None):
         Args:
             couplinglist (list or None): An initial coupling graph, specified as
                 an adjacency list containing couplings, e.g. [[0,1], [0,2], [1,2]].
+                It is required that nodes are contiguously indexed starting at 0.
+                Missed nodes will be added as isolated nodes in the coupling map.
             description (str): A string to describe the coupling map.
         """
         self.description = description


Test patch: