Update retworkx API usage (#5088)
Update retworkx API usage (#5088)

with the release of retworkx 0.5.0 recently there have been several
usability improvements made to the retworkx api. The biggest of these
was support for python's mapping protocol on graph objects. This commit
goes through and either simplifies the retworkx usage. There are also a
few places where python loops and multiple function calls are replaced
by a single retworkx call.

Co-authored-by: Luciano Bello <e038f7a74cc380eed3dcb32b96cec8e184cd69ed@ibm.com>
QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py